Ask Your Question

Revision history [back]

How to extract palm lines?

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!

How to extract palm lines?

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!appreciated!!

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

original picture attached: image description

How to extract palm lines?

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 descriptionimage description