Mode 3 is spot detection. For spot detection we are creating a
bounding box across the white detected region. In that region
we are checking for number of zeros found. If the number of
zeros (black pixel) is greater than a threshold which is
decided by user than t red spot _flag or goes high else its
zero, thus good quality and bad quality fruits or vegetables
can be distinguished. Here while experiment we have taken
red colored tomato for spot detection, but we can choose any
colored vegetable, just we will have to do little calibration.
Snapshots of the processed images for spotted tomato i.e.