Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight only the creases (primary lines and wrinkles) in a palm print image

I have a palm print image taken using ink and paper which looks like below (a).enter image description here What I need is to highlight the creases of it preserving the width and orientation of them see figure (b). Ink and paper palm print imge

I tried using edge detectors like Canny, Laplacian and Sobel operators with different threshold values but couldn't come up with a clear crease map as in (b). But when above mention edge detectors are used all the black lines are detected as edges. What i want is only to highlight the thicker white lines of image (a). I am using OpenCV 2.4.5. Can anyone help? Thank you.

like image 619
Les_Salantes Avatar asked May 09 '13 06:05

Les_Salantes


2 Answers

This is the method I came up with:

cv::Mat im;    //Already loaded
cv::Mat grey;
cv::cvtColor(im, grey, CV_BGR2GRAY);

cv::Mat binary;
cv::threshold(grey, binary, 0, 255, cv::THRESH_OTSU);

//Create a mask of the hand region
cv::Mat mask;
cv::Mat kern = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(20,20));  //Large kernel to remove all interior detail
cv::morphologyEx(binary, mask, cv::MORPH_OPEN, kern);
cv::threshold(mask, mask, 128, 255, cv::THRESH_BINARY_INV);     //Invert colors

cv::imshow("", mask);

//Remove thin lines
cv::Mat blurred;
cv::GaussianBlur(grey, blurred, cv::Size(9,9), 0);  
cv::threshold(blurred, binary, 0, 255, cv::THRESH_OTSU);
cv::morphologyEx(binary, binary, cv::MORPH_OPEN, cv::noArray());

cv::Mat result;
binary.copyTo(result, mask);

Which gives this result:Palm lines result

There are some artifacts at the edges from the mask, which could be remedied by using a more complex masking method. The kernel sizes for blurring and morphological operations can obviously be modified for different levels of detail.

like image 136
Aurelius Avatar answered Oct 30 '22 16:10

Aurelius


Firstly you can convert the image to binary using thresholding.

Then you can apply some morphological operations like erosion, so that thin lines can be filtered, there is a builtin method in openCV for this operation.

Finally, you can use one of the edge detectors you mentioned.

like image 28
fatihk Avatar answered Oct 30 '22 18:10

fatihk