Image segmentation refers to the technology and process of dividing an image into regions with characteristics and extracting targets of interest.
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:
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)
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')
Previous article:What is motor overload protection?
Next article:Discussion on the maintenance method of emergency stop failure of CNC machine tools
- Popular Resources
- Popular amplifiers
- Semantic Segmentation for Autonomous Driving: Model Evaluation, Dataset Generation, Viewpoint Comparison, and Real-time Performance
- Hardware Accelerators in Autonomous Driving
- Linear Algebra for Computer Vision, Robotics, and Machine Learning
- Image segmentation: principles, techniques and applications
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- An annular solar eclipse is coming. Have those in the annular eclipse zone seen it?
- How to set differential traces for high-speed USB positive and negative in AD16 PCB
- 【Infineon XENSIV PAS CO2 sensor】Official data study
- Looking for a brushless gate driver design
- Voltage boost circuit and electrode detachment detection circuit
- HuaDa MCU M4 RTThread real-time operating system
- Is it suitable for use on Earth? NASA recently open-sourced the Linux flight control code for the Mars drone
- Attention if you use AD software to draw holes!
- Repair superior mobile hard disk box——Y-3026
- Wireless inductive charging in low-power wearable designs