Newest questions tagged opencv - Robotics Stack Exchange most recent 30 from robotics.stackexchange.com 2020-01-23T11:35:19Z https://robotics.stackexchange.com/feeds/tag?tagnames=opencv&sort=newest https://creativecommons.org/licenses/by-sa/4.0/rdf https://robotics.stackexchange.com/q/19996 1 Interpreting results from Camera Calibration? PyWalker2797 https://robotics.stackexchange.com/users/24163 2020-01-12T16:22:28Z 2020-01-12T16:22:28Z <p>I used OpenCV's findChessboardCorners on a few checkerboard images (40~) and about 27 seemed to find the corners accurately. How does one proceed from here? Do I calculate the reprojection error over just the correctly identified images? Is this normal to expect? </p> <p><strong>Some of the correctly identified images -</strong> </p> <p><a href="https://i.stack.imgur.com/hKmXb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hKmXb.png" alt="enter image description here"></a></p> <p><strong>Some of the incorrectly identified images -</strong> <a href="https://i.stack.imgur.com/OCcM7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OCcM7.png" alt="enter image description here"></a></p> <p>How I'm calibrating my images -</p> <pre class="lang-py prettyprint-override"><code>def calibrate(): criteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001) objp = np.zeros((6*9,3),np.float32) objp[:,:2] = np.mgrid[0:9, 0:6].T.reshape(-1,2) objpoints = [] imgpoints = [] images = glob.glob('*.png') for fname in images: img = cv.imread(fname) gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) ret, corners = cv.findChessboardCorners(gray, (9,6), None) if ret == True: print('Hello') objpoints.append(objp) corners2 = cv.cornerSubPix(gray, corners, (11,11), (-1,-1), criteria) cv.drawChessboardCorners(img, (9,6), corners, ret) imgpoints.append(corners2) cv.imshow('img',img) cv.waitKey(500) cv.destroyAllWindows() ret, mtx, dist, rvecs, tvecs = cv.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None) return objpoints, imgpoints, ret, mtx, dist, rvecs, tvecs </code></pre> https://robotics.stackexchange.com/q/19879 0 Visual-Positioning Method Albert H M https://robotics.stackexchange.com/users/22800 2019-12-14T05:16:22Z 2019-12-16T20:37:15Z <p>I'm working on mobile manipulator and trying to do visual-positioning of the end-effector.</p> <p><a href="https://i.stack.imgur.com/hRbAt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hRbAt.jpg" alt="enter image description here"></a></p> <p>My camera will located around 1-2 meters from the robot. I'm sure i cant use color tracking method because the color of end-effector not unique to the environment and i can't get the orientation of end-effector. If I'm using neural network, the computation cost will high (not reliable for high-speed control). What method of visual-positioning can i use for this case?</p> https://robotics.stackexchange.com/q/19814 2 Make robot drive as far from obstacles as possible Name https://robotics.stackexchange.com/users/24267 2019-11-27T19:57:08Z 2019-12-29T09:01:40Z <p>I am trying to make robot drive around the room, avoiding obstacles with pathfinding. The problem is I get few waypoints from pathfinding algorithm for robot to drive to (green dots), but it drive a bit too close to corners. I try avoiding that by using blur and threshold, to make walls thicker for the algorithm, but it causes problems with different size walls(as in example picture, blur is these black dots). How do I make my robot drive in the middle as possible of room, to avoid walls and be as far as poosible (the orange line) from the obstacles? <a href="https://i.stack.imgur.com/brHGE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/brHGE.png" alt="example"></a></p> https://robotics.stackexchange.com/q/19737 1 How do I use the live video stream from my arduino camera (connected by serial), to run with my OpenCV python ball tracking code? Abhinav Sundar https://robotics.stackexchange.com/users/24176 2019-11-15T20:49:23Z 2019-11-15T20:49:23Z <p>My objective is to have the arduino camera, just to act like a webcam, and have my laptop run a ball tracking script on it. The ball tracking script already works with my laptops camera, and it can also do the ball tracking overlay on a video file (.mp4). </p> <p>I am using an Arduino Uno with an Arducam Mini 2MP plus. Using the Arduino IDE and ArduCAM's host software, I am getting about 4-6 fps (which I am fine with). Frame rate isn't too important to me, I just want the arduino camera to act in the place of my laptop's webcam.</p> <p>Your help would be greatly appreciated.</p> https://robotics.stackexchange.com/q/19613 0 how to integrate apm 2.8 and raspberry pi 3 for object tracking Ocheike https://robotics.stackexchange.com/users/23175 2019-10-16T06:35:37Z 2019-10-21T09:38:27Z <p>Please I want to carry out a project on object tracking, I have an APM 2.8 and a raspberry pi 3 how do I command the flight controller to takeoff directly from my pi interface?, any advice on how I can make this happen?, your advice is appreciated. Thanks</p> https://robotics.stackexchange.com/q/19287 0 Path planning or 2D Mapping M6Gpower https://robotics.stackexchange.com/users/23528 2019-08-14T21:45:30Z 2019-08-15T02:55:56Z <p>i want to collect some ideas about this video. <a href="https://www.youtube.com/watch?v=q-ZDB8xqI7M" rel="nofollow noreferrer">https://www.youtube.com/watch?v=q-ZDB8xqI7M</a> Is the Left Vacuum cleaner using some 2D Mapping or OpenCV to navigate through the room ? Or is it just a Hard coded Algorithm to do the path planning? </p> https://robotics.stackexchange.com/q/19007 0 Remove jittering from head pose estimated via dlib face detector Zain https://robotics.stackexchange.com/users/16715 2019-07-02T04:26:20Z 2019-07-02T04:26:20Z <p>I am using dlib’s face detector with openCV to measure head pose and then use these values to render a Vr scene in unity 3D. The only problem is the jittering in the values estimated via computer vision. The values are quite jittery and that makes it impossible to create any sense of VR in unity. I am looking for ways that might help in filtering out these values and render them stable. I used averaging but that slows down the process alot. Any help would be really appreciated. </p> <p>PS I havng tried Kalman filter yet. Not sure if it will work or not.</p> https://robotics.stackexchange.com/q/18340 1 Algorithm for centering an object that is changing speed mcshaf01 https://robotics.stackexchange.com/users/21132 2019-03-05T20:22:20Z 2019-03-18T18:57:40Z <p>I'm trying to use a pan / tilt alt-azimuth telescope mount to track an object that is moving in the sky. The problem is that the object is changing speed constantly. I can easily track objects that are moving at a steady speed. </p> <p>I'm using the OpenCV library to compute the object's distance from the center of the image. I should be able to tell the telescope mount to speed up or slow down to follow the object. The actual algorithm though seems surprisingly hard to write. </p> <p>For instance if I tell the mount to speed up to follow the object, then the apparent speed between the two is much less, but still not zero. So the object is slowly drifting out of the view. So I have to recenter it which is totally different than adjusting the speed. It's like I need a re-centering algorithm and a speed adjusting algorithm running at the same time. </p> <p>Does anyone have any ideas how to do this or where to ask? Neither the OpenCV or telescope forums seems the right place to ask this question.</p> <p>Thanks</p> https://robotics.stackexchange.com/q/18301 0 Ready to use camera calibration in linux C.O Park https://robotics.stackexchange.com/users/19219 2019-02-26T23:41:53Z 2019-02-26T23:41:53Z <p>I am looking for a ready-to-use implementation of "opencv" camera calibration in Ubuntu. I have mine but the code was implemented for the windows. I would like to convert it but simply the deadline is too short. </p> <p>Does anyone know a good one in github? </p> <p>Input: images Output: calibration parameters</p> https://robotics.stackexchange.com/q/17966 1 Image data fusion Rajat Girhotra https://robotics.stackexchange.com/users/22039 2019-01-10T00:05:12Z 2019-06-11T02:01:25Z <p>I have three cameras separated by some distance, looking at a scene. I have calibrated them using checkerboard and I have their respective intrinsic parameters and their pose and rotation matrix, I am stuck as to how to do data/image fusion.</p> <p>I think I have to do feature detection and feature matching and then do data fusion but I am not sure if I am on the right path.</p> <p>Would be very helpful if anyone can point me to some answer or help me with it.</p> <p>Or if I am wrong then what is the right method or steps to follow?</p> <p>Would be really helpful even if someone can point to a resource or just guide. Thank you, good people</p> https://robotics.stackexchange.com/q/16454 2 Trigger two usb cameras at the same time Giuseppe Sensolini https://robotics.stackexchange.com/users/21262 2018-09-28T22:44:42Z 2018-11-04T05:00:26Z <p>I'm studyng stereo cameras, and I want to build one. I searched a lot in internet, and the opinions are quite different about this topic.</p> <p>Basically, my question is:</p> <blockquote> <p><strong>Can I synchronize two usb cameras triggering them together, shooting</strong> <strong>at the same instant?</strong></p> </blockquote> <p>My answer (99% wrong) is:</p> <blockquote> <p>Yes, with a multithread architecture and a parallel program, can I have two streams at the same instant.</p> </blockquote> <p>but it seems too easy, and will never work.</p> <ol> <li>Why?</li> <li>what difference should I expect between the two images? (in millisecond I mean)</li> <li>Is there a solution in order to have a real global shutter? (without buy another cameras)</li> <li>I also see some solution for triggering one camera using Arduino. Could be extended to 2 cameras systems?</li> </ol> <p>Hope these are not to many questions. Thanks PS: books suggestion or papers are appreciated </p> https://robotics.stackexchange.com/q/16123 0 Fixing robot orientation using AR Sadman Muhib Samyo https://robotics.stackexchange.com/users/20876 2018-07-28T16:12:24Z 2018-07-28T20:48:57Z <p>I am creating a project where a robot needs to face a control panel and do some specific tasks. Some reference tags will be placed on the panel. </p> <p>I want to use the tags as AR reference and fix my robot's orientation. But I am new in AR and I need to learn more, can you give me some hint on how to do this? I want to use OpenCV Python.</p> https://robotics.stackexchange.com/q/16053 1 How to tringulate many projections of a point to optimal postion? Yasin Yousif https://robotics.stackexchange.com/users/17186 2018-07-17T19:02:28Z 2018-07-20T10:17:03Z <p>Suppose we have many images for the same scene (with known poses already,using for ex: a GPS ), and the same feature appear in more than 2 images .</p> <p><strong>How to use all the available info to compute as precisely as possible the 3d-reconstruction of the scene?</strong> (actually ,I want a dense map but let's start with a point)</p> <p>For 2 images , it's a least square problem solved with OpenCV function: <code>cv2.tringulatePoints</code></p> <p><a href="https://i.stack.imgur.com/4ozEX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4ozEX.png" alt="enter image description here"></a></p> <p>but for many, how to find the best estimate?</p> <p>any ideas on the subject? [no problem with dense math]</p> https://robotics.stackexchange.com/q/15964 2 Robotic Hand Grasp Planning - How do I find the initial contact point for each finger when grasping an object? Stephane Hatgis-Kessell https://robotics.stackexchange.com/users/16481 2018-07-03T06:23:18Z 2018-07-05T19:21:05Z <p>I am trying to design a robotic hand that is able to adaptively grasp unfamiliar objects. I am initially thinking that using OpenCV for pose estimation might make doing so easier. </p> <p>Assuming that I am able to successfully estimate the pose of an object, how might I go about finding the initial contact points for each finger on the object? (or how does each finger know where to go in order to grasp the object?)</p> https://robotics.stackexchange.com/q/15773 1 Pictures coordinates to robot coordinates Dairon https://robotics.stackexchange.com/users/20485 2018-05-29T11:07:49Z 2019-12-20T18:02:30Z <p>I have a picture on my C# software and the corresponding object in real world on 2d plane of motorized XY axis table. What I want is when I select a pixel on my picture, the motorized table should be moving to the exact same point of the real world object. The real world object and its picture may have distortion and rotation differences and the picture on the software is not perfect too.</p> <p><strong>I use 4 points on each to map all the points in between, example:</strong></p> <p>Normal picture (x,y): [250, 25] , [250, 287] , [399, 287] , [400, 28] (in pixels)</p> <p>Table coordinates (x,y): [0, 0] , [2098, 29538] , [19127, 28164] , [17097, -1200] (in microsteps)</p> <p><strong>I tried using OpenCV's homography:</strong></p> <p>I used <em>FindHomography()</em> to get the H matrix and I transform the picture point choosed using <em>PerspectiveTransform()</em> which give me the corresponding point in microsteps on the real world to move the motorized XY axis table.</p> <pre><code>OpenCvSharp.Mat hCv = OpenCvSharp.Cv2.FindHomography(srcPoints, dstPoints); OpenCvSharp.Point2d[] resultCv = OpenCvSharp.Cv2.PerspectiveTransform(targetCv, hCv); </code></pre> <p>I also manualy calculated the homography matrix using this anwser : <a href="https://math.stackexchange.com/a/2619023">https://math.stackexchange.com/a/2619023</a> But I both cases I always get an error when transforming one of the four reference point like for [250, 25] the corresponding point should be [0, 0] but instead I get something like [-25, 245].</p> <p><strong>Question :</strong> I there a different way to link pictures coordinates to real world coordinates accuratly ?</p> <p><strong>Edit, more explanations:</strong></p> <p>To get my 8 points I select four points of the picture and then in real world I move my table to the four corresponding points manually. Let say I took a picture of my smartphone. I will get my points on the four edges of the phone. Then if I choose the X, Y pixel position corresponding to the front camera of my phone, my motorized table should move to get a landmark above the front camera of my real phone.</p> https://robotics.stackexchange.com/q/14463 1 How to make a line following algortihm for an A.R Drone 2.0? [closed] mike https://robotics.stackexchange.com/users/18398 2017-10-18T14:56:52Z 2017-10-18T15:37:28Z <p>I am trying to develop a line following algorithm where a drone will detect a bounding box and follow what is inside the bounding box.</p> <p>I am filtering all the colors to only see the color white. Once that color is detected, I want the drone to go in a straight line from one end of the box to the other. Maybe it is easier using the draw line function on openCV but I am not sure. Any way, my biggest problem is telling the drone to follow the color or in other words the detected object.</p> <p>I am using <a href="https://github.com/tekkies/cvdrone/blob/master/src/main.cpp" rel="nofollow noreferrer">this repository from GitHub</a>. Anyway this the code I have so far, and it only follows items that are moving. I need to follow an object that is stationary if that is possible.</p> <pre><code>#include "ardrone/ardrone.h" int main(int argc, char *argv[]) { // AR.Drone class ARDrone ardrone; // Initialize if (!ardrone.open()) { std::cout &lt;&lt; "Failed to initialize." &lt;&lt; std::endl; return -1; } // Thresholds int minH = 0, maxH = 255; int minS = 0, maxS = 255; int minV = 0, maxV = 255; // XML save data std::string filename("thresholds.xml"); cv::FileStorage fs(filename, cv::FileStorage::READ); // If there is a save file then read it if (fs.isOpened()) { maxH = fs["H_MAX"]; minH = fs["H_MIN"]; maxS = fs["S_MAX"]; minS = fs["S_MIN"]; maxV = fs["V_MAX"]; minV = fs["V_MIN"]; fs.release(); } // Create a window cv::namedWindow("binalized"); cv::createTrackbar("H max", "binalized", &amp;maxH, 255); cv::createTrackbar("H min", "binalized", &amp;minH, 255); cv::createTrackbar("S max", "binalized", &amp;maxS, 255); cv::createTrackbar("S min", "binalized", &amp;minS, 255); cv::createTrackbar("V max", "binalized", &amp;maxV, 255); cv::createTrackbar("V min", "binalized", &amp;minV, 255); cv::resizeWindow("binalized", 0, 0); // Kalman filter cv::KalmanFilter kalman(4, 2, 0); // Sampling time [s] const double dt = 1.0; // Transition matrix (x, y, vx, vy) cv::Mat1f A(4, 4); A &lt;&lt; 1.0, 0.0, dt, 0.0, 0.0, 1.0, 0.0, dt, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0; kalman.transitionMatrix = A; // Measurement matrix (x, y) cv::Mat1f H(2, 4); H &lt;&lt; 1, 0, 0, 0, 0, 1, 0, 0; kalman.measurementMatrix = H; // Process noise covairance (x, y, vx, vy) cv::Mat1f Q(4, 4); Q &lt;&lt; 1e-5, 0.0, 0.0, 0.0, 0.0, 1e-5, 0.0, 0.0, 0.0, 0.0, 1e-5, 0.0, 0.0, 0.0, 0.0, 1e-5; kalman.processNoiseCov = Q; // Measurement noise covariance (x, y) cv::Mat1f R(2, 2); R &lt;&lt; 1e-1, 0.0, 0.0, 1e-1; kalman.measurementNoiseCov = R; char textBuffer; cv::Scalar green = CV_RGB(0,255,0); float speed = 0.0; bool learnMode = false; // Main loop while (1) { // Key input int key = cv::waitKey(33); if (key == 0x1b) break; // Get an image cv::Mat image = ardrone.getImage(); // HSV image cv::Mat hsv; cv::cvtColor(image, hsv, cv::COLOR_BGR2HSV_FULL); // Binalize cv::Mat binalized; cv::Scalar lower(minH, minS, minV); cv::Scalar upper(maxH, maxS, maxV); cv::inRange(hsv, lower, upper, binalized); // Show result cv::imshow("binalized", binalized); // De-noising cv::Mat kernel = getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3)); cv::morphologyEx(binalized, binalized, cv::MORPH_CLOSE, kernel); //cv::imshow("morphologyEx", binalized); // Detect contours std::vector&lt;std::vector&lt;cv::Point&gt;&gt; contours; cv::findContours(binalized.clone(), contours, cv::RETR_CCOMP, cv::CHAIN_APPROX_SIMPLE); // Find largest contour int contour_index = -1; double max_area = 0.0; for (size_t i = 0; i &lt; contours.size(); i++) { double area = fabs(cv::contourArea(contours[i])); if (area &gt; max_area) { contour_index = i; max_area = area; } } // Object detected if (contour_index &gt;= 0) { // Moments cv::Moments moments = cv::moments(contours[contour_index], true); double marker_y = (int)(moments.m01 / moments.m00); double marker_x = (int)(moments.m10 / moments.m00); // Measurements cv::Mat measurement = (cv::Mat1f(2, 1) &lt;&lt; marker_x, marker_y); // Correction cv::Mat estimated = kalman.correct(measurement); // Show result cv::Rect rect = cv::boundingRect(contours[contour_index]); cv::rectangle(image, rect, cv::Scalar(0, 255, 0)); } // Prediction cv::Mat1f prediction = kalman.predict(); int radius = 1e+3 * kalman.errorCovPre.at&lt;float&gt;(0, 0); // Calculate object heading fraction float heading = -((image.cols/2)-prediction(0, 0))/(image.cols/2); sprintf(textBuffer, "heading = %+3.2f", heading); putText(image, textBuffer, cvPoint(30,30), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, green, 1, CV_AA); // Show predicted position cv::circle(image, cv::Point(prediction(0, 0), prediction(0, 1)), radius, green, 2); //Speed if ((key &gt;= '0') &amp;&amp; (key &lt;= '9')) { speed = (key-'0')*0.1; //printf("speed = %3.2f\n", speed); } sprintf(textBuffer, "speed = %3.2f", speed); putText(image, textBuffer, cvPoint(30,60), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, green, 1, CV_AA); // Drone control double vx = 0.0, vy = 0.0, vz = 0.0, vr = 0.0; // Auto-follow vx = speed; vr = -heading; if (key == 0x260000) vx = 1.0; if (key == 0x280000) vx = -1.0; if (key == 0x250000) vr = 1.0; if (key == 0x270000) vr = -1.0; if (key == 'q') vz = 1.0; if (key == 'a') vz = -1.0; ardrone.move3D(vx, vy, vz, vr); // See you ardrone.close(); return 0; } </code></pre> <p>I also tried using PID's like so.</p> <pre><code> // Find largest contour int contour_index = -1; double max_area = 0.0; for (int i = 0; i &lt; (int)contours.size(); i++) { double area = fabs(cv::contourArea(contours[i])); if (area &gt; max_area) { contour_index = i; max_area = area; } } // A marker detected if (contour_index &gt;= 0) { // Moments cv::Moments moments = cv::moments(contours[contour_index], true); marker.y = (int)(moments.m01 / moments.m00); marker.x = (int)(moments.m10 / moments.m00); // Show result cv::Rect rect = cv::boundingRect(contours[contour_index]); cv::rectangle(image, rect, cv::Scalar(0, 255, 0)); //cv::drawContours(image, contours, contour_index, cv::Scalar(0,255,0)); } // Take off / Landing if (key == ' ') { if (ardrone.onGround()) ardrone.takeoff(); else ardrone.landing(); } // Move using keyboard double vx = 0.0, vy = 0.0, vz = 0.0, vr = 0.0; if (key == 0x260000) vx = 1.0; if (key == 0x280000) vx = -1.0; if (key == 0x250000) vr = 1.0; if (key == 0x270000) vr = -1.0; if (key == 'q') vz = 1.0; if (key == 'a') vz = -1.0; // Switch tracking ON/OFF static int track = 0; if (key == 't') track = !track; cv::putText(image, (track) ? "track on" : "track off", cv::Point(10, 20), cv::FONT_HERSHEY_SIMPLEX, 0.5, (track) ? cv::Scalar(0, 0, 255) : cv::Scalar(0, 255, 0), 1, CV_AA); // Marker tracking if (track) { // PID gains const double kp = 0.001; const double ki = 0.000; const double kd = 0.000; // Errors double error_x = (binalized.rows / 2 - marker.y); // Error front/back double error_y = (binalized.cols / 2 - marker.x); // Error left/right // Time [s] static int64 last_t = 0.0; double dt = (cv::getTickCount() - last_t) / cv::getTickFrequency(); last_t = cv::getTickCount(); // Integral terms static double integral_x = 0.0, integral_y = 0.0; if (dt &gt; 0.1) { // Reset integral_x = 0.0; integral_y = 0.0; } integral_x += error_x * dt; integral_y += error_y * dt; // Derivative terms static double previous_error_x = 0.0, previous_error_y = 0.0; if (dt &gt; 0.1) { // Reset previous_error_x = 0.0; previous_error_y = 0.0; } double derivative_x = (error_x - previous_error_x) / dt; double derivative_y = (error_y - previous_error_y) / dt; previous_error_x = error_x; previous_error_y = error_y; // Command velocities vx = kp * error_x + ki * integral_x + kd * derivative_x; vy = kp * error_y + ki * integral_y + kd * derivative_y; vz = 0.0; vr = 0.0; std::cout &lt;&lt; "(vx, vy)" &lt;&lt; "(" &lt;&lt; vx &lt;&lt; "," &lt;&lt; vy &lt;&lt; ")" &lt;&lt; std::endl; } // Move ardrone.move3D(vx, vy, vz, vr); </code></pre> https://robotics.stackexchange.com/q/14456 3 Determine the relative camera pose given two RGB camera frames in openCV-python chibro2 https://robotics.stackexchange.com/users/4024 2017-10-18T02:06:48Z 2017-10-18T04:23:48Z <p>I would like to determine the relative camera pose given two RGB camera frames. I assume there's overlap in field of view between the two cameras, what I am looking for ultimately is the rotation and translation between two cameras. I understand how to do this in theory, and am looking for existing openCV implementations in python. An existing one for matlab can be found here: <a href="https://www.mathworks.com/help/vision/ref/relativecamerapose.html#inputarg_inlierPoints1" rel="nofollow noreferrer">https://www.mathworks.com/help/vision/ref/relativecamerapose.html#inputarg_inlierPoints1</a>. But so far as I can tell I see no openCV API in python.</p> https://robotics.stackexchange.com/q/14417 3 OpenCV get topdown view of planar pattern by using intrinsic and extrinsic from cameraCalibrate ricecakebear https://robotics.stackexchange.com/users/18353 2017-10-11T07:06:13Z 2017-10-19T07:16:43Z <p>Originally I have a image with a perfect circle grid, denoted as <strong><em>A</em></strong> <a href="https://i.stack.imgur.com/VOXcd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VOXcd.jpg" alt="enter image description here"></a> I add some lens distortion and perspective transformation to it, and it becomes <strong><em>B</em></strong> <a href="https://i.stack.imgur.com/FPEYg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FPEYg.jpg" alt="enter image description here"></a> In camera calibration, <strong><em>A</em></strong> would be my destination image, and <strong><em>B</em></strong> would be my source image. Let's say I have all the circle center coordinates in both images, stored in <em>stdPts</em> and <em>disPts</em>.</p> <pre><code>//25 center pts in A vector&lt;Point2f&gt; stdPts; for (int i = 0; i &lt;= 4; ++i) { for (int j = 0; j &lt;= 4; ++j) { stdPts[i * 5 + j].x = 250 + i * 500; stdPts[i * 5 + j].y = 200 + j * 400; } } //25 center pts in B vector&lt;Point2f&gt; disPts = FindCircleCenter(); </code></pre> <p>I want to generate an image <strong><em>C</em></strong> that is as close as <strong><em>A</em></strong>, from input: <strong><em>B</em></strong>, <em>stdPts</em> and <em>disPts</em>. I tried to use the intrinsic and extrinsic generated by cv::calibrateCamera. Here is my code:</p> <pre><code>//prepare object_points and image_points vector&lt;vector&lt;Point3f&gt;&gt; object_points; vector&lt;vector&lt;Point2f&gt;&gt; image_points; object_points.push_back(stdPts); image_points.push_back(disPts); //prepare distCoeffs rvecs tvecs Mat distCoeffs = Mat::zeros(5, 1, CV_64F); vector&lt;Mat&gt; rvecs; vector&lt;Mat&gt; tvecs; //prepare camera matrix Mat intrinsic = Mat::eye(3, 3, CV_64F); //solve calibration calibrateCamera(object_points, image_points, Size(2500,2000), intrinsic, distCoeffs, rvecs, tvecs); //apply undistortion string inputName = "../B.jpg"; Mat imgB = imread(imgName); cvtColor(imgB, imgB, CV_BGR2GRAY) Mat tempImgC; undistort(imgB, tempImgC, intrinsic, distCoeffs); //apply perspective transform double transData[] = { 0, 0, tvecs.at&lt;double&gt;(0), 0, 0,,tvecs.at&lt;double&gt;(1), 0, 0, tvecs.at&lt;double&gt;(2) }; Mat translate3x3(3, 3, CV_64F, transData); Mat rotation3x3; Rodrigues(rvecs, rotation3x3); Mat transRot3x3(3, 3, CV_64F); rotation3x3.col(0).copyTo(transRot3x3.col(0)); rotation3x3.col(1).copyTo(transRot3x3.col(1)); translate3x3.col(2).copyTo(transRot3x3.col(2)); Mat imgC; Mat matPerspective = intrinsic*transRot3x3; warpPerspective(tempImgC, imgC, matPerspective, Size(2500, 2000)); //write string outputName = "../C.jpg"; imwrite(outputName, imgC); // A JPG FILE IS BEING SAVED </code></pre> <p>And here is the result image <strong><em>C</em></strong>, which doesn't deal with the perspective transformation at all. <a href="https://i.stack.imgur.com/1cjSN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1cjSN.jpg" alt="enter image description here"></a></p> <p>So could someone teach me how to recover <strong><em>A</em></strong>? Thanks.</p> https://robotics.stackexchange.com/q/14376 1 Drone Feedback: Object Detection / Color Detection [closed] Rob https://robotics.stackexchange.com/users/18287 2017-10-04T20:26:18Z 2017-10-04T20:26:18Z <p>I have been working on a code where an A.R Drone 2.0 will detect color and put a red dot in the middle of the image. I am using streaming for the drone. The goal is for the drone to detect a white gutter and fly straight over it from one point to the other. Essentially following a line. I noticed when I changed the BGR to 0, 0, 255, I get the entire gutter to be distinguished but it detects white spots as well. Is there to isolate my detection just to see the gutter. Maybe using shapes, once the gutter is detected, put a bounding box. And my finally question is how do I tell my drone to follow the red dot or maybe drawing a line. I looked at <a href="https://github.com/venthur/python-ardrone" rel="nofollow noreferrer"><code>python-AR</code></a> drone libraries but don't know how to apply it.This is my code.</p> <pre><code>import numpy as np import cv2 # open the camera cap = cv2.VideoCapture('tcp://192.168.1.1:5555') def nothing(x): pass cv2.namedWindow('result') # Starting with 100's to prevent error while masking h,s,v = 100,100,100 # Creating track bar cv2.createTrackbar('h', 'result',0,179,nothing) cv2.createTrackbar('s', 'result',0,255,nothing) cv2.createTrackbar('v', 'result',0,255,nothing) while True: #read the image from the camera ret, frame = cap.read() #You will need this later frame = cv2.cvtColor(frame, 35) #converting to HSV hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV) # get info from track bar and appy to result h = cv2.getTrackbarPos('h','result') s = cv2.getTrackbarPos('s','result') v = cv2.getTrackbarPos('v','result') # Normal masking algorithm lower_blue = np.array([h,s,v]) upper_blue = np.array([180,255,255]) mask = cv2.inRange(hsv,lower_blue, upper_blue) result = cv2.bitwise_and(frame,frame,mask = mask) cv2.imshow('result',result) #find center cnts=cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)[-2] center=None if len(cnts)&gt;0: c=max(cnts, key=cv2.contourArea) ((x,y),radius)=cv2.minEnclosingCircle(c) M=cv2.moments(c) center=(int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"])) if radius&gt;10: #cv2.circle(frame, (int(x),int(y)), int(radius), 2) cv2.circle(frame, center,5,(0,0,255),-1) # color detection limits lB = 5 lG = 50 lR = 50 hB = 15 hG = 255 hR = 255 lowerLimits = np.array([lB, lG, lR]) upperLimits = np.array([hB, hG, hR]) # Our operations on the frame come here thresholded = cv2.inRange(frame, lowerLimits, upperLimits) outimage = cv2.bitwise_and(frame, frame, mask = thresholded) cv2.imshow('original', frame) # Display the resulting frame cv2.imshow('processed',outimage) # Quit the program when Q is pressed if cv2.waitKey(1) &amp; 0xFF == ord('q'): break # When everything done, release the capture print 'closing program' cap.release() cv2.destroyAllWindows() </code></pre> https://robotics.stackexchange.com/q/14226 1 Scan an Auditorium, Count People, and Display Open Seats [closed] aero https://robotics.stackexchange.com/users/18140 2017-09-15T22:17:10Z 2018-04-11T11:04:27Z <p>I'm looking for any recommended approaches to be able to digitally process a room full people, like an auditorium or a movie theater and output the following information:</p> <ul> <li>How many people are in the room</li> <li>Locate unoccupied and available seating</li> <li>Display the available seating to ushers, or people attending late, on an iPad or TV outside the auditorium. Similar to viewing airplane seat occupancy online.</li> </ul> <p>Some sensors I'm considering</p> <ul> <li>LiDar Scanning</li> <li>Many ceiling (IR) cameras looking straight down (or perpendicular to the seating if the seating is inclined)</li> </ul> <p>Some Challenges: Be able to take accurate enough measurements when:</p> <ul> <li>The lights are on</li> <li>The lights are off or in low light</li> <li>People are standing</li> <li>People are sitting</li> <li>Seating is a long bench, not a chair</li> </ul> <p>Constraints:</p> <ul> <li>Individual sensors for each seat isn't ideal, as we need to count people when they are standing as well. </li> </ul> <hr> <p><strong>Thoughts on LiDar:</strong></p> <p>I like the thought of scanning the room with LiDar to develop a 3D Map from which I can determine the number of prominent heads to count, and distance/location of each head to identify a seat that is taken or open.</p> <p>Are there any affordable (under $10,000) LiDar scanners that make this easy?</p> <p><strong>Thoughts on Top Down Infrared (IR) Cameras :</strong></p> <p>The auditorium seats 700 people and has a balcony. If the cameras are positioned in a top-down perspective, we would need to install about 22 cameras. It would be nice to have less of an installation overhead. Also, we'd like to respect the audience and not look down shirts.</p> <p><strong>Thoughts on 1 or 2 Infrared (IR) Cameras Viewing the Crowd from the stage:</strong></p> <p>This could work for counting faces (using OpenCV or other Computer Vision library) but would make it difficult to tell what seats are open and available, especially when people are standing. </p> <hr> <p>Images of the Auditorium:</p> <p><a href="https://i.stack.imgur.com/4aWY4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4aWY4s.jpg" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/QeWed.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QeWeds.jpg" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/koXRv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/koXRvs.jpg" alt="enter image description here"></a></p> https://robotics.stackexchange.com/q/13887 0 Tracking a ball returning its x,y,z coordinates [closed] Zain Khaled https://robotics.stackexchange.com/users/17641 2017-07-23T19:54:04Z 2017-07-25T19:06:19Z <p>I'm a Mechatronics Student Engineer, and still new with the computer vision field and am now working on a project that needs to Tracks a small ball and need to determine it's (x,y,z). 1st) Kinect was bad for detecting small objects. 2nd) Stereo with 2 cameras not hardware synchronized isn't accurate. 3rd) Single Stereo Camera is very expensive and I don't have any information of how dealing with it.</p> <p>So how Can I track a ball to return its coordinates(x,y,z) ?</p> https://robotics.stackexchange.com/q/12795 2 Mobile robot pose estimation Daphnee https://robotics.stackexchange.com/users/17442 2017-07-09T17:11:54Z 2017-07-12T13:36:30Z <p>I want to plot the path of a vehicle via the estimation of egomotion based on essential matrix.</p> <p>Everything was fine with openCV and the following function.</p> <pre><code>function [ xnow] = estimate_pose_test( points1, points2, K,xLast ) %%%%OpenCV%%%%% E = cv.findEssentialMat(points1, points2, 'CameraMatrix',K, 'Method','Ransac'); [R, t] = cv.recoverPose(E, points1, points2,'CameraMatrix',K); ry= asin(R(1,3)); u=[t(1,1);t(3,1);ry]; %%%%%%%%%Opengv%%%%%% % for i=1:size(points1,2) % I1(:,i)=points1{i}'; % I2(:,i)=points2{i}'; % end % temp = K \ [I1; ones(1,size(I1,2))]; % I1_norms = sqrt(sum(temp.*temp)); % I1n = temp ./ repmat(I1_norms,3,1); % % temp = K \ [I2; ones(1,size(I2,2))]; % I2_norms = sqrt(sum(temp.*temp)); % I2n = temp ./ repmat(I2_norms,3,1); % % X = opengv('fivept_nister_ransac',I1n,I2n); % R = X(:,1:3); % t = X(:,4); % ry= asin(R(1,3)); % u=[t(1,1);t(3,1);ry]; % theta=xLast(3)+u(3); if(theta&gt;pi) theta=theta-2*pi; elseif(theta&lt;-pi) theta = theta+2*pi; end s = sin(xLast(3)); c = cos(xLast(3)); % actual value added with the new control vector xnow=[xLast(1:2)+[c s; -s c]*u(1:2);theta]; end </code></pre> <p>points1 and points2 are corresponding SURF features. K is internal calibration matrix.</p> <p>However, I want to use <a href="https://i.stack.imgur.com/jgXz9.png" rel="nofollow noreferrer">OpenGV</a> librairy. OpenGV expects normalized coordinates on the unit sphere, so I started by transforming the measurements as recommended in the previous link and shown in the commented part in the above function.</p> <p>The plotted path was totally wrong and the results between Opencv and Opengv are different.</p> <p>For example for the same two consecutive frames, from opencv, I obtained the following rotation and translation:</p> <pre><code>R1 = 0.9999 0.0016 -0.0153 -0.0017 1.0000 -0.0054 0.0153 0.0055 0.9999 t1 = 0.1159 0.1042 -0.9878 </code></pre> <p>And with OpenGv,</p> <pre><code>R2 = 0.9998 -0.0059 -0.0167 0.0060 1.0000 0.0050 0.0166 -0.0051 0.9998 t2 = 0.2776 -0.0771 0.6458 </code></pre> <p>There is not even a constant scale factor between t2 and t1. Where is the problem? in plotting the resuts or in the estimation itself?</p> <p><strong>Edit</strong> I know that the function I wrote dosen't really make sense but it is just a test function to illustrate the problem I faced with OpenGV. First, what I want to do is to track the state of a vehicle defined by a reduced state vector$q_k=(x,z,\theta)$in order to estimate, afterwards, the uncertainty on the position, because I'm working with a probabilistic approach where:$q_{k|k-1}=f(q_{k|k-1},u_{k-1})$So, I need the values of control vector$u$that's why I'm deriving$dx$,$dz$and$d\theta$from the outputted$R$and$t$. Then, I'm plotting the path from the control vector values just to verify that i'm deriving them correctly by comparing the plotted path to the ground truth. Regarding the coordinate reference system, I'm using the following definition: <a href="https://i.stack.imgur.com/jgXz9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jgXz9.png" alt="Coordinate system"></a> so the vehicle is moving in the$XZ$plane and the rotation is around the$Y$axis that's why I'm using$t(1), t(3)$as position and$ry\$ as rotation in the the control vector.</p> https://robotics.stackexchange.com/q/12767 1 Maintaining scale factor for essential matrix Daphnee https://robotics.stackexchange.com/users/17442 2017-07-05T18:09:30Z 2017-07-07T11:38:01Z <p>I want to recover the trajectory of a vehicle using a monocular camera via the computation of the essential matrix between <code>t-1</code> and <code>t</code>. When I used OpenCV, I got correct trajectory wrt the ground truth. However, I want to code all the functions in Matlab but I got garbage when I plotted the trajectory and I think it is related to a scale factor problem.</p> <p>In fact, the outputted essential matrix from opencv function is the following (between two consecutive frames)</p> <p>$$E = \begin{bmatrix} 0.0052 &amp; -0.7068 &amp; 0.0104\\ 0.0052 &amp; -0.7068 &amp; 0.0104\\ 0.7063 &amp; 0.0050 &amp; -0.0305\\ -0.0113 &amp; 0.0168 &amp; 0.0002\\ \end{bmatrix}$$</p> <p>After decomposing it into Rotation and translation and triangulating for 5 2D points, I got the following 3D points:</p> <p>$$X1 =\begin{bmatrix} -0.0940&amp; 0.0478&amp; -0.4984\\ -0.0963&amp; 0.0497&amp; -0.4987\\ 0.3033&amp; 0.1009&amp; -0.5202\\ -0.0065&amp; 0.0636&amp; -0.5053\\ -0.0737&amp; 0.0653&amp; -0.5011\\ \end{bmatrix}$$</p> <p>Now, for the essential matrix outputted by Matlab functions, it is the following:</p> <p>$$E2=\begin{bmatrix} -0.2153 &amp; 0.9573 &amp; 0.1626\\ 0.8948 &amp; 0.2456 &amp;-0.3474\\ 0.1003 &amp; 0.1348 &amp;-0.0306\\ \end{bmatrix}$$</p> <p>When decomposing it into rotation and translation as well, and triangulating points, I got the following 3D points:</p> <p>$$X2 =\begin{bmatrix} 0.1087&amp; -0.0552&amp; 0.5762\\ 0.1129&amp; -0.0578&amp; 0.5836\\ 0.4782&amp; 0.1582&amp; -0.8198\\ 0.0028&amp; -0.0264&amp; 0.2099\\ 0.0716&amp; -0.0633&amp; 0.4862\\ \end{bmatrix}$$</p> <p>To verify the results, I did:</p> <p>$$X1./X2 =\begin{bmatrix} -0.8644 &amp; -0.8667 &amp; -0.8650\\ -0.8524 &amp; -0.8603 &amp; -0.8546\\ 0.6343 &amp; 0.6376 &amp; 0.6346\\ -2.3703 &amp; -2.4065 &amp; -2.4073\\ -1.0288 &amp; -1.0320 &amp; -1.0305\\ \end{bmatrix}$$</p> <p>And an almost constant scale factor seems to exist between the first and second estimations. I think that the scale factor have to be the same for all 3D points to get a correct trajectory when plotting it. How to maintain the scale factor?</p> https://robotics.stackexchange.com/q/12748 1 Are homogeneous coordinates represented by appending image coordinates with a 1 in camera imaging Jogging Song https://robotics.stackexchange.com/users/15460 2017-07-03T01:01:35Z 2017-07-03T01:01:35Z <p>In camera imaging, there are several terms for point coordinates.</p> <p>World coordinates: [X, Y, Z] in physical unit</p> <p>Image coordinates: [u, v] in pixel.</p> <p>Do these coordinates become homogeneous coordinates by appending with a 1? Sometimes in books and paper it is represented by [x, y w]. When is w is used? When is 1 used?</p> <p>In the function initUndistortRectifyMap, <a href="http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#void%20initUndistortRectifyMap(InputArray%20cameraMatrix,%20InputArray%20distCoeffs,%20InputArray%20R,%20InputArray%20newCameraMatrix,%20Size%20size,%20int%20m1type,%20OutputArray%20map1,%20OutputArray%20map2)" rel="nofollow noreferrer">http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#void%20initUndistortRectifyMap(InputArray%20cameraMatrix,%20InputArray%20distCoeffs,%20InputArray%20R,%20InputArray%20newCameraMatrix,%20Size%20size,%20int%20m1type,%20OutputArray%20map1,%20OutputArray%20map2)</a></p> <p>the following process is applied</p> <p><a href="https://i.stack.imgur.com/L0g2M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L0g2M.png" alt="enter image description here"></a></p> <p>Is there one term for the coordinates [x y 1]? I don't understand why R can be applied to [x y 1]? In my view, R is the transformation in 3D. Is [x y 1] is one 2d point or one 3d point?</p> <p>[u v]->[x y]->[x y 1]->[X Y W]->[x' y'] The coordinates are processed according to the above chain. What is the principle behind it?</p> https://robotics.stackexchange.com/q/12741 0 normalized point coordinates in undistortPoints function Jogging Song https://robotics.stackexchange.com/users/15460 2017-07-01T07:09:47Z 2017-08-19T04:03:02Z <p>In undistortPoints function from OpenCV, the documentations says that</p> <p><a href="http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#undistortpoints" rel="nofollow noreferrer">http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#undistortpoints</a></p> <p>where undistort() is an approximate iterative algorithm that estimates the normalized original point coordinates out of the normalized distorted point coordinates (“normalized” means that the coordinates do not depend on the camera matrix).</p> <p>It seems that the normalized point coordinates is obtained by adding 1 to the third coordinate. What does normalized point coordinates means? How can it be used for?</p> <p>In the above, there are two lines</p> <p>x" = (u - cx)/fx</p> <p>y" = (v - cy)/fy</p> <p>Is there one term for the coordinates(x'', y'')?</p> https://robotics.stackexchange.com/q/12671 5 Which is the best visual fiducial marker (2D barcode)? vacky https://robotics.stackexchange.com/users/11751 2017-06-21T19:05:15Z 2017-08-26T09:46:29Z <p>Which is the best visual fiducial marker (2D barcode) for detection and robust and accurate pose estimation? </p> <p>Im not looking for a fiducial marker which can store lot of information. The main goal is just to get the pose of the marker with respect to the camera as accurate as possible. </p> https://robotics.stackexchange.com/q/12616 4 Image registration with ground plane for surround view Nithin https://robotics.stackexchange.com/users/15089 2017-06-15T08:51:42Z 2018-03-06T18:14:12Z <p>I am currently working on a project which which involves surround view.</p> <p>I have 4 fish eye cameras and are fixed at 4 sides of a car.The fish eye cameras are corrected for radial distortion.</p> <p>After radial correction,Each camera sees a pattern in the Common FOV of adjacent camera to get the points on the ground plane.</p> <p><strong>Pattern in the common FOV of adjacent camera</strong></p> <p><a href="https://i.stack.imgur.com/z6CsL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z6CsL.jpg" alt="enter image description here"></a></p> <p>Now for each camera I need to warp those points to a plane which is the birds eye view. </p> <p><strong>Right now I choose those 8 red points, map first 4 points on a square and the other 4 points on another square on the same line,since I know that both squares lie parallel to each other at some distance,for front and back images and use the same points for left and right also appropriately so that left image comes left and right image comes right of the result.</strong></p> <p>Then I calculate Homography Matrix for each image(front,left,right and back) using the points in the Image and the birds eye plane.</p> <p>I map the points such that warped front image sits at the top, left sits at the left side and right at the right side and then back sits at bottom of image .</p> <p><strong>Example, Front sits at the top of result image</strong></p> <p><a href="https://i.stack.imgur.com/OcIHK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OcIHK.png" alt="enter image description here"></a></p> <p><strong>Left sits at the Left of result image</strong><a href="https://i.stack.imgur.com/6TxeV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6TxeV.png" alt="enter image description here"></a></p> <p>I do this so that I can stitch properly,forming a composite view.</p> <p><strong>My final stitched image looks like below.</strong></p> <p><a href="https://i.stack.imgur.com/pN7bN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pN7bN.png" alt="enter image description here"></a></p> <p>As you can see, the geometrical alignment is not proper.</p> <p><strong>QUESTIONS</strong></p> <ol> <li><p>What is the right way of registering each image with the ground plane.</p></li> <li><p>From the object points shown as red dots, <strong>what is the proper way to get the corresponding points in the bird's eye plane.</strong></p></li> </ol> https://robotics.stackexchange.com/q/12589 3 Obstacle avoiding by Pi camera [closed] Mahmoud https://robotics.stackexchange.com/users/17236 2017-06-10T10:00:22Z 2017-06-15T04:16:05Z <p>I designed a mobile robot with my colleagues for our graduation project, the purpose of it is to detect mines (metals) in a specific area</p> <p>We are programming the robot using Python on Raspberry Pi 3</p> <p>I want it to avoid obstacles using the Pi camera, is that possible through computer vision?</p> <p>I searched a lot but I can't find a full reference that guides me to do it. </p> <p>If it is too hard we'll use an ultrasonic sensor but can it, at least, make a graphical updated map, that marks the position of mines and obstacles on it?</p> https://robotics.stackexchange.com/q/12318 2 Converting Image Coordinates to (x, y) Position for Robotic Arm N.Zano https://robotics.stackexchange.com/users/16895 2017-05-08T01:13:23Z 2017-08-12T13:40:25Z <p>I have a Robotic Arm with a camera mounted above it looking down at a slight angle. </p> <p>Assuming I know the height of the camera, the angle of tilt and the small distance from the center of the robot which is considered (0, 0) what else would I need to convert the image coordinates to the distance from the center of the robotic arm?</p> <p>I am also assuming all the objects will have a z=0 because they will be sitting on the same platform as the arm.</p> <p>I have the inverse kinematics worked out to control the arm, I just need to give it coordinates to move to. </p> <p>If it helps I am using Python and OpenCV. </p> <p><strong>Edit:</strong> Clarification</p> https://robotics.stackexchange.com/q/12178 2 Scale problem with monocular visual odometry Kozuch https://robotics.stackexchange.com/users/1021 2017-04-21T10:58:51Z 2017-04-25T20:59:32Z <p>Is monocular visual odometry able to estimate relative scale? Say I have a sequence of 10 images that are taken on a single track each 1 m after the previous. Can some mono odometry method distinguish relative scale when it processes image pairs that are in various distances from each other? I mean like processing 1st vs 10th image and 9th vs 10th image - will the fist give 10x relative scale than the second?</p> <p>I am examining OpenCV based odometry code (<a href="https://github.com/avisingh599/mono-vo" rel="nofollow noreferrer">https://github.com/avisingh599/mono-vo</a>) but it only gives something like "translation vector" that always has a size of 1 regardless the distance measured. I know mono odometry can not do absolute scale but I thought it can do relative (question is what "relative" actually means here). Seems like OpenCV's recoverPose only do a translation vector that has always the same size (I guess the size is 1)?</p>