diff --git a/lib/led_identifier.py b/lib/led_identifier.py index a3bdda7..b5a8c73 100644 --- a/lib/led_identifier.py +++ b/lib/led_identifier.py @@ -45,3 +45,8 @@ def draw_results(image, results): cv2.drawMarker(render_image, [int(i) for i in results.center], (0, 255, 0), markerSize=100) return render_image + + +if __name__ == "__main__": + + led_finder = LedFinder() diff --git a/test/camera_layout.blend b/test/camera_layout.blend new file mode 100644 index 0000000..1d9bb53 Binary files /dev/null and b/test/camera_layout.blend differ diff --git a/test/media/capture_sequence/a_0.png b/test/media/capture_sequence/a_0.png deleted file mode 100644 index 8ae7e63..0000000 Binary files a/test/media/capture_sequence/a_0.png and /dev/null differ diff --git a/test/media/capture_sequence/a_1.png b/test/media/capture_sequence/a_1.png deleted file mode 100644 index 5c4fb2f..0000000 Binary files a/test/media/capture_sequence/a_1.png and /dev/null differ diff --git a/test/media/capture_sequence/a_10.png b/test/media/capture_sequence/a_10.png deleted file mode 100644 index 2f5b0e1..0000000 Binary files a/test/media/capture_sequence/a_10.png and /dev/null differ diff --git a/test/media/capture_sequence/a_11.png b/test/media/capture_sequence/a_11.png deleted file mode 100644 index 5600ce5..0000000 Binary files a/test/media/capture_sequence/a_11.png and /dev/null differ diff --git a/test/media/capture_sequence/a_12.png b/test/media/capture_sequence/a_12.png deleted file mode 100644 index edb4de6..0000000 Binary files a/test/media/capture_sequence/a_12.png and /dev/null differ diff --git a/test/media/capture_sequence/a_13.png b/test/media/capture_sequence/a_13.png deleted file mode 100644 index d392e9c..0000000 Binary files a/test/media/capture_sequence/a_13.png and /dev/null differ diff --git a/test/media/capture_sequence/a_14.png b/test/media/capture_sequence/a_14.png deleted file mode 100644 index 2f8b638..0000000 Binary files a/test/media/capture_sequence/a_14.png and /dev/null differ diff --git a/test/media/capture_sequence/a_2.png b/test/media/capture_sequence/a_2.png deleted file mode 100644 index 0feda17..0000000 Binary files a/test/media/capture_sequence/a_2.png and /dev/null differ diff --git a/test/media/capture_sequence/a_3.png b/test/media/capture_sequence/a_3.png deleted file mode 100644 index 719b8e8..0000000 Binary files a/test/media/capture_sequence/a_3.png and /dev/null differ diff --git a/test/media/capture_sequence/a_4.png b/test/media/capture_sequence/a_4.png deleted file mode 100644 index 1378e79..0000000 Binary files a/test/media/capture_sequence/a_4.png and /dev/null differ diff --git a/test/media/capture_sequence/a_5.png b/test/media/capture_sequence/a_5.png deleted file mode 100644 index d0572e0..0000000 Binary files a/test/media/capture_sequence/a_5.png and /dev/null differ diff --git a/test/media/capture_sequence/a_6.png b/test/media/capture_sequence/a_6.png deleted file mode 100644 index 861feeb..0000000 Binary files a/test/media/capture_sequence/a_6.png and /dev/null differ diff --git a/test/media/capture_sequence/a_7.png b/test/media/capture_sequence/a_7.png deleted file mode 100644 index 94b367c..0000000 Binary files a/test/media/capture_sequence/a_7.png and /dev/null differ diff --git a/test/media/capture_sequence/a_8.png b/test/media/capture_sequence/a_8.png deleted file mode 100644 index 70035c5..0000000 Binary files a/test/media/capture_sequence/a_8.png and /dev/null differ diff --git a/test/media/capture_sequence/a_9.png b/test/media/capture_sequence/a_9.png deleted file mode 100644 index c523833..0000000 Binary files a/test/media/capture_sequence/a_9.png and /dev/null differ diff --git a/test/media/capture_sequence/a_none.png b/test/media/capture_sequence/a_none.png deleted file mode 100644 index e510983..0000000 Binary files a/test/media/capture_sequence/a_none.png and /dev/null differ diff --git a/test/media/capture_sequence/cam_0/capture_0000.png b/test/media/capture_sequence/cam_0/capture_0000.png new file mode 100644 index 0000000..8126156 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0000.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0001.png b/test/media/capture_sequence/cam_0/capture_0001.png new file mode 100644 index 0000000..f06625f Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0001.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0002.png b/test/media/capture_sequence/cam_0/capture_0002.png new file mode 100644 index 0000000..7e06f1e Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0002.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0003.png b/test/media/capture_sequence/cam_0/capture_0003.png new file mode 100644 index 0000000..2de6bac Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0003.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0004.png b/test/media/capture_sequence/cam_0/capture_0004.png new file mode 100644 index 0000000..9ad4bc0 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0004.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0005.png b/test/media/capture_sequence/cam_0/capture_0005.png new file mode 100644 index 0000000..93fb63d Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0005.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0006.png b/test/media/capture_sequence/cam_0/capture_0006.png new file mode 100644 index 0000000..cc029c5 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0006.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0007.png b/test/media/capture_sequence/cam_0/capture_0007.png new file mode 100644 index 0000000..937c69d Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0007.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0008.png b/test/media/capture_sequence/cam_0/capture_0008.png new file mode 100644 index 0000000..7600bca Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0008.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0009.png b/test/media/capture_sequence/cam_0/capture_0009.png new file mode 100644 index 0000000..73a5766 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0009.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0010.png b/test/media/capture_sequence/cam_0/capture_0010.png new file mode 100644 index 0000000..6550439 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0010.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0011.png b/test/media/capture_sequence/cam_0/capture_0011.png new file mode 100644 index 0000000..e67be95 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0011.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0012.png b/test/media/capture_sequence/cam_0/capture_0012.png new file mode 100644 index 0000000..c03f1c3 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0012.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0013.png b/test/media/capture_sequence/cam_0/capture_0013.png new file mode 100644 index 0000000..71e57d3 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0013.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0014.png b/test/media/capture_sequence/cam_0/capture_0014.png new file mode 100644 index 0000000..7c84f5c Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0014.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0015.png b/test/media/capture_sequence/cam_0/capture_0015.png new file mode 100644 index 0000000..75d8168 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0015.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0016.png b/test/media/capture_sequence/cam_0/capture_0016.png new file mode 100644 index 0000000..7ad5526 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0016.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0017.png b/test/media/capture_sequence/cam_0/capture_0017.png new file mode 100644 index 0000000..12ad4f3 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0017.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0018.png b/test/media/capture_sequence/cam_0/capture_0018.png new file mode 100644 index 0000000..4caefee Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0018.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0019.png b/test/media/capture_sequence/cam_0/capture_0019.png new file mode 100644 index 0000000..280f554 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0019.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0020.png b/test/media/capture_sequence/cam_0/capture_0020.png new file mode 100644 index 0000000..3911723 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0020.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0021.png b/test/media/capture_sequence/cam_0/capture_0021.png new file mode 100644 index 0000000..a9f9409 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0021.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0022.png b/test/media/capture_sequence/cam_0/capture_0022.png new file mode 100644 index 0000000..d2e450a Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0022.png differ diff --git a/test/media/capture_sequence/cam_0/capture_0023.png b/test/media/capture_sequence/cam_0/capture_0023.png new file mode 100644 index 0000000..4c4df36 Binary files /dev/null and b/test/media/capture_sequence/cam_0/capture_0023.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0000.png b/test/media/capture_sequence/cam_1/capture_0000.png new file mode 100644 index 0000000..2230a4d Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0000.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0001.png b/test/media/capture_sequence/cam_1/capture_0001.png new file mode 100644 index 0000000..dd0ef04 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0001.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0002.png b/test/media/capture_sequence/cam_1/capture_0002.png new file mode 100644 index 0000000..833629b Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0002.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0003.png b/test/media/capture_sequence/cam_1/capture_0003.png new file mode 100644 index 0000000..97f1154 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0003.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0004.png b/test/media/capture_sequence/cam_1/capture_0004.png new file mode 100644 index 0000000..c289ed9 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0004.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0005.png b/test/media/capture_sequence/cam_1/capture_0005.png new file mode 100644 index 0000000..6da0059 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0005.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0006.png b/test/media/capture_sequence/cam_1/capture_0006.png new file mode 100644 index 0000000..0efe374 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0006.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0007.png b/test/media/capture_sequence/cam_1/capture_0007.png new file mode 100644 index 0000000..e8fc289 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0007.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0008.png b/test/media/capture_sequence/cam_1/capture_0008.png new file mode 100644 index 0000000..ff0ce48 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0008.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0009.png b/test/media/capture_sequence/cam_1/capture_0009.png new file mode 100644 index 0000000..73df654 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0009.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0010.png b/test/media/capture_sequence/cam_1/capture_0010.png new file mode 100644 index 0000000..c670a25 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0010.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0011.png b/test/media/capture_sequence/cam_1/capture_0011.png new file mode 100644 index 0000000..99a78e2 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0011.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0012.png b/test/media/capture_sequence/cam_1/capture_0012.png new file mode 100644 index 0000000..86b5ca2 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0012.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0013.png b/test/media/capture_sequence/cam_1/capture_0013.png new file mode 100644 index 0000000..1eaa075 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0013.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0014.png b/test/media/capture_sequence/cam_1/capture_0014.png new file mode 100644 index 0000000..365c7f0 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0014.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0015.png b/test/media/capture_sequence/cam_1/capture_0015.png new file mode 100644 index 0000000..be40abc Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0015.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0016.png b/test/media/capture_sequence/cam_1/capture_0016.png new file mode 100644 index 0000000..c2167cf Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0016.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0017.png b/test/media/capture_sequence/cam_1/capture_0017.png new file mode 100644 index 0000000..5ec685c Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0017.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0018.png b/test/media/capture_sequence/cam_1/capture_0018.png new file mode 100644 index 0000000..8cefb3c Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0018.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0019.png b/test/media/capture_sequence/cam_1/capture_0019.png new file mode 100644 index 0000000..0b81f47 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0019.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0020.png b/test/media/capture_sequence/cam_1/capture_0020.png new file mode 100644 index 0000000..3c00fdb Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0020.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0021.png b/test/media/capture_sequence/cam_1/capture_0021.png new file mode 100644 index 0000000..1b07e3c Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0021.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0022.png b/test/media/capture_sequence/cam_1/capture_0022.png new file mode 100644 index 0000000..d21d362 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0022.png differ diff --git a/test/media/capture_sequence/cam_1/capture_0023.png b/test/media/capture_sequence/cam_1/capture_0023.png new file mode 100644 index 0000000..73fbe17 Binary files /dev/null and b/test/media/capture_sequence/cam_1/capture_0023.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0000.png b/test/media/capture_sequence/cam_2/capture_0000.png new file mode 100644 index 0000000..c2fd611 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0000.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0001.png b/test/media/capture_sequence/cam_2/capture_0001.png new file mode 100644 index 0000000..c419cbc Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0001.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0002.png b/test/media/capture_sequence/cam_2/capture_0002.png new file mode 100644 index 0000000..14c4e39 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0002.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0003.png b/test/media/capture_sequence/cam_2/capture_0003.png new file mode 100644 index 0000000..ebecec6 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0003.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0004.png b/test/media/capture_sequence/cam_2/capture_0004.png new file mode 100644 index 0000000..9eae522 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0004.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0005.png b/test/media/capture_sequence/cam_2/capture_0005.png new file mode 100644 index 0000000..afcce0f Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0005.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0006.png b/test/media/capture_sequence/cam_2/capture_0006.png new file mode 100644 index 0000000..d3010d6 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0006.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0007.png b/test/media/capture_sequence/cam_2/capture_0007.png new file mode 100644 index 0000000..4799144 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0007.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0008.png b/test/media/capture_sequence/cam_2/capture_0008.png new file mode 100644 index 0000000..6527093 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0008.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0009.png b/test/media/capture_sequence/cam_2/capture_0009.png new file mode 100644 index 0000000..ffc0fd6 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0009.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0010.png b/test/media/capture_sequence/cam_2/capture_0010.png new file mode 100644 index 0000000..2bccd7b Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0010.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0011.png b/test/media/capture_sequence/cam_2/capture_0011.png new file mode 100644 index 0000000..1a7eca6 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0011.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0012.png b/test/media/capture_sequence/cam_2/capture_0012.png new file mode 100644 index 0000000..7bf451b Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0012.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0013.png b/test/media/capture_sequence/cam_2/capture_0013.png new file mode 100644 index 0000000..706bb10 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0013.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0014.png b/test/media/capture_sequence/cam_2/capture_0014.png new file mode 100644 index 0000000..bf67405 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0014.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0015.png b/test/media/capture_sequence/cam_2/capture_0015.png new file mode 100644 index 0000000..650c951 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0015.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0016.png b/test/media/capture_sequence/cam_2/capture_0016.png new file mode 100644 index 0000000..35da0fd Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0016.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0017.png b/test/media/capture_sequence/cam_2/capture_0017.png new file mode 100644 index 0000000..2f4bc8b Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0017.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0018.png b/test/media/capture_sequence/cam_2/capture_0018.png new file mode 100644 index 0000000..a0097fc Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0018.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0019.png b/test/media/capture_sequence/cam_2/capture_0019.png new file mode 100644 index 0000000..b25c27c Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0019.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0020.png b/test/media/capture_sequence/cam_2/capture_0020.png new file mode 100644 index 0000000..2d1992f Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0020.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0021.png b/test/media/capture_sequence/cam_2/capture_0021.png new file mode 100644 index 0000000..db19a5c Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0021.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0022.png b/test/media/capture_sequence/cam_2/capture_0022.png new file mode 100644 index 0000000..bc877a7 Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0022.png differ diff --git a/test/media/capture_sequence/cam_2/capture_0023.png b/test/media/capture_sequence/cam_2/capture_0023.png new file mode 100644 index 0000000..42a86bd Binary files /dev/null and b/test/media/capture_sequence/cam_2/capture_0023.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0000.png b/test/media/capture_sequence/cam_3/capture_0000.png new file mode 100644 index 0000000..d51d0c6 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0000.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0001.png b/test/media/capture_sequence/cam_3/capture_0001.png new file mode 100644 index 0000000..97bae7d Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0001.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0002.png b/test/media/capture_sequence/cam_3/capture_0002.png new file mode 100644 index 0000000..ec0fd16 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0002.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0003.png b/test/media/capture_sequence/cam_3/capture_0003.png new file mode 100644 index 0000000..0ee098e Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0003.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0004.png b/test/media/capture_sequence/cam_3/capture_0004.png new file mode 100644 index 0000000..5b0ab21 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0004.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0005.png b/test/media/capture_sequence/cam_3/capture_0005.png new file mode 100644 index 0000000..9982044 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0005.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0006.png b/test/media/capture_sequence/cam_3/capture_0006.png new file mode 100644 index 0000000..ba951e8 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0006.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0007.png b/test/media/capture_sequence/cam_3/capture_0007.png new file mode 100644 index 0000000..1dbd7ac Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0007.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0008.png b/test/media/capture_sequence/cam_3/capture_0008.png new file mode 100644 index 0000000..186d3de Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0008.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0009.png b/test/media/capture_sequence/cam_3/capture_0009.png new file mode 100644 index 0000000..e9752a1 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0009.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0010.png b/test/media/capture_sequence/cam_3/capture_0010.png new file mode 100644 index 0000000..d1b2eb6 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0010.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0011.png b/test/media/capture_sequence/cam_3/capture_0011.png new file mode 100644 index 0000000..90c21c6 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0011.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0012.png b/test/media/capture_sequence/cam_3/capture_0012.png new file mode 100644 index 0000000..4cf5f97 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0012.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0013.png b/test/media/capture_sequence/cam_3/capture_0013.png new file mode 100644 index 0000000..c2ed0fc Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0013.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0014.png b/test/media/capture_sequence/cam_3/capture_0014.png new file mode 100644 index 0000000..67e7eff Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0014.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0015.png b/test/media/capture_sequence/cam_3/capture_0015.png new file mode 100644 index 0000000..c2cac1e Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0015.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0016.png b/test/media/capture_sequence/cam_3/capture_0016.png new file mode 100644 index 0000000..f2d563b Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0016.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0017.png b/test/media/capture_sequence/cam_3/capture_0017.png new file mode 100644 index 0000000..d1e19ba Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0017.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0018.png b/test/media/capture_sequence/cam_3/capture_0018.png new file mode 100644 index 0000000..7a6ec54 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0018.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0019.png b/test/media/capture_sequence/cam_3/capture_0019.png new file mode 100644 index 0000000..c4fbb3d Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0019.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0020.png b/test/media/capture_sequence/cam_3/capture_0020.png new file mode 100644 index 0000000..e2ece2f Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0020.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0021.png b/test/media/capture_sequence/cam_3/capture_0021.png new file mode 100644 index 0000000..d6a8c61 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0021.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0022.png b/test/media/capture_sequence/cam_3/capture_0022.png new file mode 100644 index 0000000..d7fc636 Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0022.png differ diff --git a/test/media/capture_sequence/cam_3/capture_0023.png b/test/media/capture_sequence/cam_3/capture_0023.png new file mode 100644 index 0000000..fd798db Binary files /dev/null and b/test/media/capture_sequence/cam_3/capture_0023.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0000.png b/test/media/capture_sequence/cam_4/capture_0000.png new file mode 100644 index 0000000..b229b61 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0000.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0001.png b/test/media/capture_sequence/cam_4/capture_0001.png new file mode 100644 index 0000000..e9e8554 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0001.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0002.png b/test/media/capture_sequence/cam_4/capture_0002.png new file mode 100644 index 0000000..4ee5677 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0002.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0003.png b/test/media/capture_sequence/cam_4/capture_0003.png new file mode 100644 index 0000000..d4183c4 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0003.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0004.png b/test/media/capture_sequence/cam_4/capture_0004.png new file mode 100644 index 0000000..ad9ad73 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0004.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0005.png b/test/media/capture_sequence/cam_4/capture_0005.png new file mode 100644 index 0000000..a05d114 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0005.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0006.png b/test/media/capture_sequence/cam_4/capture_0006.png new file mode 100644 index 0000000..4d989cc Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0006.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0007.png b/test/media/capture_sequence/cam_4/capture_0007.png new file mode 100644 index 0000000..a5cde40 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0007.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0008.png b/test/media/capture_sequence/cam_4/capture_0008.png new file mode 100644 index 0000000..6c27a92 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0008.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0009.png b/test/media/capture_sequence/cam_4/capture_0009.png new file mode 100644 index 0000000..e9085cd Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0009.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0010.png b/test/media/capture_sequence/cam_4/capture_0010.png new file mode 100644 index 0000000..83a6163 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0010.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0011.png b/test/media/capture_sequence/cam_4/capture_0011.png new file mode 100644 index 0000000..64b709f Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0011.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0012.png b/test/media/capture_sequence/cam_4/capture_0012.png new file mode 100644 index 0000000..a7b863b Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0012.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0013.png b/test/media/capture_sequence/cam_4/capture_0013.png new file mode 100644 index 0000000..a6de521 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0013.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0014.png b/test/media/capture_sequence/cam_4/capture_0014.png new file mode 100644 index 0000000..f534853 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0014.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0015.png b/test/media/capture_sequence/cam_4/capture_0015.png new file mode 100644 index 0000000..65a5c2b Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0015.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0016.png b/test/media/capture_sequence/cam_4/capture_0016.png new file mode 100644 index 0000000..aa59c2e Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0016.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0017.png b/test/media/capture_sequence/cam_4/capture_0017.png new file mode 100644 index 0000000..176e13c Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0017.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0018.png b/test/media/capture_sequence/cam_4/capture_0018.png new file mode 100644 index 0000000..b739d88 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0018.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0019.png b/test/media/capture_sequence/cam_4/capture_0019.png new file mode 100644 index 0000000..3a53b8a Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0019.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0020.png b/test/media/capture_sequence/cam_4/capture_0020.png new file mode 100644 index 0000000..de4ef95 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0020.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0021.png b/test/media/capture_sequence/cam_4/capture_0021.png new file mode 100644 index 0000000..3d36d49 Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0021.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0022.png b/test/media/capture_sequence/cam_4/capture_0022.png new file mode 100644 index 0000000..5117a3d Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0022.png differ diff --git a/test/media/capture_sequence/cam_4/capture_0023.png b/test/media/capture_sequence/cam_4/capture_0023.png new file mode 100644 index 0000000..21c81dc Binary files /dev/null and b/test/media/capture_sequence/cam_4/capture_0023.png differ diff --git a/test/media/capture_sequence/s_0.png b/test/media/capture_sequence/s_0.png deleted file mode 100644 index d7372f4..0000000 Binary files a/test/media/capture_sequence/s_0.png and /dev/null differ diff --git a/test/media/capture_sequence/s_1.png b/test/media/capture_sequence/s_1.png deleted file mode 100644 index 04c1524..0000000 Binary files a/test/media/capture_sequence/s_1.png and /dev/null differ diff --git a/test/media/capture_sequence/s_2.png b/test/media/capture_sequence/s_2.png deleted file mode 100644 index a74046f..0000000 Binary files a/test/media/capture_sequence/s_2.png and /dev/null differ diff --git a/test/media/capture_sequence/s_3.png b/test/media/capture_sequence/s_3.png deleted file mode 100644 index c1fd296..0000000 Binary files a/test/media/capture_sequence/s_3.png and /dev/null differ diff --git a/test/media/capture_sequence/s_4.png b/test/media/capture_sequence/s_4.png deleted file mode 100644 index dd1662b..0000000 Binary files a/test/media/capture_sequence/s_4.png and /dev/null differ diff --git a/test/media/capture_sequence/s_5.png b/test/media/capture_sequence/s_5.png deleted file mode 100644 index 6071df3..0000000 Binary files a/test/media/capture_sequence/s_5.png and /dev/null differ diff --git a/test/media/capture_sequence/s_6.png b/test/media/capture_sequence/s_6.png deleted file mode 100644 index 4761201..0000000 Binary files a/test/media/capture_sequence/s_6.png and /dev/null differ diff --git a/test/media/capture_sequence/s_7.png b/test/media/capture_sequence/s_7.png deleted file mode 100644 index 89b2909..0000000 Binary files a/test/media/capture_sequence/s_7.png and /dev/null differ diff --git a/test/media/capture_sequence/s_8.png b/test/media/capture_sequence/s_8.png deleted file mode 100644 index 321dd8c..0000000 Binary files a/test/media/capture_sequence/s_8.png and /dev/null differ diff --git a/test/media/capture_sequence/s_none.png b/test/media/capture_sequence/s_none.png deleted file mode 100644 index 985d2f7..0000000 Binary files a/test/media/capture_sequence/s_none.png and /dev/null differ diff --git a/test/mock_camera.py b/test/mock_camera.py new file mode 100644 index 0000000..651570f --- /dev/null +++ b/test/mock_camera.py @@ -0,0 +1,54 @@ +import cv2 + + +class MockCamera: + + def __init__(self, device_id=0): + + self.current_frame = 0 + self.device_id = device_id + + def get_width(self): + return 640 + + def get_height(self): + return 480 + + def get_af_mode(self): + return 0 + + def get_focus(self): + return 0 + + def get_exposure_mode(self): + return 0 + + def get_exposure(self): + return 0 + + def get_gain(self): + return 0 + + def set_resolution(self, width, height): + pass + + def set_autofocus(self, mode, focus=0): + pass + + def set_exposure_mode(self, mode): + pass + + def set_gain(self, gain): + pass + + def set_exposure(self, exposure): + pass + + def read(self): + frame = self.read_frame(self.current_frame) + self.current_frame += 1 + return frame + + def read_frame(self, frame_id): + filename = f"test/media/capture_sequence/cam_{self.device_id}/capture_{frame_id:04}.png" + return cv2.cvtColor(cv2.imread(filename), cv2.COLOR_BGR2GRAY) diff --git a/test/test_led_identifier.py b/test/test_led_identifier.py index 04c8727..a1099a8 100644 --- a/test/test_led_identifier.py +++ b/test/test_led_identifier.py @@ -1,16 +1,11 @@ import sys -import cv2 sys.path.append('./') from lib.led_identifier import LedFinder +from mock_camera import MockCamera def close(x, y): - return abs(x - y) < 0.5 - - -def load_image(filename): - image = cv2.imread(filename) - return cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) + return abs(x - y) < 1.0 def test_init(): @@ -20,20 +15,21 @@ def test_init(): def test_basic_image_loading(): led_finder = LedFinder() - image = load_image("test/media/capture_sequence/a_0.png") + mock_camera = MockCamera() - led_results = led_finder.find_led(image) + led_results = led_finder.find_led(mock_camera.read()) - assert close(led_results.u(), 193) - assert close(led_results.v(), 150) + assert close(led_results.u(), 257) + assert close(led_results.v(), 177) def test_none_found(): led_finder = LedFinder() - image = load_image("test/media/capture_sequence/a_none.png") - - led_results = led_finder.find_led(image) + mock_camera = MockCamera() - assert led_results is None + for frame_id in [7, 15, 23]: # None of these should be visible from any views + frame = mock_camera.read_frame(frame_id) + led_results = led_finder.find_led(frame) + assert led_results is None