Detect using adjacent pixels in each column

Listing 4 detects edges using adjacent pixels on the columns.

If an edge is detected in Listing 4,

Listing 4. Detect using adjacent pixels in each column.
        //Now process two adjacent pixels in the same
        // column using the same approach.
        pix2 = picture.getPixel(col,row + 1);
        distance = pix1.colorDistance(pix2.getColor());
        //Compare the color distance to the threshold
        // and change pixel color accordingly.
        if(distance > threshold){
          displayPixel.setColor(Color.BLACK);
        }//end if

      }//end inner loop
    }//end outer loop

    return display;
  }//end edgeDetector
File: bl.htm [Next] [Prev]