Condition Examples

Color Classification

With a simple condition we can compare cell values in different bands to classify colors. For example, we can find all green cells representing parks. Note that in this workspace we use only one band in the band interpretation list, but we still can use values from all bands:
RED8
if (A[1]-A[0]>5 && A[1]-A[2]>5, 200, 255)

This expression sets cell values to 200 where green is bigger than red and blue more than by 5. The rest of the cells are assigned a value of 255.

Input
User-added image   

Output
User-added image
Note that if we simply compare green with red and blue as follows:
if (A[1]>A[0] && A[1]>A[2], 200, 255)

then we will select not only the green cells but also cells that are rather close to gray colors.
  • See attachment: GreenFilter.fmwt

Road Centerline Extraction

The expression used in this example finds colors where all bands have similar values (white/gray/black) used for roads, their edges, and road labels) or colors that are rather yellowish - red and green band values are close, and they are bigger than the blue band.
 
if ((abs(A[0]-A[1])<=3 && abs(A[0]-A[2])<=3) || (abs(A[0]-A[1])<=4 && abs(A[0]-A[2])>10) , 200, 255)

This expression gives the following result:

Input
User-added image   

Output
User-added image
  • See attachment: RoadsOnly.fmwt