Use Open cv to analyze the palm line
Use Open cv to analyze the palm line main line extraction! How to do scientific fortune telling?
We will use Python and OpenCV libraries in this article to find the main lines in our palms.
First, let's read the original image:
import cv2
image = cv2.imread(r'G:\PARAS\palm.jpeg')
cv2.imshow("palm",image) #to view the palm in python
cv2.waitKey(0)
#Now we will use a filtering algorithm called Canny Edge Detector
# to find the palm print. For different images, we need to change the parameters accordingly.
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)#Now we convert the image to grayscale:
edges = cv2.Canny(gray,60,65,apertureSize = 3)
cv2.imshow("edges",edges)
cv2.waitKey(0)
#Now we will reverse the color to ensure that the recognized line is black:
edges = cv2.bitwise_not(edges)
cv2.imshow("change black and white",edges)
cv2.waitKey(0)
#Now we mix the image above with the original image.
cv2.imwrite("palmlines.jpg", edges)
palmlines = cv2.imread("palmlines.jpg")
img = cv2.addWeighted(palmlines, 0.3, image, 0.7, 0)
cv2.imshow("lines in palm", img)
cv2.waitKey(0)
Comments
Post a Comment