object position tracking, openCV-Python
I have some sheet on a conveyor belt, with a camera positioned above a corner of the sheet,I have to detect the position ,recognizing the corner compared to the cartesian axes (x, y),and i have to measure the distance between the origin of cartesian axes and my corner. Do you have any advice on the method to use or on which technique i have to rely? I thought to recognize the angle, through the 90 ° angle that is formed between one side of the sheet and the other, but I do not know how to do it.
are you halfway able to detect the corner of your object already ?
show us, what you've tried so far !
i am trying with this code,but i am unable to recognizie the only corner,instead the whole edge, can you help me? I am not yet a expert.
import numpy as np import cv2 img=cv2.imread('rett.jpg') edges=cv2.Canny(img,100,100) img2,contours,hierarchy=cv2.findContours(edges,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) cv2.drawContours(img,contours,-8,(242,72,0),3) cv2.imshow('img',img) cv2.imshow('img2',img2)
121/5000 thanks for your help, do you have any advice to give me, because I can not detect the only corner but the whole edge?
again, the boundingrect should give you the corner.
maybe you also need to filter the contours, and take only the largest, RETR_EXTERNAL might also be better than RETR_TREE, there is some experimenting involved here !
OK,THANKS!