Answer the question
In order to leave comments, you need to log in
How to calculate the angles of rotation of the servos in my case?
Hello. There is a program that takes an image from a camera (resolution 640 * 480) and gives two coordinates X is equal to, for example, 500 and Y =, for example, 250. That is, we count from the upper left pixel 250 pixels down and 500 to the right and these will be the coordinates of the pixel that is the center of the circle I hold in my hand. Next... There is a certain center of this image with coordinates X,Y = 320, 240 respectively.
I have an arduino with servos. Servo drives, webcam and other connect like this www.parkflyer.ru/static/user_files/2013/9/1/IMG_06...
Question. Give me an idea what kind of math you need to do to calculate the rotation angles of the servos so that they turn the camera to such a position that the center of the image is aligned with the center of the circle. Throw in the idea itself (and even better, a ready-made library for c ++).
P.S Servos can rotate from 0 to 180 degrees
Answer the question
In order to leave comments, you need to log in
You need to know the value of one pixel in degrees, and it depends on the optics of the camera.
An example is a wall 10 meters from the camera. We set the zoom so that 640x480 cm fit into 640x480 pixels, we get the price of one pixel in the center of the frame at 0.057°, and the entire frame at 35.49°x26.49°. We increase the zoom, now 64x48 cm is placed in the same pixels, respectively, the central pixel already corresponds to 0.0057°, and the frame is 3.67°x2.75°.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question