Ask Your Question
0

How to extract palm lines?

asked 2019-09-24 08:09:35 -0600

ZhouX gravatar image

updated 2019-09-24 22:16:45 -0600

I'm studying OpenCV with python by working on a project which aims to detect the palm lines.

image description

What I have done is basically use Canny edge detection and then apply Hough line detection on the edges but the outcome is not so good.

Here is the source code I am using:

original = cv2.imread(file)
img = cv2.cvtColor(original, cv2.COLOR_BGR2GRAY)
save_image_file(img, "gray")

img = cv2.equalizeHist(img)
save_image_file(img, "equalize")

img = cv2.GaussianBlur(img, (9, 9), 0)
save_image_file(img, "blur")

img = cv2.Canny(img, 40, 80)
save_image_file(img, "canny")

lined = np.copy(original) * 0
lines = cv2.HoughLinesP(img, 1, np.pi / 180, 15, np.array([]), 50, 20)
for line in lines:
    for x1, y1, x2, y2 in line:
        cv2.line(lined, (x1, y1), (x2, y2), (0, 0, 255))
save_image_file(lined, "lined")

output = cv2.addWeighted(original, 0.8, lined, 1, 0)
save_image_file(output, "output")

I tried different parameter sets of Gaussian kernel size and Canny low/high thresholds, but the outcome is either having too much noises, or missing (part of) major lines. Below picture is already the best I get, so far..

image description

Is there anything I should do to get result improved, or any other approach would get better result? Any help would be appreciated!!

-------- updated 2019-09-25 --------

original picture attached: image description

edit retag flag offensive close merge delete

Comments

1

could you post the original image

sturkmen gravatar imagesturkmen ( 2019-09-24 08:46:45 -0600 )edit
1

@sturkmen hi, the original image has been attached, thanks in advance!

ZhouX gravatar imageZhouX ( 2019-09-24 22:17:38 -0600 )edit

We all go the same way in solving this problem. I also added dilate() and erode() functions after the Canny's algorithm to rid off of some noise, but still, not even close to the satisfying result

import cv2

import numpy as np

kernel = np.ones((5,5),np.uint8)

original = cv2.imread("Canny.jpg")

original = cv2.dilate(original, kernel, iterations = 10)

original = cv2.erode(original, kernel, iterations = 11)

cv2.imwrite("result.jpg", original)

RomanBrajnikoff gravatar imageRomanBrajnikoff ( 2019-10-07 03:10:39 -0600 )edit

@RomanBrajnikoff Hi, yes those two more filters bring no significant improvement, but thanks all the same :)

ZhouX gravatar imageZhouX ( 2019-10-15 06:10:22 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
-2

answered 2019-09-25 08:51:36 -0600

CV gravatar image

try Sobel operator

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-09-24 08:09:35 -0600

Seen: 1,724 times

Last updated: Sep 25 '19