-1

What will be the best way to get exact location of randomly placed object like one on the picture bellow:

enter image description here

I want to build robotic application soo that robot is capable of picking such randomly places metal parts from box. So we have a box with a lot of mentioned parts, randomly throwed in that box. Robot must be picking that objects and putting them inside other empty box.

Thanks all for answers!

jok23
  • 286
  • 1
  • 5
  • 19
  • 1
    what is the best pizza? – Piglet Jan 25 '17 at 08:20
  • Piglet's answer is the correct one, but I'll elaborate a bit to say that you might be able to use SIFT to find such a part, and if you're extremely lucky you might pick some fraction of parts from a bin, but random bin picking is an extraordinarily difficult problem that is considered incompletely solved. If you're student, first try to solve the problem of picking up parts from a plane surface first. – Rethunk Feb 13 '17 at 03:59

1 Answers1

0

Assuming compared images will have the same scale:

// read template and convert it to polar coordinates
int radius = 100;
Mat target = imread("target.jpg);

Mat template;
cvLinearPolar(target, template, Point(target.cols/2, target.rows/2), ...);

// read src
Mat src = imread("src.jpg);

// initialize values to store best match
double best_score = DBL_MAX;
double best_x = -1;
double best_y = -1;
double best_angle = -1;

for (x=0;x<src.width;x++)
  for (y=0;y<src.height;y++) {
    Mat polar;
    cvLinearPolar(src, polar, Point(x,y), ...);

    ... calculate the best rotation angle that produces smallest difference
    ... between matched template and a calculated polar image

    if (min_difference < best_score) {
       ... update score, x, y, angle ...
    }
}

... best_x, best_y, best_angle should now store the best object location
ivan_a
  • 613
  • 5
  • 12