MATLAB: How to mark the foreign object inside this bottle.

color segmentationImage Processing Toolboxspatial defects

Hello, i need some help, i got image of beverage with sample of foreign object inside. so how to make a mark (red outline or fill the foreign object with red colour) the area of the foreign object. here i attach my simple code and picture. thank you.

Best Answer

Your best bet might be to take a photo of a perfect sample and then subtract them. Any pixel that is not zero or slightly above is bad. Or you could try the Color Thresholder app on the Apps tab of the tool ribbon to find any non-green pixels.