Aruco markers - how to keep a constant object size

asked 2020-08-04 10:20:46 -0600

jaubi gravatar image

updated 2020-08-05 02:35:42 -0600

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, another version is already completed. The goal is to recognise the LED position and flashing frequencies on an LED 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!

EDIT As asked, a simple scheme of the system

Quick scheme of the system

edit retag flag offensive close merge delete

Comments

can you somehow highlight the connection between led's and aruco markers in your setup ?

and example image would be most helpful !

berak gravatar imageberak ( 2020-08-04 11:19:54 -0600 )edit
1

Yes. The object studied is basically a panel with LEDs on it (it is part of avionics equipment), the Aruco marker is stuck somewhere on the panel. The Aruco marker is used because it is robust and simple to detect and give position of the camera compared to the panel. I want to be able to identify the position of the LED on the panel no matter where the camera is placed, I already achieved to put the image on a plane "bird eye view", but I want also to get the panel image with a constant size no matter where the camera is placed in order that the coordinates of the LED stay the same (with a very small tolerance) if the camera moves. Thank you!

jaubi gravatar imagejaubi ( 2020-08-04 16:33:03 -0600 )edit

nice update, thanks ! ;)

berak gravatar imageberak ( 2020-08-05 01:34:10 -0600 )edit