Find object center point coordinate with webcam

Can processing capture an object and find the center point of the object (center point coordinate)

In this case the object is QR Code, i want to move camera (which attached to robot arm) closer to object that i placed in camera range, read the qr code, and move somewhere based on qr code’s data

waiting for the reply, thx :slight_smile:

This depends on what you mean by “can processing”.

Object recognition is not an included feature in processing itself, and i don’t know of any specific libraries that can do that (although there might be some), but you can easily program it yourself.

Now, easily depends on your skills and experience with processing,
but in general all you would need to do for QR Code is to scan over the pixels array and see wether there is a portion that matches what you would expect to see when looking at a QR Code, like having some pixels more or less white, then black and then white.

Or remapping the image to have only white and black be used and other colors be removed (or just change w/b to black and others to white) and then see wether there is a square shape visible (either by comparison or a more efficient algorithm that should be easy to find online).

And then just get the position, size and orientation of the shape on the camera and calculate the center point with simple math and then give an adequate command to the robotic arm (if the position is at less than 1/2 the width, move the arm a bit to the right, and vice versa, if the size is less than 20 pixels with, move closer or so).

Although you don’t need the QR code really be centered, it sure helps in reading it. Now, reading a QR code… there is definetly a library for it (iirc). And moving based on the QR codes data should be pretty easy, depending on what data you get from it.

Hope this answers your question^^

1 Like