open cv lecture 5.opencv_point_processing(2)

27
OpenCV Lecture #5. Point Processing (2) MareArts

Upload: jeonghyun-kim

Post on 12-Apr-2017

391 views

Category:

Internet


2 download

TRANSCRIPT

Page 1: Open cv lecture 5.opencv_point_processing(2)

OpenCV Lecture#5. Point Processing (2)

MareArts

Page 2: Open cv lecture 5.opencv_point_processing(2)

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)

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)

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)

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)

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)

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)

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)

example code for basic threshold

Let’s look basic code for using threshold function

Page 10: Open cv lecture 5.opencv_point_processing(2)

let’s use threshold function in OpenCV

more detail..

there are 5 options

Page 11: Open cv lecture 5.opencv_point_processing(2)

let’s use threshold function in OpenCV

1. THRESH_BINARY

2. THRESH_BINARY_INV

Page 12: Open cv lecture 5.opencv_point_processing(2)

let’s use threshold function in OpenCV

3. THRESH_TRUNC

4. THRESH_TOZERO

Page 13: Open cv lecture 5.opencv_point_processing(2)

let’s use threshold function in OpenCV

5. THRESH_TOZERO_INV

Page 14: Open cv lecture 5.opencv_point_processing(2)

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)

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)

adaptive threshold

adaptiveThreshold

• ADAPTIVE_THRESH_MEAN_C• ADAPTIVE_THRESH_GAUSSIAN_C

Page 17: Open cv lecture 5.opencv_point_processing(2)

example code for adaptiveThreshold

adaptiveThreshold vs threshold

origin threshold adaptiveThreshold

Page 18: Open cv lecture 5.opencv_point_processing(2)

Otzu Binarization

Otzu method

origin adaptiveThreshold Otzu method

Page 19: Open cv lecture 5.opencv_point_processing(2)

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)

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)

other functions for apply point processing

foodFill function

Page 22: Open cv lecture 5.opencv_point_processing(2)

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)

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)

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)

other functions for apply point processing integral function

Page 26: Open cv lecture 5.opencv_point_processing(2)

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)

Thank you.

See you later ~

In from of ChangWon University dormitory(picture from http://blog.naver.com/PostList.nhn?blogId=maple3419)