Hello all,
I have a problem which I have been struggling on since last week and I would need some idea to solve it. I am currently programming a failure pattern recognition tool for an aerospace company, another version is already completed. The goal is to recognise the LED position and flashing frequencies on an avionics panel.
I now try to detect the LED position on the panel no matter of the position of the camera. For this, I put an Aruco marker on the panel to detect the camera position.
This is basically done with:
# detect markers
corners, ids, rejectedImgPoints = aruco.detectMarkers(frame, d)
aruco.drawDetectedMarkers(frame, corners, ids)
# use camera matrix to find markers locations
rvecs, tvecs, _objPoints = aruco.estimatePoseSingleMarkers(corners, markers_size, mtx, dist)
My camera has been calibrated with the chessboard method, giving mtx and dist.
I also succeeded to compute a bird-eye view of the global image with
pts = np.float32(rect.tolist())
dst_pts = np.float32(dst_pts.tolist())
M = cv2.getPerspectiveTransform(rect, dst_pts)
warped = cv2.warpPerspective(frame, M, (3000, 3000))
I also tried point to point transform and it seems to work. Now, I would like to have a constant object size, in such a way that the panel and the Aruco marker stay with a constant size on the image, no matter of the displacement on the camera on the 3 axis (x,y,z).
For the moment, as I know the exact size of my Aruco marker, I define an arbitrary number of pixel for the marker in this image and I resize the image on x and y with a different ratio at each frame to keep the Aruco marker with the same size. But, this method is not good as in the neighborhood of the image this rule is not true due to perspective.
Do you have an idea of how it is possible to solve the problem? I think there is something to do with tvecs but I don't find how I can perform a resizement with a displacement on 3 dimensions.
If you need further information, do not hesitate to ask me. I would be very happy if someone can help me a little bit.
Thank you all!