Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To find the coordinates of corners detected by Harris corner detection

I have applied harris corner detection on the following image Input Image

and obtained the result as Image after Harris corner detection

and now i want to find the coordinates of these corner pixels marked in red how do i do so?

Code

click to hide/show revision 2
None

updated 2018-03-12 13:12:45 -0600

berak gravatar image

To find the coordinates of corners detected by Harris corner detection

I have applied harris corner detection on the following image Input Image

and obtained the result as Image after Harris corner detection

and now i want to find the coordinates of these corner pixels marked in red how do i do so?

Code

click to hide/show revision 3
retagged

updated 2018-03-12 13:13:34 -0600

berak gravatar image

To find the coordinates of corners detected by Harris corner detection

I have applied harris corner detection on the following image Input Image

and obtained the result as Image after Harris corner detection

and now i want to find the coordinates of these corner pixels marked in red how do i do so?

To find the coordinates of corners detected by Harris corner detection

I have applied harris corner detection on the following image Input Image

and obtained the result as Image after Harris corner detection

and now i want to find the coordinates of these corner pixels marked in red how do i do so?

Code:

import numpy as np

import cv2

img=cv2.imread('trial1.jpg')

h,w,l=img.shape

res=cv2.resize(img,(w/4,h/4),interpolation=cv2.INTER_LINEAR)

gray = cv2.cvtColor(res,cv2.COLOR_BGR2GRAY)

gray = np.float32(gray)

dst = cv2.cornerHarris(gray,2,3,0.04)

cv2.imwrite('dsttest.jpg',dst)

dst = cv2.dilate(dst,None)

res[dst>0.01*dst.max()]=[0,0,255]

points=np.unravel_index(dst.argmax(),dst.shape)

print list(points)

cv2.imwrite('dst.jpg',res)

cv2.waitKey(0)

cv2.destroyAllWindows()

click to hide/show revision 5
None

updated 2018-03-12 14:24:46 -0600

berak gravatar image

To find the coordinates of corners detected by Harris corner detection

I have applied harris corner detection on the following image Input Image

and obtained the result as Image after Harris corner detection

and now i want to find the coordinates of these corner pixels marked in red how do i do so?

Code:

import numpy as np

np import cv2 img=cv2.imread('trial1.jpg') h,w,l=img.shape res=cv2.resize(img,(w/4,h/4),interpolation=cv2.INTER_LINEAR) gray = cv2.cvtColor(res,cv2.COLOR_BGR2GRAY) gray = np.float32(gray) dst = cv2.cornerHarris(gray,2,3,0.04) cv2.imwrite('dsttest.jpg',dst)

import cv2

dst = cv2.dilate(dst,None)

img=cv2.imread('trial1.jpg')

res[dst>0.01*dst.max()]=[0,0,255] points=np.unravel_index(dst.argmax(),dst.shape)

h,w,l=img.shape

print list(points) cv2.imwrite('dst.jpg',res)

res=cv2.resize(img,(w/4,h/4),interpolation=cv2.INTER_LINEAR)

cv2.waitKey(0)

gray = cv2.cvtColor(res,cv2.COLOR_BGR2GRAY)

gray = np.float32(gray)

dst = cv2.cornerHarris(gray,2,3,0.04)

cv2.imwrite('dsttest.jpg',dst)

dst = cv2.dilate(dst,None)

res[dst>0.01*dst.max()]=[0,0,255]

points=np.unravel_index(dst.argmax(),dst.shape)

print list(points)

cv2.imwrite('dst.jpg',res)

cv2.waitKey(0)

cv2.destroyAllWindows()

cv2.destroyAllWindows()