WolframAlpha.com
WolframCloud.com
All Sites & Public Resources...
Products & Services
Wolfram|One
Mathematica
Wolfram|Alpha Notebook Edition
Finance Platform
System Modeler
Wolfram Player
Wolfram Engine
WolframScript
Enterprise Private Cloud
Application Server
Enterprise Mathematica
Wolfram|Alpha Appliance
Enterprise Solutions
Corporate Consulting
Technical Consulting
Wolfram|Alpha Business Solutions
Resource System
Data Repository
Neural Net Repository
Function Repository
Wolfram|Alpha
Wolfram|Alpha Pro
Problem Generator
API
Data Drop
Products for Education
Mobile Apps
Wolfram Player
Wolfram Cloud App
Wolfram|Alpha for Mobile
Wolfram|Alpha-Powered Apps
Services
Paid Project Support
Wolfram U
Summer Programs
All Products & Services »
Technologies
Wolfram Language
Revolutionary knowledge-based programming language.
Wolfram Cloud
Central infrastructure for Wolfram's cloud products & services.
Wolfram Science
Technology-enabling science of the computational universe.
Wolfram Notebooks
The preeminent environment for any technical workflows.
Wolfram Engine
Software engine implementing the Wolfram Language.
Wolfram Natural Language Understanding System
Knowledge-based broadly deployed natural language.
Wolfram Data Framework
Semantic framework for real-world data.
Wolfram Universal Deployment System
Instant deployment across cloud, desktop, mobile, and more.
Wolfram Knowledgebase
Curated computable knowledge powering Wolfram|Alpha.
All Technologies »
Solutions
Engineering, R&D
Aerospace & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Mechanical Engineering
Operations Research
More...
Finance, Statistics & Business Analysis
Actuarial Sciences
Bioinformatics
Data Science
Econometrics
Financial Risk Management
Statistics
More...
Education
All Solutions for Education
Tech & Trends
Machine Learning
Multiparadigm Data Science
High-Performance Computing
Quantum Computation Framework
Software & Web
Software Development
Authoring & Publishing
Interface Development
Web Development
Sciences
Astronomy
Biology
Chemistry
More...
All Solutions »
Learning & Support
Learning
Wolfram Language Documentation
Fast Introduction for Programmers
Wolfram U
Videos & Screencasts
Wolfram Language Introductory Book
Webinars & Training
Summer Programs
Books
Need Help?
Support FAQ
Wolfram Community
Contact Support
Premium Support
Paid Project Support
Technical Consulting
All Learning & Support »
Company
About
Company Background
Wolfram Blog
Events
Contact Us
Work with Us
Careers at Wolfram
Internships
Other Wolfram Language Jobs
Initiatives
Wolfram Foundation
MathWorld
Computer-Based Math
A New Kind of Science
Wolfram Technology for Hackathons
Student Ambassador Program
Wolfram for Startups
Demonstrations Project
Wolfram Innovator Awards
Wolfram + Raspberry Pi
Summer Programs
More...
All Company »
Search
Legacy Documentation
Digital Image Processing
(2000)
This is documentation for an obsolete product.
Current products and services
Function Index
Where
Where[
img
]
returns the positions of all nonzero elements in
img
.
Where[
img
,
crit
]
returns the positions of all elements in
img
meeting
crit
.
The argument
crit
may be given in the form of a pattern object or
PatternTest
.
The argument
img
may be a list or
ImageData
expression.
Some common test criteria for single-channel images include the following:
To test for zero, use
Where
[
img
,
_?(#
0&)
]
or
Where
[
img
,
0
]
.
To test for values in a range, use
Where
[
img
,
_?( 0≤ #<64 &)
]
.
Here are examples of tests on multichannel images in meshed format.
To test for zero on the third channel, use
Where
[
img
,
{_,_,_?(#
0&)}
]
or the simpler form
Where[
img
,{_,_,0}]
.
To test channels one or two for 0, use
Where
[
img
,
_?(#
1
=0 || #
2
=0 &)
]
.
To test a composite condition, for example an average value greater than 128, use
Where
[
img
,
_?(Plus@@#/3 > 128 &)
]
.
See also User's Guide
7.2
.
Examples
This loads the package.
In[1]:=
Here we find the positions of all the nonzero elements in a list.
In[2]:=
Out[2]=
Here we find the positions of all the elements greater than some chosen value.
In[3]:=
Out[3]=
Here we load a test image.
In[4]:=
Out[4]//InputForm=
Here we use a test to find all pixels with a large red channel value.
In[5]:=
Out[5]=
Here we use a test to find all pixels with a large cumulative color value (the sum of the three colors exceeds 500).
In[6]:=
Out[6]=
Enable JavaScript to interact with content and submit forms on Wolfram websites.
Learn how »