Algorithm 2. The pseudo code of image segmentation and targets extraction. |
Input: Captured vineyard images
For all pixels in the image
If ()
Pixel binary value=1
Else
Pixel binary value =0
End
End
For all pixel regions(value for 1) in the binary image
Eliminate the regions which are smaller than 1/4 of the biggest region
Perform open and close operator to delete the adhesion noise
Fill the hole for every pixel regions
Draw the enclosing rectangle for every pixel regions
End
|
Output: Binary image that contains only the grape clusters |