openCV AdaptiveThreshold versus Otsu Threshold. ROI
Asked Answered
P

2

7

I'm tried to use both of the methods but it seems like Adaptive threshold seems to be giving a better result. I used

 cvSmooth( temp, dst,CV_GAUSSIAN,9,9, 0);

on the original image then only i used the threshold.

Is there anything I can tweak with the Otsu method to make the image better like adaptive thresholding? And 1 more thing, there are some unwanted fingerprint residue on the side, any idea how i can dispose them off?

I read from a journal that by comparing the percentage of the white pixels in a self-defined square, I can get the ROI. However this method requires me to have a threshold value which can be found using OTSU method but I'm not too sure about AdaptiveThresholding.

cvAdaptiveThreshold( temp, dst, 255,CV_ADAPTIVE_THRESH_MEAN_C,CV_THRESH_BINARY,13, 1 );

Result :

originaladaptive

cvThreshold(temp, dst, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);

original otsu

Plating answered 18/3, 2014 at 4:55 Comment(1)
use morphological operators to get rid of the noise at the border. docs.opencv.org/doc/tutorials/imgproc/erosion_dilatation/…Wishywashy
G
3

To get rid of the unwanted background, you can do a simple masking operation. The Otsu threshold function provides a threshold value that cuts the foreground image from the background. Use that threshold value in order to create a binary mask by iterating through the entire input image, checking if the current pixel value is greater than the threshold, and setting it to 1 if true or 0 if it is false.

Then, you can apply the binary mask to the original image by a simple matrix multiplication operation or a bitwise shift operation to remove the background.

Glutton answered 20/11, 2014 at 1:37 Comment(0)
S
1

Try dividing the image into ROIs and apply otsu individually, then merge them back. Dividing strategy can be static or dynamic depending on the max illumination.

Sard answered 6/6, 2014 at 10:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.