step -03, def the function def findcoord(event, x, y, flags, params) : if event==…
- User
step -03, def the function def find_coord(event, x, y, flags, params) : if event== cv.EVENT_FLAG_LBUTTON: # Left mouse click print(x,',',y) #how to define or print on the same image or windows font=cv.FONT_HERSHEY_PLAIN cv.putText(img, str(x) +','+ str(y), (x,y), font, 1, (255,0,0)) #show the text on the image itself cv.imshow("image", img) # final if name==" main": # read and display the image img=cv.imread ("/Users/abhi/2 Areas/JOB/Teisnach Thesis/Important images/New Images/Medium_Grinded_KT copy.jpg.jpeg") # display the image cv. imshow("image", img) # setting call back function cv.setMouseCallback("image", find_coord) cv.waitKey(0) cv.destroyAllWindows (): there is no output for this even though I am showing the output using cv.imshow()?
- Assistant
The code you've provided looks mostly correct, but there are a few potential issues and corrections that you should consider: