MATLAB: How to draw the bounding box around the apple

color segmentationfruitfruits recognitionImage Processing Toolbox

I am new in Matlab, my task is to draw the bounding box around the apple, plz help me in this task.

Best Answer

Very easy. Just use color segmentation. I have several demos in my File Exchange:
If the apple has irregularities on the edges after segmentation, you can use activecontour() as shown in my attached demo to smooth the outline. Or else you can blur the color channel image before you threshold it.