OpenMV is my favorite computer vision camera, and it combines a built-in OpenCV-like machine vision library with a microPython interface, all in one little board for $65. It also speaks MAVLink, so Patrick Poirier was able to do the above with just these extra lines of code to the standard built-in color tracking example:
while(True):
clock.tick()
img = sensor.snapshot()
for blob in img.find_blobs([thresholds[threshold_index]], pixels_threshold=100, area_threshold=20, merge=True):
img.draw_rectangle(blob.rect())
img.draw_cross(blob.cx(), blob.cy())
send_landing_target_packet(blob, img.width(), img.height())
print("TRACK %f %f " % (blob.cx(), blob.cy()))
and then send the result to Pixhawk via MAVLink:
def send_landing_target_packet(blob, w, h):
global packet_sequence
temp = struct.pack("<qfffffbb",
0,
(((blob.cx() / w) - 0.5) * h_fov)/2.25,
(((blob.cy() / h) - 0.5) * v_fov)/1.65,
0, #int(z_to_mm(tag.z_translation(), tag_size) / -10),
0.0,
0.0,
0,
MAV_LANDING_TARGET_frame)
Comments
ok.Thank you.
You can read a more detailed and advanced blog here: https://discuss.ardupilot.org/t/quadcopter-object-tracking-on-a-bud...
Hello, I'm from China, I'm sorry my English is not very good, I hope it will not affect our communication. I just bought the OpenMV module recently and hope to use Pixhawk to track objects.There is no clue at this point, only that they are directly connected through the serial port.Do you have detailed examples or introductions about this?Thank you very much, look forward to your reply.Don't know if you don't use QQ or MSN? Adding a friend is also OK. My email is 280894593@qq.com and I don't know if we can communicate.
Thanks again!
@Patrick Poirier,
Thanks a lot,I'll try it.
Hello,
For April Tags, you may change the lens for a wider angle (OpenMV store offers a IR filtered Wide Angle).
You can reduce the TAG size as well or you can build a "tag mosaic" like Fnoop as done with Aruco Tags
shown here:
Hello,
For April Tags, you may change the lens for a wider angle (OpenMV store offers a IR filtered Wide Angle).
You can reduce the TAG size as well or you can build a "tag mosaic" like Fnoop as done with Aruco Tags
shown here: https://github.com/fnoop/vision_landing
Good Luck an lease report progress ... or fail, that is a different, but necessary form of progress ;-)
Hi,
((blob.cx() / w) - 0.5) * h_fov)/2.25,
(((blob.cy() / h) - 0.5) * v_fov)/1.65,
how to fix2.25 and 1.65?
I tried a apriltag as target,but it seems the angle is small for vehicle to the center,i changed some values,but no use,
thanks.
Also note that JeVois, which is a similar integrated OpenCV board, is also now shipping for just $49. Lots of cool features, including optical flow and road tracking, built into that one, too.
Hello Bill,
Yes I received it last week and its already flying ;-)
Did you get your OpenMV camera yet? I ordered mine more than a month ago but haven't heard anything.
John Arne, you might want to give OpenMV a closer look. It does everything you mentioned. It's got optic flow, feature detection (and it's got the best April Tag implementation I've tried), and about 30 other standard CV routines, and it runs at 30FPS.Here's a link to its libraries, which you can see cover a lot of the OpenCV territory.
In my experience it performs at about the level of a RaspberryPi 3 running OpenCV, despite having less computing power, which is probably due to the optimized built-in libraries.