[英]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))
You can detect corners with the OpenCV
too您也可以使用
OpenCV
检测角点
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
cv2.circle(image, (x, y), radius=4, color=(0, 255, 120), thickness=2)
cv2.imshow("Result", image)
cv2.waitKey(0)
Result:结果:
For more details please check these docs:有关更多详细信息,请查看这些文档:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.