Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
830 views
in Technique[技术] by (71.8m points)

opencv - How to find the extreme corner point in image ?

source image1 source image2

destination image1 destination image2

Form the source images above ( source image1、image2), I wanna find the extreme corner point and get the points like destination image1、image2 what I draw the red circle point.

Actually I investigate the Harris、Shi Tomasi Algorithm, but they are not so extreme.

Actually I have tried goodFeaturesTotrack using java code, likes:

goodFeaturesToTrack(basedImg,corners,10,0.2,10,maskMat,3,false,0.04);  for (int j=0;j<cornerArray.length;j++){
                Point curP = cornerArray[j];
                Imgproc.circle(retImg,curP,3,new Scalar(255,0,0),-1);
            }

the result image is following:

magnify to find blue corner point

Although it could find some blue characteristic point, but not so extremely as what I showed the destination image1、image2.

So do you have some good idea to find the corner point which are special character ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use cv2.goodFeaturesToTrack() for corner detection. The function takes four parameters

corners = cv2.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance)
  • image - Input 8-bit or floating-point 32-bit grayscale single-channel image
  • maxCorners - Maximum number of corners to return
  • qualityLevel - Minimum accepted quality level of corners between 0-1. All corners below quality level are rejected
  • minDistance - Minimum possible Euclidean distance between corners

enter image description here

import cv2

image = cv2.imread('1.png')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

corners = cv2.goodFeaturesToTrack(gray,10,0.2,20)

for corner in corners:
    x,y = corner.ravel()
    cv2.circle(image,(x,y),5,(36,255,12),-1)

cv2.imshow('image', image)
cv2.waitKey()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...