PRODUCTS
Products Overview
Mathematica
Mathematica Student Edition
Mathematica Home Edition
Wolfram
CDF Player
(free download)
Computable Document Format (CDF)
web
Mathematica
grid
Mathematica
Wolfram
Workbench
Wolfram
SystemModeler
Wolfram
Finance Platform
Mathematica
Add-Ons
Wolfram|Alpha Products
SOLUTIONS
Solutions Overview
Engineering
Aerospace Engineering & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Materials Science
Mechanical Engineering
Operations Research
Optics
Petroleum Engineering
Biotechnology & Medicine
Bioinformatics
Medical Imaging
Finance, Statistics & Business Analysis
Actuarial Sciences
Data Analysis & Mining
Econometrics
Economics
Financial Engineering & Mathematics
Financial Risk Management
Statistics
Software Engineering & Content Delivery
Authoring & Publishing
Interface Development
Software Engineering
Web Development
Science
Astronomy
Biological Sciences
Chemistry
Environmental Sciences
Geosciences
Social & Behavioral Sciences
Design, Arts & Entertainment
Game Design, Special Effects & Generative Art
Education
STEM Education Initiative
Higher Education
Community & Technical College Education
Primary & Secondary Education
Students
Technology
Computable Document Format (CDF)
High-Performance & Parallel Computing (HPC)
See Also: Technology Guide
PURCHASE
Online Store
Other Ways to Buy
Volume & Site Licensing
Contact Sales
Software
Service
Upgrades
Training
Books
Merchandise
SUPPORT
Support Overview
Mathematica
Documentation
Knowledge Base
Learning Center
Technical Services
Community & Forums
Training
Does My Site Have a License?
Wolfram User Portal
COMPANY
About Wolfram Research
News
Events
Wolfram Blog
Partnerships
Employment Opportunities
History of
Mathematica
Stephen Wolfram's Home Page
Contact Us
OUR SITES
All Sites
Wolfram|Alpha
Demonstrations Project
MathWorld
Integrator
Wolfram Functions Site
Mathematica Journal
Wolfram Media
Wolfram
Tones
Wolfram Science
Stephen Wolfram
DOCUMENTATION CENTER SEARCH
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]=
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.