Skip to content

Commit

Permalink
Clean up opencv_canny example slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Mar 9, 2023
1 parent 93edfca commit b487e55
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions examples/python/opencv_canny/main.py
Expand Up @@ -31,16 +31,22 @@ def run_canny() -> None:
# Create a new video capture
cap = cv2.VideoCapture(0)

frame_nr = 0

while cap.isOpened():
# Read the frame
ret, img = cap.read()
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break

# Get the current frame time
frame_time = cap.get(cv2.CAP_PROP_POS_MSEC)
rr.set_time_nanos("frame_time", int(frame_time * 1000000))
# Get the current frame time. On some platforms it always returns zero.
frame_time_ms = cap.get(cv2.CAP_PROP_POS_MSEC)
if frame_time_ms != 0:
rr.set_time_nanos("frame_time", int(frame_time_ms * 1_000_000))

rr.set_time_sequence("frame_nr", frame_nr)
frame_nr += 1

# Log the original image
rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
Expand Down

1 comment on commit b487e55

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: b487e55 Previous: 93edfca Ratio
datastore/insert/batch/rects/insert 563787 ns/iter (± 3986) 557404 ns/iter (± 1931) 1.01
datastore/latest_at/batch/rects/query 1807 ns/iter (± 4) 1821 ns/iter (± 8) 0.99
datastore/latest_at/missing_components/primary 357 ns/iter (± 4) 356 ns/iter (± 1) 1.00
datastore/latest_at/missing_components/secondaries 425 ns/iter (± 0) 424 ns/iter (± 1) 1.00
datastore/range/batch/rects/query 159349 ns/iter (± 616) 152292 ns/iter (± 498) 1.05
mono_points_arrow/generate_message_bundles 50253229 ns/iter (± 1350869) 52935324 ns/iter (± 946607) 0.95
mono_points_arrow/generate_messages 136911654 ns/iter (± 1330356) 140038594 ns/iter (± 1121718) 0.98
mono_points_arrow/encode_log_msg 164164198 ns/iter (± 1643394) 165644765 ns/iter (± 1298114) 0.99
mono_points_arrow/encode_total 355018838 ns/iter (± 3642864) 362959572 ns/iter (± 1770620) 0.98
mono_points_arrow/decode_log_msg 189804239 ns/iter (± 1600221) 188895962 ns/iter (± 1148497) 1.00
mono_points_arrow/decode_message_bundles 74310434 ns/iter (± 1110796) 75769133 ns/iter (± 2391124) 0.98
mono_points_arrow/decode_total 261695799 ns/iter (± 2103082) 262326604 ns/iter (± 1900899) 1.00
batch_points_arrow/generate_message_bundles 332870 ns/iter (± 863) 333138 ns/iter (± 1004) 1.00
batch_points_arrow/generate_messages 6327 ns/iter (± 13) 6392 ns/iter (± 21) 0.99
batch_points_arrow/encode_log_msg 369324 ns/iter (± 2550) 375721 ns/iter (± 1652) 0.98
batch_points_arrow/encode_total 723491 ns/iter (± 5875) 729575 ns/iter (± 2652) 0.99
batch_points_arrow/decode_log_msg 353839 ns/iter (± 1957) 353623 ns/iter (± 928) 1.00
batch_points_arrow/decode_message_bundles 2122 ns/iter (± 9) 2099 ns/iter (± 16) 1.01
batch_points_arrow/decode_total 355251 ns/iter (± 743) 357774 ns/iter (± 3224) 0.99
arrow_mono_points/insert 7024739212 ns/iter (± 29321816) 7259721552 ns/iter (± 149385179) 0.97
arrow_mono_points/query 1739171 ns/iter (± 26536) 1743373 ns/iter (± 36429) 1.00
arrow_batch_points/insert 2652740 ns/iter (± 8844) 2772973 ns/iter (± 78195) 0.96
arrow_batch_points/query 17405 ns/iter (± 39) 16888 ns/iter (± 47) 1.03
arrow_batch_vecs/insert 42588 ns/iter (± 87) 41866 ns/iter (± 141) 1.02
arrow_batch_vecs/query 389276 ns/iter (± 2138) 389761 ns/iter (± 1875) 1.00
tuid/Tuid::random 34 ns/iter (± 0) 34 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.