What are the methods of machine vision image segmentation?

Publisher:EnchantedWishLatest update time:2024-02-03 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Image segmentation refers to the technology and process of dividing an image into regions with characteristics and extracting targets of interest.

9c0a5ac8-7913-11ee-939d-92fbcf53809c.png

Existing image segmentation methods are mainly divided into the following categories: threshold-based segmentation methods, region-based segmentation methods, edge-based segmentation methods, and segmentation methods based on specific theories.

The threshold-based segmentation method is a widely used image segmentation technology. Its essence is to use the grayscale histogram information of the image to obtain the threshold used for segmentation. One or several thresholds divide the grayscale of the image into several parts, and the pixels belonging to the same part are considered to be the same object.

1. Introduction to Grayscale Threshold Method

1. Principle

The transformation function expression of image thresholding is:

9c1b1354-7913-11ee-939d-92fbcf53809c.png

2. Selection of threshold

• Bimodal method

• Iteration method

• Otsu Method

• Discriminant analysis

• Optimal Entropy Automatic Thresholding Method

2. Determine the threshold value by the maximum inter-class variance (Otsu method)

The Otsu method is also called the maximum between-class variance method and the maximum between-class threshold method (OTSU).

Its basic idea is to use a threshold to divide the data in the image into two categories, one category in which the grayscale of the pixels in the image is less than the threshold, and the other category in which the grayscale of the pixels in the image is greater than or equal to the threshold.

If the variance of the grayscale of the pixels in these two classes is larger, it means that the threshold obtained is the optimal threshold (variance is a measure of the uniformity of grayscale distribution. The larger the inter-class variance between the background and the foreground, the greater the difference between the two parts of the image. When part of the foreground is mistakenly classified as the background or part of the background is mistakenly classified as the foreground, the difference between the two parts will become smaller.

Therefore, the segmentation that maximizes the inter-class variance means the minimum probability of misclassification. ) The image can be divided into two parts, foreground and background, using this threshold.

The part we are interested in is generally the foreground.

For detailed analysis, please refer to my other blog post: Otsu Method (OTSU)

(https://blog.csdn.net/m0_53966219/article/details/126621122?spm=1001.2014.3001.5501)

9c24c016-7913-11ee-939d-92fbcf53809c.png

3. Bimodal Threshold Segmentation

Bimodal threshold segmentation I=imread('test2.jpg'); I=rgb2gray(I); subplot(1,2,1);imhist(I);title('Histogram');thread=130/255;subplot(1,2,2); I3=im2bw(I,thread);imshow(I3);title('Bimodal segmentation image');

4. Iterative Threshold Segmentation

1. Steps

1. Select the initial segmentation threshold, usually the image grayscale average value T.

2. According to the threshold TT, the image pixels are divided into background and foreground, and the average grayscale T_0 and T_1 of the two are calculated respectively.

3. Calculate the new threshold T′=(T0+T1)/2.

4. If T==T′, the iteration ends and T is the final threshold. Otherwise, let T=T′ and go to step (2).

2. Implementation

A = imread('text.png');figure;subplot(121);imshow(A);title('Original image')T = mean2(A); %Take the mean as the initial thresholddone = false; %Define the amount to jump out of the loopi = 0;%while loop iterateswhile ~done r1 = find(A<=T); %The part less than the threshold r2 = find(A>T); %The part greater than the threshold Tnew = (mean(A(r1)) + mean(A(r2))) / 2; %Calculate the mean of the threshold means of the two parts after segmentation done = abs(Tnew - T) < 1; %Judge whether the iteration converges T = Tnew; %If not, use the mean of the segmented means as the new threshold for loop calculation i = i+1;endA(r1) = 0; %Assign the part less than the threshold to 0A(r2) = 1; %Assign the part greater than the threshold to 1 These two steps are to convert the image into a binary image subplot(122);imshow(A,[]);title('After iterative processing')


Reference address:What are the methods of machine vision image segmentation?

Previous article:What is motor overload protection?
Next article:Discussion on the maintenance method of emergency stop failure of CNC machine tools

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号