I have a palm print image taken using ink and paper which looks like below (a). What I need is to highlight the creases of it preserving the width and orientation of them see figure (b).
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.
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:
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With