How do I get a curve point on a line?

i want to detect all corner and start , end point on line. i can detect start and end point but curve can’t detect. this is my code

from scipy.ndimage import generic_filter

def lineEnds(P):
    return 255 * ((P[4]==255) and np.sum(P)==510)

 image = cv2.imread("./dataset/test.jpg" , cv2.COLOR_RGB2GRAY)
 result = generic_filter(image , lineEnds, (3, 3))

image = enter image description here

result = enter image description here


You can detect corners with the OpenCV too

import cv2

image = cv2.imread('./test.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Detect corners in the image
corners = cv2.goodFeaturesToTrack(gray, 500, qualityLevel=0.01, minDistance=20)

for c in corners:
    x, y = c.reshape(2)
    print(x, y)
    # draw a circle around the detected corner, (x, y), radius=4, color=(0, 255, 120), thickness=2)

cv2.imshow("Result", image)


enter image description here

For more details please check these docs:

Shi-Tomasi Corner Detector

Harris Corner Detection