Download - Open cv lecture 5.opencv_point_processing(2)
![Page 1: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/1.jpg)
OpenCV Lecture#5. Point Processing (2)
MareArts
![Page 2: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/2.jpg)
Contents
Binary processingwhat is the binary?about threshold functionabout adpativeThreshold function
other application related with point processingusing floodfill functionwhat is the integral image and using
![Page 3: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/3.jpg)
What is the binary image?
What is the binary image?not gray image.Binary image refer to 2 colors, black and white.
How to make binary image?This is very simple, but also very difficult?. ^^
![Page 4: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/4.jpg)
How to make binary image?
Based on the threshold value, If pixel value lager than threshold, then 255 less than threshold, then 0
12 22 200 67156 143 12 199233 77 234 74255 230 33 87
threshold = 1280 0 255 0
255 255 0 255255 0 255 0255 255 0 0
![Page 5: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/5.jpg)
How to make binary image?
How to determine threshold?using Histogram
0 255
votingBest threshold
![Page 6: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/6.jpg)
How to make binary image?
How to determine threshold?can not determine only one value.
0 255
votingBest threshold ?
![Page 7: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/7.jpg)
How to make binary image?
Binarization is also very important in LPR(License Plate Recognition)
![Page 8: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/8.jpg)
How to make binary image?
Binarization is also very important in LPR(License Plate Recognition)
Adaptive Binarization: A New Approach to Licence Plate Characters Segmentation [IEEE 2012]
![Page 9: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/9.jpg)
example code for basic threshold
Let’s look basic code for using threshold function
![Page 10: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/10.jpg)
let’s use threshold function in OpenCV
more detail..
there are 5 options
![Page 11: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/11.jpg)
let’s use threshold function in OpenCV
1. THRESH_BINARY
2. THRESH_BINARY_INV
![Page 12: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/12.jpg)
let’s use threshold function in OpenCV
3. THRESH_TRUNC
4. THRESH_TOZERO
![Page 13: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/13.jpg)
let’s use threshold function in OpenCV
5. THRESH_TOZERO_INV
![Page 14: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/14.jpg)
example code for applying various op-tions
Let’s look threshold function in detail by applying various options
![Page 15: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/15.jpg)
adaptive threshold
One threshold can not binarize in different brightness.So we get different thresholds for different regions of
the same image.adaptive thresholding the algorithm calculate the threshold for a small regions of the
image
origin threshold
adaptiveThreshold
![Page 16: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/16.jpg)
adaptive threshold
adaptiveThreshold
• ADAPTIVE_THRESH_MEAN_C• ADAPTIVE_THRESH_GAUSSIAN_C
![Page 17: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/17.jpg)
example code for adaptiveThreshold
adaptiveThreshold vs threshold
origin threshold adaptiveThreshold
![Page 18: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/18.jpg)
Otzu Binarization
Otzu method
origin adaptiveThreshold Otzu method
![Page 19: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/19.jpg)
Otzu Binarization
Otzu method threshold(Mat, 0, 255, THRESH_BINARY + THRESH_OTSU);
N. Otsu, “A threshold selection method from gray-level histograms,” IEEE Trans. Syst., Man, Cybern., vol. SMC-9, pp. 62-66, 1979
![Page 20: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/20.jpg)
Otzu Binarization
Otsu's algorithm tries to find a threshold value (t) which mini-mizes the weighted within-class variance given by the rela-tion :
good reference site: http://mauver.kr/wp/archives/339
![Page 21: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/21.jpg)
other functions for apply point processing
foodFill function
![Page 22: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/22.jpg)
other functions for apply point processing
foodFill functionhttps://www.learnopencv.com/filling-holes-in-an-image-using-opencv-python-c/
![Page 23: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/23.jpg)
other functions for apply point processing
integral functionQuickly method to add all pixel values for a particular region.
Conventional method to add for a region
![Page 24: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/24.jpg)
other functions for apply point processing
integral function
D Area = (Point 4 + Point 1) – ( Point 2 + Point 3 )
![Page 25: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/25.jpg)
other functions for apply point processing integral function
![Page 26: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/26.jpg)
other functions for apply point processing
integral function It is very useful to calculate a large number of haar-like fea-
tures in the AdaBoost algorithm.
![Page 27: Open cv lecture 5.opencv_point_processing(2)](https://reader036.vdocuments.net/reader036/viewer/2022062401/58ed3c821a28ab7a278b4741/html5/thumbnails/27.jpg)
Thank you.
See you later ~
In from of ChangWon University dormitory(picture from http://blog.naver.com/PostList.nhn?blogId=maple3419)