当前位置:网站首页>Threshold segmentation based on RGB image and threshold adjustment by sliding

Threshold segmentation based on RGB image and threshold adjustment by sliding

2022-07-07 17:41:00 AI cannon fodder

Catalog

1. Overview of color segmentation  

2. Practical cases  

1. Overview of color segmentation  

Threshold segmentation of image color , We often don't know how appropriate the threshold is , It needs constant testing , In response to this problem , Slider with threshold set , Thus, you can quickly find the threshold by sliding the slider .

The most common threshold segmentation is R、G、B Threshold segmentation , That is, to judge the pixel R、G、B Whether the value is greater than or less than a certain threshold , The points that meet the conditions are retained or deleted .

The algorithm of threshold segmentation in this code is to traverse each pixel of the image directly by row and column , Judge whether the value of the pixel meets the segmentation conditions , Meet the requirement of setting the point to black to achieve the effect of segmentation . The code is threshold 、 R、G、B、 And mode are set with slider , The modes are 4 Kind of :

0----RGB        R、G、B Points with values greater than the threshold are set to black
1----|G-R|        G-R The absolute value of the value is less than threshod_value The point of is set to black
2----|2G-R-B|        2G-R-B The absolute value of value is greater than threshod_value The point of is set to black
3----G/R

原网站

版权声明
本文为[AI cannon fodder]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071529539942.html