I have a 2 DOF Robot Arm with a camera attached to it. It takes an Image and there's an object in that image, say a glass. Of course, in order to move the arm to the required position to grasp the object, I have to solve the inverse kinematic equations. In order to solve them, I need the x and y, the coordinates where the arm has to reach to grasp the object. My question is how can I find the x and y of say the midpoint of the object from the image. Thanks

  • 1
    $\begingroup$ The same author asked essentially the same question here. $\endgroup$
    – Chuck
    Jul 13, 2015 at 13:16
  • $\begingroup$ Sorry @BilalWasim but this question is still too broad. Generally speaking, if you could write a book as an answer to a question, it is asking too much. In general we prefer practical, answerable questions based on actual problems that you face. Take a look at How to Ask and tour for more information on how stack exchange works. $\endgroup$
    – Mark Booth
    Jul 14, 2015 at 17:10
  • $\begingroup$ In addition, on hold means just that. It isn't closed, it isn't deleted, it's just waiting for improvements. If you edit the question to no longer be 'too broad' then it can be opened and people can start adding answers again. Incidentally, it would have been if you had edited your existing question rather than adding a new question which is almost the same. By asking two questions, the two answers which might help you a little are now split between them, rather than both being in the same place. $\endgroup$
    – Mark Booth
    Jul 14, 2015 at 17:15

1 Answer 1


What you need is to know the position in (x,y) of the object with respect to your robot's arm. That is, you want to measure distance. You have several options:

  1. Use a fiducial marker. By placing one of these images on your object, you can use an image processing algorithm to detect the marker and use its relative size and orientation to determine where the object is relative to the camera/your robot arm. Common ones look like this: enter image description here

Try looking for implementations of algorithms for reading fiducials in either ROS (Robot Operating System) modules or as functions in OpenCV.

  1. Use a distance sensor. Some commonly used ones for hobbyists are ultrasonic and infra-red laser range finders. Place these sensors on your robot arm and have the sensor detect the object by looking for a "bump" in the reading, then calculate the distance to the object.

  2. Use a stereo camera. You'll need to use an image processing algorithm to parse your camera outputs to detect how far away something is. Link

  3. Use a Lidar laser range finder. These are probably out of your budget, as most of them cost between $1000 and several thousand dollars, but they can be used to generate a 3D map of your environment.

Side note: With only a 2DOF arm, you'll be limited to grasping your object in one of two configurations. (elbow in/out) You might consider using a 3DOF robot arm with a wrist so that you can more easily adjust your grasping angle.

  • $\begingroup$ Great visual summary of fiducial markers! I'd also add April tags which is pretty popular now i think. And color dots on top of RoboCup SSL robots. NASA JPL also has a really nice simple fiducial that they put on Robosimian's joints. But is used more for arm and joint calibration. It is actually split on the joint line, and doesn't have a unique shape. $\endgroup$
    – Ben
    Jul 13, 2015 at 14:05
  • $\begingroup$ I think I should add that I didn't make that picture myself, I found it here from a google images search: computer.org/csdl/trans/tp/2010/07/ttp2010071317-abs.html $\endgroup$
    – wyverniv
    Jul 13, 2015 at 21:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.