The images I am working on are like this one
The main goal is to calculate the crease (the blue line like shown in this image)
The idea is that I have to find the center curved line of this image, detect its two extreme points so I can draw the red line, then find the centroid point to draw the blue line I tried the skeleton algorithm:
import cv2 import numpy as np from matplotlib import pyplot as plt kernel=np.ones((7,7),np.uint8) # Read the image as a grayscale image img = cv2.imread('ressources/ss.jpg', 0) #Threshold the image ret,img = cv2.threshold(img,100, 255, 0) imgGray=cv2.GaussianBlur(img,(7,7),0) # Step 1: Create an empty skeleton size = np.size(img) skel = np.zeros(img.shape, np.uint8) # Get a Cross Shaped Kernel element = cv2.getStructuringElement(cv2.MORPH_CROSS, (3,3)) # Repeat steps 2-4 while True: #Step 2: Open the image open = cv2.morphologyEx(img, cv2.MORPH_OPEN, element) #Step 3: Substract open from the original image temp = cv2.subtract(img, open) #Step 4: Erode the original image and refine the skeleton eroded = cv2.erode(img, element) skel = cv2.bitwise_or(skel,temp) img = eroded.copy() # Step 5: If there are no white pixels left ie.. the image has been completely eroded, quit the loop if cv2.countNonZero(img)==0: break
and this is what I got:
Now I don’t have access to that center line that I got and I need it so that I can find these three red points
What can I do?