Removing Non-Significant Objects After Image Segmentation

Image Segmenter

Objective

Following this tutorial, you will learn how to use EasyObject to detect bad rice grains (largely dark) among many normal rice grains (largely light).

You'll need first to load the source image (step 1). Then you'll perform the image segmentation, based on a threshold value (step 2). All the detected objects are dark, but some are too small to be significant. So, you'll set a minimum object area (number of pixels), and remove the smallest objects (step 3). Finally, you'll get only the objects that really represent bad rice grains.

Source image

Bad rice grains are detected

Step 1: Load the source image

1. From the main menu, click EasyObject, then New EasyObject Tool.
2. Keep the default variable name for the new object, and click OK.
3. In the Encoder tab, click the Open icon of the Source Image area, and load the image file EasyObject\Rice.jpg.
4. Keep the default variable name for the new image, and click OK.

Step 2: Perform image segmentation

1. In the Encoder tab, select the Black Layer check-box, and unselect the White Layer check-box.
2. Click the ... button around the Threshold field. In the Threshold dialog box, select Absolute, enter '115', and click OK.
3. Click Encode to detect the dark objects. In the image, each object is drawn using a different color.
4. Click Results to display the list of all the detected objects. Clicking an object in the image highlights it in the list, and vice versa.

Step 3: Remove the smallest objects

1. In the objects list, click Columns.
2. Tick the Area check-box, and click OK. In the list view, a new Area column appears, displaying each object area.
3. Click the Area column header to sort the objects. There are many small objects (area < 100) that may be considered as noise.
4. In the Selection tab, select Area from the Feature drop-down list. Select 'Less' from the Mode drop-down list. In the Threshold field, enter '100'.
5. Click Remove. All the objects with an area smaller than 100 pixels have been removed from the list. The two remaining objects are the bad rice grains.