mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
mavlink_opticalflow: fix scaling and direction
This commit is contained in:
parent
ae9efb6cc4
commit
b60bec96cf
@ -49,8 +49,8 @@ def send_optical_flow_packet(x, y, c):
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
int(x * 10),
|
int(x),
|
||||||
int(y * 10),
|
int(y),
|
||||||
MAV_OPTICAL_FLOW_id,
|
MAV_OPTICAL_FLOW_id,
|
||||||
int(c * 255))
|
int(c * 255))
|
||||||
temp = struct.pack("<bbbbb26s",
|
temp = struct.pack("<bbbbb26s",
|
||||||
@ -88,8 +88,8 @@ while(True):
|
|||||||
extra_fb.replace(img)
|
extra_fb.replace(img)
|
||||||
|
|
||||||
# Offset results are noisy without filtering so we drop some accuracy.
|
# Offset results are noisy without filtering so we drop some accuracy.
|
||||||
sub_pixel_x = int(displacement.x_translation() * 5) / 5.0
|
sub_pixel_x = int(-displacement.x_translation() * 35)
|
||||||
sub_pixel_y = int(displacement.y_translation() * 5) / 5.0
|
sub_pixel_y = int(displacement.y_translation() * 53)
|
||||||
|
|
||||||
if(displacement.response() > MAV_OPTICAL_FLOW_confidence_threshold):
|
if(displacement.response() > MAV_OPTICAL_FLOW_confidence_threshold):
|
||||||
send_optical_flow_packet(sub_pixel_x, sub_pixel_y, displacement.response())
|
send_optical_flow_packet(sub_pixel_x, sub_pixel_y, displacement.response())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user