refactor(*): doc and samples update tools contents.
This commit is contained in:
parent
75631fa7d7
commit
ed2398fedc
|
@ -86,7 +86,7 @@ s1030:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_auto_exposure
|
$ ./samples/_output/bin/ctrl_auto_exposure
|
||||||
I0513 14:07:57.963943 31845 utils.cc:26] Detecting MYNT EYE devices
|
I0513 14:07:57.963943 31845 utils.cc:26] Detecting MYNT EYE devices
|
||||||
I0513 14:07:58.457536 31845 utils.cc:33] MYNT EYE devices:
|
I0513 14:07:58.457536 31845 utils.cc:33] MYNT EYE devices:
|
||||||
I0513 14:07:58.457563 31845 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
I0513 14:07:58.457563 31845 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
||||||
|
@ -101,7 +101,7 @@ s2100/s210a:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_auto_exposure
|
$ ./samples/_output/bin/ctrl_auto_exposure
|
||||||
I/utils.cc:30 Detecting MYNT EYE devices
|
I/utils.cc:30 Detecting MYNT EYE devices
|
||||||
I/utils.cc:40 MYNT EYE devices:
|
I/utils.cc:40 MYNT EYE devices:
|
||||||
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
||||||
|
@ -126,4 +126,4 @@ s2100/s210a:
|
||||||
|
|
||||||
The sample program displays an image with a real exposure time in the upper left corner, in milliseconds.
|
The sample program displays an image with a real exposure time in the upper left corner, in milliseconds.
|
||||||
|
|
||||||
Complete code examples, see `auto_exposure.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/auto_exposure.cc>`_ .
|
Complete code examples, see `ctrl_auto_exposure.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/ctrl_auto_exposure.cc>`_ .
|
||||||
|
|
|
@ -67,7 +67,7 @@ s1030:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_framerate
|
$ ./samples/_output/bin/ctrl_framerate
|
||||||
I0513 14:05:57.218222 31813 utils.cc:26] Detecting MYNT EYE devices
|
I0513 14:05:57.218222 31813 utils.cc:26] Detecting MYNT EYE devices
|
||||||
I0513 14:05:57.899404 31813 utils.cc:33] MYNT EYE devices:
|
I0513 14:05:57.899404 31813 utils.cc:33] MYNT EYE devices:
|
||||||
I0513 14:05:57.899430 31813 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
I0513 14:05:57.899430 31813 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
||||||
|
@ -82,7 +82,7 @@ s2100/s210a:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_framerate
|
$ ./samples/_output/bin/ctrl_framerate
|
||||||
I/utils.cc:30 Detecting MYNT EYE devices
|
I/utils.cc:30 Detecting MYNT EYE devices
|
||||||
I/utils.cc:40 MYNT EYE devices:
|
I/utils.cc:40 MYNT EYE devices:
|
||||||
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
||||||
|
@ -105,4 +105,4 @@ s2100/s210a:
|
||||||
|
|
||||||
After the sample program finishes running with ``ESC/Q``, it will output the calculated value of the frame rate of image & IMU frequency.
|
After the sample program finishes running with ``ESC/Q``, it will output the calculated value of the frame rate of image & IMU frequency.
|
||||||
|
|
||||||
Complete code samples,please see `framerate.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/framerate.cc>`_ .
|
Complete code samples,please see `ctrl_framerate.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/ctrl_framerate.cc>`_ .
|
||||||
|
|
|
@ -37,7 +37,7 @@ s210a/s2100:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_iic_adress
|
$ ./samples/_output/bin/ctrl_iic_adress
|
||||||
I/utils.cc:30 Detecting MYNT EYE devices
|
I/utils.cc:30 Detecting MYNT EYE devices
|
||||||
I/utils.cc:40 MYNT EYE devices:
|
I/utils.cc:40 MYNT EYE devices:
|
||||||
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
||||||
|
@ -55,4 +55,4 @@ s210a/s2100:
|
||||||
I/imu_range.cc:51 Set iic address to 0x31
|
I/imu_range.cc:51 Set iic address to 0x31
|
||||||
|
|
||||||
After the sample program finishes running with ``ESC/Q``.
|
After the sample program finishes running with ``ESC/Q``.
|
||||||
Complete code samples,please see `iic_address.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/iic_address.cc>`_ .
|
Complete code samples,please see `ctrl_iic_address.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/ctrl_iic_address.cc>`_ .
|
||||||
|
|
|
@ -37,7 +37,7 @@ Reference running results on Linux:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_imu_low_pass_filter
|
$ ./samples/_output/bin/ctrl_imu_low_pass_filter
|
||||||
I/utils.cc:30 Detecting MYNT EYE devices
|
I/utils.cc:30 Detecting MYNT EYE devices
|
||||||
I/utils.cc:40 MYNT EYE devices:
|
I/utils.cc:40 MYNT EYE devices:
|
||||||
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
||||||
|
@ -60,4 +60,4 @@ Reference running results on Linux:
|
||||||
|
|
||||||
After the sample program finishes running with ``ESC/Q``, the low-pass filter of imu setting is complete. The ranges will be kept inside the hardware and not affected by power off.
|
After the sample program finishes running with ``ESC/Q``, the low-pass filter of imu setting is complete. The ranges will be kept inside the hardware and not affected by power off.
|
||||||
|
|
||||||
Complete code samples,please see `imu_low_pass_filter.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/imu_low_pass_filter.cc>`_ 。
|
Complete code samples,please see `ctrl_imu_low_pass_filter.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/ctrl_imu_low_pass_filter.cc>`_ 。
|
||||||
|
|
|
@ -67,7 +67,7 @@ s1030:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_imu_range
|
$ ./samples/_output/bin/ctrl_imu_range
|
||||||
I/utils.cc:28 Detecting MYNT EYE devices
|
I/utils.cc:28 Detecting MYNT EYE devices
|
||||||
I/utils.cc:38 MYNT EYE devices:
|
I/utils.cc:38 MYNT EYE devices:
|
||||||
I/utils.cc:41 index: 0, name: MYNT-EYE-S1030, sn: 4B4C1F1100090712
|
I/utils.cc:41 index: 0, name: MYNT-EYE-S1030, sn: 4B4C1F1100090712
|
||||||
|
@ -82,7 +82,7 @@ s2100/s210a:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_imu_range
|
$ ./samples/_output/bin/ctrl_imu_range
|
||||||
I/utils.cc:30 Detecting MYNT EYE devices
|
I/utils.cc:30 Detecting MYNT EYE devices
|
||||||
I/utils.cc:40 MYNT EYE devices:
|
I/utils.cc:40 MYNT EYE devices:
|
||||||
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
||||||
|
@ -105,4 +105,4 @@ s2100/s210a:
|
||||||
|
|
||||||
After the sample program finishes running with ``ESC/Q``, the ranges of imu setting is complete. The ranges will be kept inside the hardware and not affected by power off.
|
After the sample program finishes running with ``ESC/Q``, the ranges of imu setting is complete. The ranges will be kept inside the hardware and not affected by power off.
|
||||||
|
|
||||||
Complete code samples,please see `imu_range.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/imu_range.cc>`_.
|
Complete code samples,please see `ctrl_imu_range.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/ctrl_imu_range.cc>`_.
|
||||||
|
|
|
@ -33,7 +33,7 @@ Reference running results on Linux:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_infrared
|
$ ./samples/_output/bin/ctrl_infrared
|
||||||
I0504 16:16:28.016624 25848 utils.cc:13] Detecting MYNT EYE devices
|
I0504 16:16:28.016624 25848 utils.cc:13] Detecting MYNT EYE devices
|
||||||
I0504 16:16:28.512462 25848 utils.cc:20] MYNT EYE devices:
|
I0504 16:16:28.512462 25848 utils.cc:20] MYNT EYE devices:
|
||||||
I0504 16:16:28.512473 25848 utils.cc:24] index: 0, name: MYNT-EYE-S1000
|
I0504 16:16:28.512473 25848 utils.cc:24] index: 0, name: MYNT-EYE-S1000
|
||||||
|
@ -51,4 +51,4 @@ At this point, if the image is displayed, you can see IR speckle on the image, a
|
||||||
|
|
||||||
The hardware will not record the IR value after being turned off. In order to keep IR enabled, you must set the IR value after turning on the device.
|
The hardware will not record the IR value after being turned off. In order to keep IR enabled, you must set the IR value after turning on the device.
|
||||||
|
|
||||||
Complete code samples,see `infrared.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/infrared.cc>`_ .
|
Complete code samples,see `ctrl_infrared.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/ctrl_infrared.cc>`_ .
|
||||||
|
|
|
@ -71,7 +71,7 @@ s1030:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_manual_exposure
|
$ ./samples/_output/bin/ctrl_manual_exposure
|
||||||
I0513 14:09:17.104431 31908 utils.cc:26] Detecting MYNT EYE devices
|
I0513 14:09:17.104431 31908 utils.cc:26] Detecting MYNT EYE devices
|
||||||
I0513 14:09:17.501519 31908 utils.cc:33] MYNT EYE devices:
|
I0513 14:09:17.501519 31908 utils.cc:33] MYNT EYE devices:
|
||||||
I0513 14:09:17.501551 31908 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
I0513 14:09:17.501551 31908 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
||||||
|
@ -85,7 +85,7 @@ s2100/s210a:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/ctrl_manual_exposure
|
$ ./samples/_output/bin/ctrl_manual_exposure
|
||||||
I/utils.cc:30 Detecting MYNT EYE devices
|
I/utils.cc:30 Detecting MYNT EYE devices
|
||||||
I/utils.cc:40 MYNT EYE devices:
|
I/utils.cc:40 MYNT EYE devices:
|
||||||
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
|
||||||
|
@ -107,4 +107,4 @@ s2100/s210a:
|
||||||
|
|
||||||
The sample program displays an image with a real exposure time in the upper left corner, in milliseconds.
|
The sample program displays an image with a real exposure time in the upper left corner, in milliseconds.
|
||||||
|
|
||||||
Complete code samples,see `manual_exposure.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/manual_exposure.cc>`_ .
|
Complete code samples,see `ctrl_manual_exposure.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/ctrl_manual_exposure.cc>`_ .
|
||||||
|
|
|
@ -12,7 +12,6 @@ SDK Data Samples
|
||||||
get_stereo_rectified
|
get_stereo_rectified
|
||||||
get_disparity
|
get_disparity
|
||||||
get_depth
|
get_depth
|
||||||
get_points
|
|
||||||
get_imu
|
get_imu
|
||||||
get_imu_correspondence
|
get_imu_correspondence
|
||||||
get_from_callbacks
|
get_from_callbacks
|
||||||
|
|
|
@ -47,8 +47,8 @@ Reference code snippet:
|
||||||
|
|
||||||
The above code uses OpenCV to display the image. When the display window is selected, pressing ``ESC/Q`` will end the program.
|
The above code uses OpenCV to display the image. When the display window is selected, pressing ``ESC/Q`` will end the program.
|
||||||
|
|
||||||
Complete code examples, see `get_depth.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_depth.cc>`_ .
|
Complete code examples, see `get_depth.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_depth.cc>`_ .
|
||||||
|
|
||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
Preview the value of a region of the depth image, see `get_depth_with_region.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/api/get_depth_with_region.cc>`_ .
|
Preview the value of a region of the depth image, see `get_depth_with_region.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_depth_with_region.cc>`_ .
|
||||||
|
|
|
@ -24,7 +24,7 @@ Reference result on Linux:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/get_device_info
|
$ ./samples/_output/bin/get_device_info
|
||||||
I0503 16:40:21.109391 32106 utils.cc:13] Detecting MYNT EYE devices
|
I0503 16:40:21.109391 32106 utils.cc:13] Detecting MYNT EYE devices
|
||||||
I0503 16:40:21.604116 32106 utils.cc:20] MYNT EYE devices:
|
I0503 16:40:21.604116 32106 utils.cc:20] MYNT EYE devices:
|
||||||
I0503 16:40:21.604127 32106 utils.cc:24] index: 0, name: MYNT-EYE-S1000
|
I0503 16:40:21.604127 32106 utils.cc:24] index: 0, name: MYNT-EYE-S1000
|
||||||
|
@ -38,4 +38,4 @@ Reference result on Linux:
|
||||||
I0503 16:40:21.615164 32106 get_device_info.cc:16] IMU type: 0000
|
I0503 16:40:21.615164 32106 get_device_info.cc:16] IMU type: 0000
|
||||||
I0503 16:40:21.615171 32106 get_device_info.cc:17] Nominal baseline: 120
|
I0503 16:40:21.615171 32106 get_device_info.cc:17] Nominal baseline: 120
|
||||||
|
|
||||||
Complete code examples, see `get_device_info.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_device_info.cc>`_ .
|
Complete code examples, see `get_device_info.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_device_info.cc>`_ .
|
||||||
|
|
|
@ -59,4 +59,4 @@ Reference code snippet:
|
||||||
|
|
||||||
The above code uses OpenCV to display the image. Select the display window, press ``ESC/Q`` to exit in the program.
|
The above code uses OpenCV to display the image. Select the display window, press ``ESC/Q`` to exit in the program.
|
||||||
|
|
||||||
Complete code examples, see `get_disparity.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_disparity.cc>`_ .
|
Complete code examples, see `get_disparity.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_disparity.cc>`_ .
|
||||||
|
|
|
@ -116,4 +116,4 @@ Reference code snippet:
|
||||||
|
|
||||||
OpenCV is used to display images and data above. When the window is selected, pressing ``ESC/Q`` will exit program.
|
OpenCV is used to display images and data above. When the window is selected, pressing ``ESC/Q`` will exit program.
|
||||||
|
|
||||||
Complete code examples, see `get_from_callbacks.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_from_callbacks.cc>`_ .
|
Complete code examples, see `get_from_callbacks.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_from_callbacks.cc>`_ .
|
||||||
|
|
|
@ -27,7 +27,7 @@ Reference result on Linux:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/get_img_params
|
$ ./samples/_output/bin/get_img_params
|
||||||
I0510 15:00:22.643263 6980 utils.cc:26] Detecting MYNT EYE devices
|
I0510 15:00:22.643263 6980 utils.cc:26] Detecting MYNT EYE devices
|
||||||
I0510 15:00:23.138811 6980 utils.cc:33] MYNT EYE devices:
|
I0510 15:00:23.138811 6980 utils.cc:33] MYNT EYE devices:
|
||||||
I0510 15:00:23.138849 6980 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
I0510 15:00:23.138849 6980 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
||||||
|
@ -36,4 +36,4 @@ Reference result on Linux:
|
||||||
I0510 15:00:23.210551 6980 get_img_params.cc:24] Intrinsics right: {width: 752, height: 480, fx: 736.38305001095545776, fy: 723.50066150722432212, cx: 456.68367112303980093, cy: 250.70083335536796199, model: 0, coeffs: [-0.51012886039889305, 0.38764476500996770, 0.00000000000000000, 0.00000000000000000, 0.00000000000000000]}
|
I0510 15:00:23.210551 6980 get_img_params.cc:24] Intrinsics right: {width: 752, height: 480, fx: 736.38305001095545776, fy: 723.50066150722432212, cx: 456.68367112303980093, cy: 250.70083335536796199, model: 0, coeffs: [-0.51012886039889305, 0.38764476500996770, 0.00000000000000000, 0.00000000000000000, 0.00000000000000000]}
|
||||||
I0510 15:00:23.210577 6980 get_img_params.cc:26] Extrinsics left to right: {rotation: [0.99701893306553813, -0.00095378124886237, -0.07715139279485062, 0.00144939967628305, 0.99997867219985104, 0.00636823256494144, 0.07714367342455503, -0.00646107164115277, 0.99699905125522237], translation: [-118.88991734400046596, -0.04560580387053091, -3.95313736911933855]}
|
I0510 15:00:23.210577 6980 get_img_params.cc:26] Extrinsics left to right: {rotation: [0.99701893306553813, -0.00095378124886237, -0.07715139279485062, 0.00144939967628305, 0.99997867219985104, 0.00636823256494144, 0.07714367342455503, -0.00646107164115277, 0.99699905125522237], translation: [-118.88991734400046596, -0.04560580387053091, -3.95313736911933855]}
|
||||||
|
|
||||||
Complete code examples, see `get_img_params.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_img_params.cc>`_ .
|
Complete code examples, see `get_img_params.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_img_params.cc>`_ .
|
||||||
|
|
|
@ -47,8 +47,13 @@ Sample code snippet:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
painter.DrawImgData(img, *left_data.img);
|
painter.DrawImgData(img, *left_data.img);
|
||||||
if (!motion_datas.empty()) {
|
static std::vector<api::MotionData> motion_datas_s = motion_datas;
|
||||||
painter.DrawImuData(img, *motion_datas[0].imu);
|
|
||||||
|
if (!motion_datas.empty() && motion_datas.size() > 0) {
|
||||||
|
motion_datas_s = motion_datas;
|
||||||
|
}
|
||||||
|
if (!motion_datas_s.empty() && motion_datas_s.size() > 0) {
|
||||||
|
painter.DrawImuData(img, *motion_datas_s[0].imu);
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::imshow("frame", img);
|
cv::imshow("frame", img);
|
||||||
|
@ -63,4 +68,4 @@ Sample code snippet:
|
||||||
|
|
||||||
OpenCV is used to display image and data. When window is selected, press ``ESC/Q`` to exit program.
|
OpenCV is used to display image and data. When window is selected, press ``ESC/Q`` to exit program.
|
||||||
|
|
||||||
Complete code examples, see `get_imu.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_imu.cc>`_ .
|
Complete code examples, see `get_imu.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_imu.cc>`_ .
|
||||||
|
|
|
@ -58,7 +58,7 @@ Reference result on Linux:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./samples/_output/bin/tutorials/get_imu_correspondence
|
$ ./samples/_output/bin/get_imu_correspondence
|
||||||
I/utils.cc:30 Detecting MYNT EYE devices
|
I/utils.cc:30 Detecting MYNT EYE devices
|
||||||
I/utils.cc:40 MYNT EYE devices:
|
I/utils.cc:40 MYNT EYE devices:
|
||||||
I/utils.cc:43 index: 0, name: MYNT-EYE-S1030, sn: 0281351000090807
|
I/utils.cc:43 index: 0, name: MYNT-EYE-S1030, sn: 0281351000090807
|
||||||
|
@ -106,4 +106,4 @@ Reference result on Linux:
|
||||||
I/get_imu_correspondence.cc:61 Imu timestamp: 171419650, diff_prev=2020, diff_img=16608
|
I/get_imu_correspondence.cc:61 Imu timestamp: 171419650, diff_prev=2020, diff_img=16608
|
||||||
I/get_imu_correspondence.cc:61 Imu timestamp: 171421660, diff_prev=2010, diff_img=18624
|
I/get_imu_correspondence.cc:61 Imu timestamp: 171421660, diff_prev=2010, diff_img=18624
|
||||||
|
|
||||||
Complete code examples, see `get_imu_correspondence.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_imu_correspondence.cc>`_ .
|
Complete code examples, see `get_imu_correspondence.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_imu_correspondence.cc>`_ .
|
||||||
|
|
|
@ -15,4 +15,4 @@ Reference commands:
|
||||||
LOG(INFO) << "Motion extrinsics left to imu: {"
|
LOG(INFO) << "Motion extrinsics left to imu: {"
|
||||||
<< api->GetMotionExtrinsics(Stream::LEFT) << "}";
|
<< api->GetMotionExtrinsics(Stream::LEFT) << "}";
|
||||||
|
|
||||||
Complete code examples, see `get_imu_params.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_imu_params.cc>`_ .
|
Complete code examples, see `get_imu_params.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_imu_params.cc>`_ .
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
.. _data_get_points:
|
|
||||||
|
|
||||||
Get Point Image
|
|
||||||
================
|
|
||||||
|
|
||||||
Point images belongs to upper layer of synthetic data. To get this kind of data through ``GetStreamData()``, you need to start the ``EnableStreamData()`` beforehand. It should be check not empty before use.
|
|
||||||
|
|
||||||
For detail process description, please see :ref:`get_stereo` :ref:`get_stereo_rectified` .
|
|
||||||
|
|
||||||
It is recommended to use plugin to calculate depth: the depth map will be better with a higher frame rate. Please see :ref:`get_with_plugin` for detail.
|
|
||||||
|
|
||||||
Sample code snippet:
|
|
||||||
|
|
||||||
.. code-block:: c++
|
|
||||||
|
|
||||||
auto &&api = API::Create(argc, argv);
|
|
||||||
|
|
||||||
api->EnableStreamData(Stream::POINTS);
|
|
||||||
|
|
||||||
api->Start(Source::VIDEO_STREAMING);
|
|
||||||
|
|
||||||
cv::namedWindow("frame");
|
|
||||||
PCViewer pcviewer;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
api->WaitForStreams();
|
|
||||||
|
|
||||||
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
|
||||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
|
||||||
|
|
||||||
cv::Mat img;
|
|
||||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
|
||||||
cv::imshow("frame", img);
|
|
||||||
|
|
||||||
auto &&points_data = api->GetStreamData(Stream::POINTS);
|
|
||||||
if (!points_data.frame.empty()) {
|
|
||||||
pcviewer.Update(points_data.frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
char key = static_cast<char>(cv::waitKey(1));
|
|
||||||
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (pcviewer.WasStopped()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
api->Stop(Source::VIDEO_STREAMING);
|
|
||||||
|
|
||||||
`PCL <https://github.com/PointCloudLibrary/pcl>`_ is used to display point images above. Program will close when point image window is closed.
|
|
||||||
|
|
||||||
Complete code examples, see `get_points.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_points.cc>`_ .
|
|
||||||
|
|
||||||
.. attention::
|
|
||||||
|
|
||||||
Sample code only compiles when `PCL <https://github.com/PointCloudLibrary/pcl>`_ is ready. If your PCL was installed in a different directory, please set ``CMAKE_PREFIX_PATH`` in `tutorials/CMakeLists.txt <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/CMakeLists.txt>`_ to the path of ``PCLConfig.cmake`` . You can find ``CMAKE_PREFIX_PATH`` near ``find_package(PCL)`` .
|
|
|
@ -37,4 +37,4 @@ Reference commands:
|
||||||
|
|
||||||
The above code uses OpenCV to display the image. When the display window is selected, pressing ``ESC/Q`` will end the program.
|
The above code uses OpenCV to display the image. When the display window is selected, pressing ``ESC/Q`` will end the program.
|
||||||
|
|
||||||
Complete code examples, see `get_stereo.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_stereo.cc>`_ .
|
Complete code examples, see `get_stereo.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_stereo.cc>`_ .
|
||||||
|
|
|
@ -48,4 +48,4 @@ Reference code snippet:
|
||||||
|
|
||||||
OpenCV is used to display the image above. Select the display window, press ``ESC/Q`` to exit the program.
|
OpenCV is used to display the image above. Select the display window, press ``ESC/Q`` to exit the program.
|
||||||
|
|
||||||
Complete code examples, see `get_stereo_rectified.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_stereo_rectified.cc>`_ .
|
Complete code examples, see `get_stereo_rectified.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_stereo_rectified.cc>`_ .
|
||||||
|
|
|
@ -83,7 +83,7 @@ In addition, the following command can be executed to check whether the dependen
|
||||||
|
|
||||||
If the plugin's dependent library is not found, it will report an error \"Open plugin failed\" when loading.
|
If the plugin's dependent library is not found, it will report an error \"Open plugin failed\" when loading.
|
||||||
|
|
||||||
Complete code sample, see `get_with_plugin.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_with_plugin.cc>`_ .
|
Complete code sample, see `get_with_plugin.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/get_with_plugin.cc>`_ .
|
||||||
|
|
||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
|
|
|
@ -3,22 +3,22 @@
|
||||||
Save Device Infomation And Parameters
|
Save Device Infomation And Parameters
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
The SDK provides a tool ``save_all_infos`` for save information and parameters. For more information, please read `tools/README.md <https://github.com/slightech/MYNT-EYE-S-SDK/tree/master/tools>`_ .
|
The SDK provides a tool ``save_all_infos`` for save information and parameters.
|
||||||
|
|
||||||
Reference commands:
|
Reference commands:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
./tools/_output/bin/writer/save_all_infos
|
./samples/_output/bin/save_all_infos
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
.\tools\_output\bin\writer\save_all_infos.bat
|
.\samples\_output\bin\save_all_infos.bat
|
||||||
|
|
||||||
Reference result on Linux:
|
Reference result on Linux:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ./tools/_output/bin/writer/save_all_infos
|
$ ./samples/_output/bin/save_all_infos
|
||||||
I0512 21:40:08.687088 4092 utils.cc:26] Detecting MYNT EYE devices
|
I0512 21:40:08.687088 4092 utils.cc:26] Detecting MYNT EYE devices
|
||||||
I0512 21:40:09.366693 4092 utils.cc:33] MYNT EYE devices:
|
I0512 21:40:09.366693 4092 utils.cc:33] MYNT EYE devices:
|
||||||
I0512 21:40:09.366734 4092 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
I0512 21:40:09.366734 4092 utils.cc:37] index: 0, name: MYNT-EYE-S1000
|
||||||
|
|
|
@ -49,4 +49,4 @@ Reference commands:
|
||||||
|
|
||||||
The above code uses OpenCV to display the image. When the display window is selected, pressing ``ESC/Q`` will end the program.
|
The above code uses OpenCV to display the image. When the display window is selected, pressing ``ESC/Q`` will end the program.
|
||||||
|
|
||||||
Complete code examples, see `save_single_image.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/save_single_image.cc>`_ .
|
Complete code examples, see `save_single_image.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/save_single_image.cc>`_ .
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Write Image Parameters
|
Write Image Parameters
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
The SDK provides a tool ``img_params_writer`` for writing image parameters. For details, read `tools/README.md <https://github.com/slightech/MYNT-EYE-S-SDK/tree/master/tools>`_ .
|
The SDK provides a tool ``write_img_params`` for writing image parameters.
|
||||||
|
|
||||||
For getting image parameters, please read :ref:`get_img_params`. This is used to calculate the deviation.
|
For getting image parameters, please read :ref:`get_img_params`. This is used to calculate the deviation.
|
||||||
|
|
||||||
|
@ -11,21 +11,21 @@ Reference commands:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
./tools/_output/bin/writer/img_params_writer tools/writer/config/img.params
|
./samples/_output/bin/write_img_params samples/config/img.params
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
.\tools\_output\bin\writer\img_params_writer.bat tools\writer\config\img.params
|
.\samples\_output\bin\write_img_params.bat samples\config\img.params
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
Please don't override parameters, you can use ``save_all_infos`` to backup parameters.
|
Please don't override parameters, you can use ``save_all_infos`` to backup parameters.
|
||||||
|
|
||||||
And, `tools/writer/config/S1030/img.params.pinhole <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/tools/writer/config/S1030/img.params.pinhole>`_ is the path of S1030 pihole parameters file. If you calibrated parameters yourself, you can edit it and run previous commands to write them into the devices.
|
And, `samples/config/S1030/img.params.pinhole <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/config/S1030/img.params.pinhole>`_ is the path of S1030 pihole parameters file. If you calibrated parameters yourself, you can edit it and run previous commands to write them into the devices.
|
||||||
|
|
||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
The image calibration parameters of S2100/S210A are in ``tools/writer/config/S210A``
|
The image calibration parameters of S2100/S210A are in ``samples/config/S210A``
|
||||||
The image calibration parameters of S1030 are in ``tools/writer/config/S1030``
|
The image calibration parameters of S1030 are in ``samples/config/S1030``
|
||||||
|
|
||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Write IMU Parameters
|
Write IMU Parameters
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
SDK provides the tool ``imu_params_writer`` to write IMU parameters. For deltail, please read `tools/README.md <https://github.com/slightech/MYNT-EYE-S-SDK/tree/master/tools>`_ .
|
SDK provides the tool ``write_imu_params`` to write IMU parameters.
|
||||||
|
|
||||||
Information about how to get IMU parameters, please read :ref:`get_imu_params` .
|
Information about how to get IMU parameters, please read :ref:`get_imu_params` .
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ Reference commands:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
./tools/_output/bin/writer/imu_params_writer tools/writer/config/imu.params
|
./samples/_output/bin/write_imu_params samples/config/imu.params
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
.\tools\_output\bin\writer\imu_params_writer.bat tools\writer\config\imu.params
|
.\samples\_output\bin\write_imu_params.bat samples\config\imu.params
|
||||||
|
|
||||||
The path of parameters file can be found in `tools/writer/config/img.params <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/tools/writer/config/img.params>`_ . If you calibrated the parameters yourself, you can edit the file and run above commands to write them into the device.
|
The path of parameters file can be found in `samples/config/img.params <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/config/img.params>`_ . If you calibrated the parameters yourself, you can edit the file and run above commands to write them into the device.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ How to use SDK with CMake
|
||||||
|
|
||||||
This tutorial will create a project with CMake to start using SDK.
|
This tutorial will create a project with CMake to start using SDK.
|
||||||
|
|
||||||
You could find the project demo in ``<sdk>/platforms/projects/cmake directory`` .
|
You could find the project demo in ``<sdk>/samples/simple_demo/project_cmake directory`` .
|
||||||
|
|
||||||
Preparation
|
Preparation
|
||||||
-----------
|
-----------
|
||||||
|
|
|
@ -5,7 +5,7 @@ How to use SDK with Visual Studio 2017
|
||||||
|
|
||||||
This tutorial will create a project with Visual Studio 2017 to start using SDK.
|
This tutorial will create a project with Visual Studio 2017 to start using SDK.
|
||||||
|
|
||||||
You could find the project demo in ``<sdk>/platforms/projects/vs2017`` directory.
|
You could find the project demo in ``<sdk>/samples/simple_demo/project_vs2017`` directory.
|
||||||
|
|
||||||
Preparation
|
Preparation
|
||||||
------------
|
------------
|
||||||
|
|
|
@ -242,4 +242,40 @@ if(WITH_API)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
## device_writer
|
||||||
|
|
||||||
|
add_library(device_writer STATIC device_writer.cc)
|
||||||
|
target_link_libraries(device_writer mynteye ${OpenCV_LIBS})
|
||||||
|
|
||||||
|
## device_info_writer
|
||||||
|
|
||||||
|
make_executable(write_device_info
|
||||||
|
SRCS write_device_info.cc
|
||||||
|
LINK_LIBS device_writer
|
||||||
|
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
## img_params_writer
|
||||||
|
|
||||||
|
make_executable(write_img_params
|
||||||
|
SRCS write_img_params.cc
|
||||||
|
LINK_LIBS device_writer
|
||||||
|
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
## imu_params_writer
|
||||||
|
|
||||||
|
make_executable(write_imu_params
|
||||||
|
SRCS write_imu_params.cc
|
||||||
|
LINK_LIBS device_writer
|
||||||
|
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
## save_all_infos
|
||||||
|
|
||||||
|
make_executable(save_all_infos
|
||||||
|
SRCS save_all_infos.cc
|
||||||
|
LINK_LIBS device_writer
|
||||||
|
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
41
samples/config/S1030/deprecated/img.params.old
Normal file
41
samples/config/S1030/deprecated/img.params.old
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
M1: !!opencv-matrix
|
||||||
|
rows: 3
|
||||||
|
cols: 3
|
||||||
|
dt: d
|
||||||
|
data: [ 7.3638305001095546e+02, 0., 3.5691961817119693e+02, 0.,
|
||||||
|
7.2350066150722432e+02, 2.1727271340923883e+02, 0., 0., 1. ]
|
||||||
|
D1: !!opencv-matrix
|
||||||
|
rows: 1
|
||||||
|
cols: 14
|
||||||
|
dt: d
|
||||||
|
data: [ -5.4898645145016478e-01, 5.2837141203888638e-01, 0., 0., 0.,
|
||||||
|
0., 0., 4.3563985766435476e-01, 0., 0., 0., 0., 0., 0. ]
|
||||||
|
M2: !!opencv-matrix
|
||||||
|
rows: 3
|
||||||
|
cols: 3
|
||||||
|
dt: d
|
||||||
|
data: [ 7.3638305001095546e+02, 0., 4.5668367112303980e+02, 0.,
|
||||||
|
7.2350066150722432e+02, 2.5070083335536796e+02, 0., 0., 1. ]
|
||||||
|
D2: !!opencv-matrix
|
||||||
|
rows: 1
|
||||||
|
cols: 14
|
||||||
|
dt: d
|
||||||
|
data: [ -5.1012886039889305e-01, 3.8764476500996770e-01, 0., 0., 0.,
|
||||||
|
0., 0., 2.5629798245273044e-01, 0., 0., 0., 0., 0., 0. ]
|
||||||
|
R: !!opencv-matrix
|
||||||
|
rows: 3
|
||||||
|
cols: 3
|
||||||
|
dt: d
|
||||||
|
data: [ 9.9701893306553813e-01, -9.5378124886236681e-04,
|
||||||
|
-7.7151392794850615e-02, 1.4493996762830500e-03,
|
||||||
|
9.9997867219985104e-01, 6.3682325649414354e-03,
|
||||||
|
7.7143673424555026e-02, -6.4610716411527686e-03,
|
||||||
|
9.9699905125522237e-01 ]
|
||||||
|
T: !!opencv-matrix
|
||||||
|
rows: 3
|
||||||
|
cols: 1
|
||||||
|
dt: d
|
||||||
|
data: [ -1.1888991734400047e+02, -4.5605803870530912e-02,
|
||||||
|
-3.9531373691193386e+00 ]
|
30
samples/config/S1030/deprecated/img.params.old2
Normal file
30
samples/config/S1030/deprecated/img.params.old2
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
in_left:
|
||||||
|
width: 752
|
||||||
|
height: 480
|
||||||
|
fx: 3.6220059643202876e+02
|
||||||
|
fy: 3.6350065250745848e+02
|
||||||
|
cx: 4.0658699068023441e+02
|
||||||
|
cy: 2.3435161110061483e+02
|
||||||
|
model: 0
|
||||||
|
coeffs: [ -2.5034765682756088e-01, 5.0579399202897619e-02,
|
||||||
|
-7.0536676161976066e-04, -8.5255451307033846e-03, 0. ]
|
||||||
|
in_right:
|
||||||
|
width: 752
|
||||||
|
height: 480
|
||||||
|
fx: 3.6514014888558478e+02
|
||||||
|
fy: 3.6513385298966961e+02
|
||||||
|
cx: 3.8932395100630907e+02
|
||||||
|
cy: 2.3495160212312547e+02
|
||||||
|
model: 0
|
||||||
|
coeffs: [ -3.0377346762098512e-01, 7.9929693673999838e-02,
|
||||||
|
5.1547517530716883e-05, -6.7345903740579250e-04, 0. ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9867908939669447e-01, -6.3445566137485428e-03,
|
||||||
|
5.0988459509619687e-02, 5.9890316389333252e-03,
|
||||||
|
9.9995670037792639e-01, 7.1224201868366971e-03,
|
||||||
|
-5.1031440326695092e-02, -6.8076406092671274e-03,
|
||||||
|
9.9867384471984544e-01 ]
|
||||||
|
translation: [ -1.2002489764113250e+02, -1.1782637409050747e+00,
|
||||||
|
-5.2058205159996538e+00 ]
|
33
samples/config/S1030/deprecated/img.params.old3
Normal file
33
samples/config/S1030/deprecated/img.params.old3
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
version: "1.0"
|
||||||
|
img_params_map:
|
||||||
|
-
|
||||||
|
in_left:
|
||||||
|
width: 752
|
||||||
|
height: 480
|
||||||
|
fx: 3.6220059643202876e+02
|
||||||
|
fy: 3.6350065250745848e+02
|
||||||
|
cx: 4.0658699068023441e+02
|
||||||
|
cy: 2.3435161110061483e+02
|
||||||
|
model: 0
|
||||||
|
coeffs: [ -2.5034765682756088e-01, 5.0579399202897619e-02,
|
||||||
|
-7.0536676161976066e-04, -8.5255451307033846e-03, 0. ]
|
||||||
|
in_right:
|
||||||
|
width: 752
|
||||||
|
height: 480
|
||||||
|
fx: 3.6514014888558478e+02
|
||||||
|
fy: 3.6513385298966961e+02
|
||||||
|
cx: 3.8932395100630907e+02
|
||||||
|
cy: 2.3495160212312547e+02
|
||||||
|
model: 0
|
||||||
|
coeffs: [ -3.0377346762098512e-01, 7.9929693673999838e-02,
|
||||||
|
5.1547517530716883e-05, -6.7345903740579250e-04, 0. ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9867908939669447e-01, -6.3445566137485428e-03,
|
||||||
|
5.0988459509619687e-02, 5.9890316389333252e-03,
|
||||||
|
9.9995670037792639e-01, 7.1224201868366971e-03,
|
||||||
|
-5.1031440326695092e-02, -6.8076406092671274e-03,
|
||||||
|
9.9867384471984544e-01 ]
|
||||||
|
translation: [ -1.2002489764113250e+02, -1.1782637409050747e+00,
|
||||||
|
-5.2058205159996538e+00 ]
|
24
samples/config/S1030/deprecated/imu.params.old
Normal file
24
samples/config/S1030/deprecated/imu.params.old
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
in_accel:
|
||||||
|
scale: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||||
|
drift: [ 0., 0., 0. ]
|
||||||
|
noise: [ 1.6925432397973516e-02, 1.6735310195561025e-02,
|
||||||
|
1.7452487504590969e-02 ]
|
||||||
|
bias: [ 1.9031356589714596e-04, 1.6996777864587261e-04,
|
||||||
|
5.4490537096493644e-04 ]
|
||||||
|
in_gyro:
|
||||||
|
scale: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||||
|
drift: [ 0., 0., 0. ]
|
||||||
|
noise: [ 1.0848026158819934e-03, 1.2466367883501759e-03,
|
||||||
|
1.1003229919806443e-03 ]
|
||||||
|
bias: [ 2.3404834136742844e-05, 2.3596771567764949e-05,
|
||||||
|
1.4970418056326829e-05 ]
|
||||||
|
ex_left_to_imu:
|
||||||
|
rotation: [ -6.4662000000000001e-03, -9.9994994000000004e-01,
|
||||||
|
-7.6356499999999999e-03, 9.9997908999999996e-01,
|
||||||
|
-6.4656599999999998e-03, -9.5580000000000003e-05,
|
||||||
|
4.6199999999999998e-05, -7.6361099999999998e-03,
|
||||||
|
9.9997084000000003e-01 ]
|
||||||
|
translation: [ 5.3364600000000003e-03, -4.3029220000000000e-02,
|
||||||
|
2.3031240000000001e-02 ]
|
10
samples/config/S1030/device.info
Normal file
10
samples/config/S1030/device.info
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
device_name: MYNT-EYE-S1030
|
||||||
|
serial_number: "02811F3B00090807"
|
||||||
|
firmware_version: "2.2"
|
||||||
|
hardware_version: "2.0"
|
||||||
|
spec_version: "1.0"
|
||||||
|
lens_type: "0000"
|
||||||
|
imu_type: "0000"
|
||||||
|
nominal_baseline: 120
|
28
samples/config/S1030/img.params.equidistant
Normal file
28
samples/config/S1030/img.params.equidistant
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
version: "1.2"
|
||||||
|
img_params:
|
||||||
|
-
|
||||||
|
model: 1
|
||||||
|
width: 752
|
||||||
|
height: 480
|
||||||
|
in_left:
|
||||||
|
# coeffs: k2,k3,k4,k5,mu,mv,u0,v0
|
||||||
|
coeffs: [ -1.3549950401924169e-02, -3.2306077263853893e-02,
|
||||||
|
5.3814579203036512e-02, -3.6663721418756977e-02,
|
||||||
|
3.6797709792391299e+02, 3.6808712539453859e+02,
|
||||||
|
3.7414963027144353e+02, 2.3125000326472903e+02 ]
|
||||||
|
in_right:
|
||||||
|
# coeffs: k2,k3,k4,k5,mu,mv,u0,v0
|
||||||
|
coeffs: [ -1.8964880945048872e-02, -2.6172447729615463e-02,
|
||||||
|
4.0863326732708288e-02, -2.1522718578606163e-02,
|
||||||
|
3.6807315003638877e+02, 3.6806204885853174e+02,
|
||||||
|
3.8499216569965887e+02, 2.3183027347834383e+02 ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9867908939669447e-01, -6.3445566137485428e-03,
|
||||||
|
5.0988459509619687e-02, 5.9890316389333252e-03,
|
||||||
|
9.9995670037792639e-01, 7.1224201868366971e-03,
|
||||||
|
-5.1031440326695092e-02, -6.8076406092671274e-03,
|
||||||
|
9.9867384471984544e-01 ]
|
||||||
|
translation: [ -1.2002489764113250e+02, -1.1782637409050747e+00,
|
||||||
|
-5.2058205159996538e+00 ]
|
38
samples/config/S1030/img.params.pinhole
Normal file
38
samples/config/S1030/img.params.pinhole
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
version: "1.2"
|
||||||
|
img_params:
|
||||||
|
-
|
||||||
|
model: 0
|
||||||
|
width: 752
|
||||||
|
height: 480
|
||||||
|
in_left:
|
||||||
|
# [fx 0 cx]
|
||||||
|
# [ 0 fy cy]
|
||||||
|
# [ 0 0 1]
|
||||||
|
fx: 3.6220059643202876e+02
|
||||||
|
fy: 3.6350065250745848e+02
|
||||||
|
cx: 4.0658699068023441e+02
|
||||||
|
cy: 2.3435161110061483e+02
|
||||||
|
# coeffs: k1,k2,p1,p2,k3
|
||||||
|
coeffs: [ -2.5034765682756088e-01, 5.0579399202897619e-02,
|
||||||
|
-7.0536676161976066e-04, -8.5255451307033846e-03, 0. ]
|
||||||
|
in_right:
|
||||||
|
# [fx 0 cx]
|
||||||
|
# [ 0 fy cy]
|
||||||
|
# [ 0 0 1]
|
||||||
|
fx: 3.6514014888558478e+02
|
||||||
|
fy: 3.6513385298966961e+02
|
||||||
|
cx: 3.8932395100630907e+02
|
||||||
|
cy: 2.3495160212312547e+02
|
||||||
|
# coeffs: k1,k2,p1,p2,k3
|
||||||
|
coeffs: [ -3.0377346762098512e-01, 7.9929693673999838e-02,
|
||||||
|
5.1547517530716883e-05, -6.7345903740579250e-04, 0. ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9867908939669447e-01, -6.3445566137485428e-03,
|
||||||
|
5.0988459509619687e-02, 5.9890316389333252e-03,
|
||||||
|
9.9995670037792639e-01, 7.1224201868366971e-03,
|
||||||
|
-5.1031440326695092e-02, -6.8076406092671274e-03,
|
||||||
|
9.9867384471984544e-01 ]
|
||||||
|
translation: [ -1.2002489764113250e+02, -1.1782637409050747e+00,
|
||||||
|
-5.2058205159996538e+00 ]
|
33
samples/config/S1030/imu.params
Normal file
33
samples/config/S1030/imu.params
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
version: "1.2"
|
||||||
|
in_accel:
|
||||||
|
scale: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||||
|
assembly: [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
|
||||||
|
drift: [ 0., 0., 0. ]
|
||||||
|
noise: [ 1.6925432397973516e-02, 1.6735310195561025e-02,
|
||||||
|
1.7452487504590969e-02 ]
|
||||||
|
bias: [ 1.9031356589714596e-04, 1.6996777864587261e-04,
|
||||||
|
5.4490537096493644e-04 ]
|
||||||
|
x: [ 0.0, 0.0 ]
|
||||||
|
y: [ 0.0, 0.0 ]
|
||||||
|
z: [ 0.0, 0.0 ]
|
||||||
|
in_gyro:
|
||||||
|
scale: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||||
|
assembly: [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
|
||||||
|
drift: [ 0., 0., 0. ]
|
||||||
|
noise: [ 1.0848026158819934e-03, 1.2466367883501759e-03,
|
||||||
|
1.1003229919806443e-03 ]
|
||||||
|
bias: [ 2.3404834136742844e-05, 2.3596771567764949e-05,
|
||||||
|
1.4970418056326829e-05 ]
|
||||||
|
x: [ 0.0, 0.0 ]
|
||||||
|
y: [ 0.0, 0.0 ]
|
||||||
|
z: [ 0.0, 0.0 ]
|
||||||
|
ex_left_to_imu:
|
||||||
|
rotation: [ -6.4662000000000001e-03, -9.9994994000000004e-01,
|
||||||
|
-7.6356499999999999e-03, 9.9997908999999996e-01,
|
||||||
|
-6.4656599999999998e-03, -9.5580000000000003e-05,
|
||||||
|
4.6199999999999998e-05, -7.6361099999999998e-03,
|
||||||
|
9.9997084000000003e-01 ]
|
||||||
|
translation: [ 5.3364600000000003e-03, -4.3029220000000000e-02,
|
||||||
|
2.3031240000000001e-02 ]
|
62
samples/config/S210A/deprecated/img.params.old
Normal file
62
samples/config/S210A/deprecated/img.params.old
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
version: "1.1"
|
||||||
|
img_params_map:
|
||||||
|
-
|
||||||
|
in_left:
|
||||||
|
width: 640
|
||||||
|
height: 400
|
||||||
|
fx: 1.9739641213416058e+02
|
||||||
|
fy: 1.9772337597617189e+02
|
||||||
|
cx: 3.2611983633916327e+02
|
||||||
|
cy: 1.9986969132833946e+02
|
||||||
|
model: 0
|
||||||
|
coeffs: [ 1.2135236310725651e-01, -8.5442776049177036e-02,
|
||||||
|
2.4914898631983504e-03, -3.7752063658256863e-03, 0. ]
|
||||||
|
in_right:
|
||||||
|
width: 640
|
||||||
|
height: 400
|
||||||
|
fx: 2.0335498653655989e+02
|
||||||
|
fy: 2.0453858622699008e+02
|
||||||
|
cx: 3.1589962248180814e+02
|
||||||
|
cy: 2.1871688038954812e+02
|
||||||
|
model: 0
|
||||||
|
coeffs: [ 2.2904330559241560e-02, -2.9561990079971841e-02,
|
||||||
|
3.9725942760981507e-03, -3.9689073214945591e-03, 0. ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9998850083695123e-01, -1.9263678722299450e-03,
|
||||||
|
-4.3917309443490191e-03, 1.8166060642710027e-03,
|
||||||
|
9.9968925981619028e-01, -2.4861290203142431e-02,
|
||||||
|
4.4382582477776426e-03, 2.4853026274046636e-02,
|
||||||
|
9.9968126367795229e-01 ]
|
||||||
|
translation: [ -8.2270200890555529e+01, -1.9535144360069059e+00,
|
||||||
|
2.2588034344482368e+00 ]
|
||||||
|
-
|
||||||
|
in_left:
|
||||||
|
width: 1280
|
||||||
|
height: 800
|
||||||
|
fx: 1.9739641213416058e+02
|
||||||
|
fy: 1.9772337597617189e+02
|
||||||
|
cx: 3.2611983633916327e+02
|
||||||
|
cy: 1.9986969132833946e+02
|
||||||
|
model: 0
|
||||||
|
coeffs: [ 1.2135236310725651e-01, -8.5442776049177036e-02,
|
||||||
|
2.4914898631983504e-03, -3.7752063658256863e-03, 0. ]
|
||||||
|
in_right:
|
||||||
|
width: 1280
|
||||||
|
height: 800
|
||||||
|
fx: 2.0335498653655989e+02
|
||||||
|
fy: 2.0453858622699008e+02
|
||||||
|
cx: 3.1589962248180814e+02
|
||||||
|
cy: 2.1871688038954812e+02
|
||||||
|
model: 0
|
||||||
|
coeffs: [ 2.2904330559241560e-02, -2.9561990079971841e-02,
|
||||||
|
3.9725942760981507e-03, -3.9689073214945591e-03, 0. ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9998850083695123e-01, -1.9263678722299450e-03,
|
||||||
|
-4.3917309443490191e-03, 1.8166060642710027e-03,
|
||||||
|
9.9968925981619028e-01, -2.4861290203142431e-02,
|
||||||
|
4.4382582477776426e-03, 2.4853026274046636e-02,
|
||||||
|
9.9968126367795229e-01 ]
|
||||||
|
translation: [ -8.2270200890555529e+01, -1.9535144360069059e+00,
|
||||||
|
2.2588034344482368e+00 ]
|
15
samples/config/S210A/deprecated/imu.params.old
Normal file
15
samples/config/S210A/deprecated/imu.params.old
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
in_accel:
|
||||||
|
scale: [ 0., 0., 0., 0., 0., 0., 0., 0., 0. ]
|
||||||
|
drift: [ 0., 0., 0. ]
|
||||||
|
noise: [ 0., 0., 0. ]
|
||||||
|
bias: [ 0., 0., 0. ]
|
||||||
|
in_gyro:
|
||||||
|
scale: [ 0., 0., 0., 0., 0., 0., 0., 0., 0. ]
|
||||||
|
drift: [ 0., 0., 0. ]
|
||||||
|
noise: [ 0., 0., 0. ]
|
||||||
|
bias: [ 0., 0., 0. ]
|
||||||
|
ex_left_to_imu:
|
||||||
|
rotation: [ 0., 0., 0., 0., 0., 0., 0., 0., 0. ]
|
||||||
|
translation: [ 0., 0., 0. ]
|
12
samples/config/S210A/device.info
Normal file
12
samples/config/S210A/device.info
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
device_name: MYNT-EYE-S210A
|
||||||
|
serial_number: "07C40D1C0009071F"
|
||||||
|
firmware_version: "1.1"
|
||||||
|
hardware_version: "1.0"
|
||||||
|
spec_version: "1.2"
|
||||||
|
lens_type: "0001"
|
||||||
|
imu_type: "0001"
|
||||||
|
nominal_baseline: 80
|
||||||
|
auxiliary_chip_version: "1.0"
|
||||||
|
isp_version: "1.0"
|
51
samples/config/S210A/img.params.equidistant
Normal file
51
samples/config/S210A/img.params.equidistant
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
version: "1.2"
|
||||||
|
img_params:
|
||||||
|
# There are two params of resolution [640x400], [1280x800].
|
||||||
|
# If you only set one of them, write will keep another params if it exists.
|
||||||
|
-
|
||||||
|
model: 1
|
||||||
|
width: 640
|
||||||
|
height: 400
|
||||||
|
in_left:
|
||||||
|
# coeffs: k2,k3,k4,k5,mu,mv,u0,v0
|
||||||
|
coeffs: [ -1.3549950401924169e-02, -3.2306077263853893e-02,
|
||||||
|
5.3814579203036512e-02, -3.6663721418756977e-02,
|
||||||
|
3.6797709792391299e+02, 3.6808712539453859e+02,
|
||||||
|
3.7414963027144353e+02, 2.3125000326472903e+02 ]
|
||||||
|
in_right:
|
||||||
|
coeffs: [ -1.8964880945048872e-02, -2.6172447729615463e-02,
|
||||||
|
4.0863326732708288e-02, -2.1522718578606163e-02,
|
||||||
|
3.6807315003638877e+02, 3.6806204885853174e+02,
|
||||||
|
3.8499216569965887e+02, 2.3183027347834383e+02 ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9998850083695123e-01, -1.9263678722299450e-03,
|
||||||
|
-4.3917309443490191e-03, 1.8166060642710027e-03,
|
||||||
|
9.9968925981619028e-01, -2.4861290203142431e-02,
|
||||||
|
4.4382582477776426e-03, 2.4853026274046636e-02,
|
||||||
|
9.9968126367795229e-01 ]
|
||||||
|
translation: [ -8.2270200890555529e+01, -1.9535144360069059e+00,
|
||||||
|
2.2588034344482368e+00 ]
|
||||||
|
-
|
||||||
|
model: 1
|
||||||
|
width: 1280
|
||||||
|
height: 800
|
||||||
|
in_left:
|
||||||
|
coeffs: [ -1.3549950401924169e-02, -3.2306077263853893e-02,
|
||||||
|
5.3814579203036512e-02, -3.6663721418756977e-02,
|
||||||
|
3.6797709792391299e+02, 3.6808712539453859e+02,
|
||||||
|
3.7414963027144353e+02, 2.3125000326472903e+02 ]
|
||||||
|
in_right:
|
||||||
|
coeffs: [ -1.3549950401924169e-02, -3.2306077263853893e-02,
|
||||||
|
5.3814579203036512e-02, -3.6663721418756977e-02,
|
||||||
|
3.6797709792391299e+02, 3.6808712539453859e+02,
|
||||||
|
3.7414963027144353e+02, 2.3125000326472903e+02 ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9998850083695123e-01, -1.9263678722299450e-03,
|
||||||
|
-4.3917309443490191e-03, 1.8166060642710027e-03,
|
||||||
|
9.9968925981619028e-01, -2.4861290203142431e-02,
|
||||||
|
4.4382582477776426e-03, 2.4853026274046636e-02,
|
||||||
|
9.9968126367795229e-01 ]
|
||||||
|
translation: [ -8.2270200890555529e+01, -1.9535144360069059e+00,
|
||||||
|
2.2588034344482368e+00 ]
|
62
samples/config/S210A/img.params.pinhole
Normal file
62
samples/config/S210A/img.params.pinhole
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
version: "1.2"
|
||||||
|
img_params:
|
||||||
|
# There are two params of resolution [640x400], [1280x800].
|
||||||
|
# If you only set one of them, write will keep another params if it exists.
|
||||||
|
-
|
||||||
|
model: 0
|
||||||
|
width: 640
|
||||||
|
height: 400
|
||||||
|
in_left:
|
||||||
|
# [fx 0 cx]
|
||||||
|
# [ 0 fy cy]
|
||||||
|
# [ 0 0 1]
|
||||||
|
fx: 1.9739641213416058e+02
|
||||||
|
fy: 1.9772337597617189e+02
|
||||||
|
cx: 3.2611983633916327e+02
|
||||||
|
cy: 1.9986969132833946e+02
|
||||||
|
# coeffs: k1,k2,p1,p2,k3
|
||||||
|
coeffs: [ 1.2135236310725651e-01, -8.5442776049177036e-02,
|
||||||
|
2.4914898631983504e-03, -3.7752063658256863e-03, 0. ]
|
||||||
|
in_right:
|
||||||
|
fx: 2.0335498653655989e+02
|
||||||
|
fy: 2.0453858622699008e+02
|
||||||
|
cx: 3.1589962248180814e+02
|
||||||
|
cy: 2.1871688038954812e+02
|
||||||
|
coeffs: [ 2.2904330559241560e-02, -2.9561990079971841e-02,
|
||||||
|
3.9725942760981507e-03, -3.9689073214945591e-03, 0. ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9998850083695123e-01, -1.9263678722299450e-03,
|
||||||
|
-4.3917309443490191e-03, 1.8166060642710027e-03,
|
||||||
|
9.9968925981619028e-01, -2.4861290203142431e-02,
|
||||||
|
4.4382582477776426e-03, 2.4853026274046636e-02,
|
||||||
|
9.9968126367795229e-01 ]
|
||||||
|
translation: [ -8.2270200890555529e+01, -1.9535144360069059e+00,
|
||||||
|
2.2588034344482368e+00 ]
|
||||||
|
-
|
||||||
|
model: 0
|
||||||
|
width: 1280
|
||||||
|
height: 800
|
||||||
|
in_left:
|
||||||
|
fx: 1.9739641213416058e+02
|
||||||
|
fy: 1.9772337597617189e+02
|
||||||
|
cx: 3.2611983633916327e+02
|
||||||
|
cy: 1.9986969132833946e+02
|
||||||
|
coeffs: [ 1.2135236310725651e-01, -8.5442776049177036e-02,
|
||||||
|
2.4914898631983504e-03, -3.7752063658256863e-03, 0. ]
|
||||||
|
in_right:
|
||||||
|
fx: 2.0335498653655989e+02
|
||||||
|
fy: 2.0453858622699008e+02
|
||||||
|
cx: 3.1589962248180814e+02
|
||||||
|
cy: 2.1871688038954812e+02
|
||||||
|
coeffs: [ 2.2904330559241560e-02, -2.9561990079971841e-02,
|
||||||
|
3.9725942760981507e-03, -3.9689073214945591e-03, 0. ]
|
||||||
|
ex_right_to_left:
|
||||||
|
rotation: [ 9.9998850083695123e-01, -1.9263678722299450e-03,
|
||||||
|
-4.3917309443490191e-03, 1.8166060642710027e-03,
|
||||||
|
9.9968925981619028e-01, -2.4861290203142431e-02,
|
||||||
|
4.4382582477776426e-03, 2.4853026274046636e-02,
|
||||||
|
9.9968126367795229e-01 ]
|
||||||
|
translation: [ -8.2270200890555529e+01, -1.9535144360069059e+00,
|
||||||
|
2.2588034344482368e+00 ]
|
33
samples/config/S210A/imu.params
Normal file
33
samples/config/S210A/imu.params
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
%YAML:1.0
|
||||||
|
---
|
||||||
|
version: "1.2"
|
||||||
|
in_accel:
|
||||||
|
scale: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||||
|
assembly: [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
|
||||||
|
drift: [ 0., 0., 0. ]
|
||||||
|
noise: [ 1.6925432397973516e-02, 1.6735310195561025e-02,
|
||||||
|
1.7452487504590969e-02 ]
|
||||||
|
bias: [ 1.9031356589714596e-04, 1.6996777864587261e-04,
|
||||||
|
5.4490537096493644e-04 ]
|
||||||
|
x: [ 0.0, 0.0 ]
|
||||||
|
y: [ 0.0, 0.0 ]
|
||||||
|
z: [ 0.0, 0.0 ]
|
||||||
|
in_gyro:
|
||||||
|
scale: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||||
|
assembly: [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
|
||||||
|
drift: [ 0., 0., 0. ]
|
||||||
|
noise: [ 1.0848026158819934e-03, 1.2466367883501759e-03,
|
||||||
|
1.1003229919806443e-03 ]
|
||||||
|
bias: [ 2.3404834136742844e-05, 2.3596771567764949e-05,
|
||||||
|
1.4970418056326829e-05 ]
|
||||||
|
x: [ 0.0, 0.0 ]
|
||||||
|
y: [ 0.0, 0.0 ]
|
||||||
|
z: [ 0.0, 0.0 ]
|
||||||
|
ex_left_to_imu:
|
||||||
|
rotation: [ -6.4662000000000001e-03, -9.9994994000000004e-01,
|
||||||
|
-7.6356499999999999e-03, 9.9997908999999996e-01,
|
||||||
|
-6.4656599999999998e-03, -9.5580000000000003e-05,
|
||||||
|
4.6199999999999998e-05, -7.6361099999999998e-03,
|
||||||
|
9.9997084000000003e-01 ]
|
||||||
|
translation: [ 5.3364600000000003e-03, -4.3029220000000000e-02,
|
||||||
|
2.3031240000000001e-02 ]
|
590
samples/device_writer.cc
Normal file
590
samples/device_writer.cc
Normal file
|
@ -0,0 +1,590 @@
|
||||||
|
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
#include "device_writer.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <opencv2/core/core.hpp>
|
||||||
|
|
||||||
|
#include "mynteye/logger.h"
|
||||||
|
#include "mynteye/util/files.h"
|
||||||
|
|
||||||
|
#define SAVE_LATEST_VERSION Version(1, 2)
|
||||||
|
|
||||||
|
MYNTEYE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
namespace tools {
|
||||||
|
|
||||||
|
DeviceWriter::DeviceWriter(std::shared_ptr<Device> device) : device_(device) {
|
||||||
|
VLOG(2) << __func__;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceWriter::~DeviceWriter() {
|
||||||
|
VLOG(2) << __func__;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceWriter::WriteDeviceInfo(const dev_info_t &info) {
|
||||||
|
// Update device info
|
||||||
|
auto &&dev_info = device_->GetInfo();
|
||||||
|
dev_info->lens_type = Type(info.lens_type);
|
||||||
|
dev_info->imu_type = Type(info.imu_type);
|
||||||
|
dev_info->nominal_baseline = info.nominal_baseline;
|
||||||
|
|
||||||
|
if (device_->SetFiles(dev_info.get(), nullptr, nullptr)) {
|
||||||
|
LOG(INFO) << "Write device info success";
|
||||||
|
LOG(INFO) << "Device info: {name: " << dev_info->name
|
||||||
|
<< ", serial_number: " << dev_info->serial_number
|
||||||
|
<< ", firmware_version: "
|
||||||
|
<< dev_info->firmware_version.to_string()
|
||||||
|
<< ", hardware_version: "
|
||||||
|
<< dev_info->hardware_version.to_string()
|
||||||
|
<< ", spec_version: " << dev_info->spec_version.to_string()
|
||||||
|
<< ", lens_type: " << dev_info->lens_type.to_string()
|
||||||
|
<< ", imu_type: " << dev_info->imu_type.to_string()
|
||||||
|
<< ", nominal_baseline: " << dev_info->nominal_baseline
|
||||||
|
<< ", auxiliary_chip_version: "
|
||||||
|
<< dev_info->auxiliary_chip_version.to_string()
|
||||||
|
<< ", isp_version: "
|
||||||
|
<< dev_info->isp_version.to_string()<< "}";
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Write device info failed";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceWriter::WriteDeviceInfo(const std::string &filepath) {
|
||||||
|
return WriteDeviceInfo(LoadDeviceInfo(filepath));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceWriter::WriteImgParams(const img_params_map_t &img_params_map) {
|
||||||
|
img_params_map_t *img_params_new =
|
||||||
|
const_cast<img_params_map_t *>(&img_params_map);
|
||||||
|
// Update image params with raw
|
||||||
|
auto &&img_params_raw = device_->GetImgParams();
|
||||||
|
for (auto entry_raw : img_params_raw) {
|
||||||
|
// Add raw params if not load this resolution
|
||||||
|
if (img_params_new->find(entry_raw.first) == img_params_new->end()) {
|
||||||
|
(*img_params_new)[entry_raw.first] = entry_raw.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (device_->SetFiles(nullptr, img_params_new, nullptr)) {
|
||||||
|
LOG(INFO) << "Write img params success";
|
||||||
|
for (auto it = img_params_new->begin(); it != img_params_new->end(); it++) {
|
||||||
|
LOG(INFO) << "Resolution: {width: " << (*it).first.width
|
||||||
|
<< ", height: " << (*it).first.height << "}";
|
||||||
|
LOG(INFO) << "Intrinsics left: {" << *(*it).second.in_left << "}";
|
||||||
|
LOG(INFO) << "Intrinsics right: {" << *(*it).second.in_right << "}";
|
||||||
|
LOG(INFO) << "Extrinsics right to left: {"
|
||||||
|
<< (*it).second.ex_right_to_left << "}";
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Write img params failed";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceWriter::WriteImgParams(const std::string &filepath) {
|
||||||
|
return WriteImgParams(LoadImgParams(filepath));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceWriter::WriteImuParams(const imu_params_t ¶ms) {
|
||||||
|
if (device_->SetFiles(
|
||||||
|
nullptr, nullptr, const_cast<imu_params_t *>(¶ms))) {
|
||||||
|
LOG(INFO) << "Write imu params success";
|
||||||
|
LOG(INFO) << "Imu intrinsics accel: {" << params.in_accel << "}";
|
||||||
|
LOG(INFO) << "Imu intrinsics gyro: {" << params.in_gyro << "}";
|
||||||
|
LOG(INFO) << "Imu extrinsics left to imu: {" << params.ex_left_to_imu
|
||||||
|
<< "}";
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Write imu params failed";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceWriter::WriteImuParams(const std::string &filepath) {
|
||||||
|
return WriteImuParams(LoadImuParams(filepath));
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
cv::FileStorage &operator<<(cv::FileStorage &fs, const IntrinsicsPinhole &in) {
|
||||||
|
fs << "{"
|
||||||
|
<< "fx" << in.fx << "fy" << in.fy
|
||||||
|
<< "cx" << in.cx << "cy" << in.cy
|
||||||
|
<< "coeffs" << std::vector<double>(in.coeffs, in.coeffs + 5) << "}";
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::FileStorage &operator<<(cv::FileStorage &fs,
|
||||||
|
const IntrinsicsEquidistant &in) {
|
||||||
|
fs << "{"
|
||||||
|
<< "coeffs" << std::vector<double>(in.coeffs, in.coeffs + 8) << "}";
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::FileStorage &operator<<(cv::FileStorage &fs,
|
||||||
|
const std::shared_ptr<IntrinsicsBase> &in) {
|
||||||
|
switch (in->calib_model()) {
|
||||||
|
case CalibrationModel::PINHOLE:
|
||||||
|
return fs << *std::dynamic_pointer_cast<IntrinsicsPinhole>(in);
|
||||||
|
case CalibrationModel::KANNALA_BRANDT:
|
||||||
|
return fs << *std::dynamic_pointer_cast<IntrinsicsEquidistant>(in);
|
||||||
|
default:
|
||||||
|
LOG(FATAL) << "Unknown calib model: " << in->calib_model();
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::FileStorage &operator<<(cv::FileStorage &fs, const ImuIntrinsics &in) {
|
||||||
|
std::vector<double> scales;
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
for (std::size_t j = 0; j < 3; j++) {
|
||||||
|
scales.push_back(in.scale[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::vector<double> assembly;
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
for (std::size_t j = 0; j < 3; j++) {
|
||||||
|
assembly.push_back(in.assembly[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs << "{"
|
||||||
|
<< "scale" << scales << "assembly" << assembly << "drift"
|
||||||
|
<< std::vector<double>(in.drift, in.drift + 3) << "noise"
|
||||||
|
<< std::vector<double>(in.noise, in.noise + 3) << "bias"
|
||||||
|
<< std::vector<double>(in.bias, in.bias + 3) << "x"
|
||||||
|
<< std::vector<double>(in.x, in.x + 2) << "y"
|
||||||
|
<< std::vector<double>(in.y, in.y + 2) << "z"
|
||||||
|
<< std::vector<double>(in.z, in.z + 2) << "}";
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::FileStorage &operator<<(cv::FileStorage &fs, const Extrinsics &ex) {
|
||||||
|
std::vector<double> rotations;
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
for (std::size_t j = 0; j < 3; j++) {
|
||||||
|
rotations.push_back(ex.rotation[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs << "{"
|
||||||
|
<< "rotation" << rotations << "translation"
|
||||||
|
<< std::vector<double>(ex.translation, ex.translation + 3) << "}";
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::FileStorage &operator<<(
|
||||||
|
cv::FileStorage &fs, const device::img_params_t ¶ms) {
|
||||||
|
fs << "{"
|
||||||
|
<< "model" << static_cast<std::uint8_t>(params.in_left->calib_model())
|
||||||
|
<< "width" << params.in_left->width
|
||||||
|
<< "height" << params.in_left->height
|
||||||
|
<< "in_left" << params.in_left
|
||||||
|
<< "in_right" << params.in_right
|
||||||
|
<< "ex_right_to_left" << params.ex_right_to_left << "}";
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::FileStorage &operator<<(
|
||||||
|
cv::FileStorage &fs, const DeviceWriter::img_params_map_t &img_params_map) {
|
||||||
|
fs << "[";
|
||||||
|
std::map<Resolution, device::img_params_t>::const_iterator it;
|
||||||
|
for (it = img_params_map.begin(); it != img_params_map.end(); it++) {
|
||||||
|
fs << (*it).second;
|
||||||
|
}
|
||||||
|
fs << "]";
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
bool DeviceWriter::SaveDeviceInfo(
|
||||||
|
const dev_info_t &info, const std::string &filepath) {
|
||||||
|
using FileStorage = cv::FileStorage;
|
||||||
|
FileStorage fs(filepath, FileStorage::WRITE);
|
||||||
|
if (!fs.isOpened()) {
|
||||||
|
LOG(ERROR) << "Failed to save file: " << filepath;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
fs << "device_name" << info.name;
|
||||||
|
fs << "serial_number" << info.serial_number;
|
||||||
|
fs << "firmware_version" << info.firmware_version.to_string();
|
||||||
|
fs << "hardware_version" << info.hardware_version.to_string();
|
||||||
|
fs << "spec_version" << info.spec_version.to_string();
|
||||||
|
fs << "lens_type" << info.lens_type.to_string();
|
||||||
|
fs << "imu_type" << info.imu_type.to_string();
|
||||||
|
fs << "nominal_baseline" << info.nominal_baseline;
|
||||||
|
fs << "auxiliary_chip_version" << info.auxiliary_chip_version.to_string();
|
||||||
|
fs << "isp_version" << info.isp_version.to_string();
|
||||||
|
// save other infos according to spec_version
|
||||||
|
fs.release();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceWriter::SaveImgParams(
|
||||||
|
const img_params_map_t &img_params_map,
|
||||||
|
const std::string &filepath) {
|
||||||
|
if (img_params_map.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::string version = img_params_map.begin()->second.version;
|
||||||
|
if (Version(version) > SAVE_LATEST_VERSION) {
|
||||||
|
LOG(ERROR) << "Failed to save img params of version " << version
|
||||||
|
<< ", please use latest SDK.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// always save img params with latest version format
|
||||||
|
using FileStorage = cv::FileStorage;
|
||||||
|
FileStorage fs(filepath, FileStorage::WRITE);
|
||||||
|
if (!fs.isOpened()) {
|
||||||
|
LOG(ERROR) << "Failed to save file: " << filepath;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
fs << "version" << SAVE_LATEST_VERSION.to_string()
|
||||||
|
<< "img_params" << img_params_map;
|
||||||
|
fs.release();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceWriter::SaveImuParams(
|
||||||
|
const imu_params_t ¶ms, const std::string &filepath) {
|
||||||
|
if (!params.ok) return false;
|
||||||
|
std::string version = params.version;
|
||||||
|
if (Version(version) > SAVE_LATEST_VERSION) {
|
||||||
|
LOG(ERROR) << "Failed to save imu params of version " << version
|
||||||
|
<< ", please use latest SDK.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// always save imu params with latest version format
|
||||||
|
using FileStorage = cv::FileStorage;
|
||||||
|
FileStorage fs(filepath, FileStorage::WRITE);
|
||||||
|
if (!fs.isOpened()) {
|
||||||
|
LOG(ERROR) << "Failed to save file: " << filepath;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
fs << "version" << SAVE_LATEST_VERSION.to_string()
|
||||||
|
<< "in_accel" << params.in_accel
|
||||||
|
<< "in_gyro" << params.in_gyro
|
||||||
|
<< "ex_left_to_imu" << params.ex_left_to_imu;
|
||||||
|
fs.release();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceWriter::SaveAllInfos(const std::string &dir) {
|
||||||
|
if (!files::mkdir(dir)) {
|
||||||
|
LOG(FATAL) << "Create directory failed: " << dir;
|
||||||
|
}
|
||||||
|
SaveDeviceInfo(*device_->GetInfo(), dir + MYNTEYE_OS_SEP "device.info");
|
||||||
|
SaveImgParams(device_->GetImgParams(), dir + MYNTEYE_OS_SEP "img.params");
|
||||||
|
SaveImuParams(device_->GetImuParams(), dir + MYNTEYE_OS_SEP "imu.params");
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// old
|
||||||
|
void to_intrinsics(
|
||||||
|
const std::uint16_t &width, const std::uint16_t &height,
|
||||||
|
const std::uint8_t &model, const cv::Mat &M, const cv::Mat &D,
|
||||||
|
IntrinsicsPinhole *in) {
|
||||||
|
in->width = width;
|
||||||
|
in->height = height;
|
||||||
|
/*
|
||||||
|
fx, 0, cx,
|
||||||
|
0, fy, cy,
|
||||||
|
0, 0, 1
|
||||||
|
*/
|
||||||
|
in->fx = M.at<double>(0, 0);
|
||||||
|
in->fy = M.at<double>(1, 1);
|
||||||
|
in->cx = M.at<double>(0, 2);
|
||||||
|
in->cy = M.at<double>(1, 2);
|
||||||
|
/* k1, k2, p1, p2, k3 */
|
||||||
|
in->model = model;
|
||||||
|
LOG_IF(FATAL, D.cols < 5) << "Distortion coefficients must >= 5 columns";
|
||||||
|
for (std::size_t i = 0; i < 5; i++) {
|
||||||
|
in->coeffs[i] = D.at<double>(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// old
|
||||||
|
void to_extrinsics(const cv::Mat &R, const cv::Mat &T, Extrinsics *ex) {
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
for (std::size_t j = 0; j < 3; j++) {
|
||||||
|
ex->rotation[i][j] = R.at<double>(i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
ex->translation[i] = T.at<double>(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// old
|
||||||
|
void operator>>(const cv::FileNode &n, IntrinsicsPinhole &in) {
|
||||||
|
n["width"] >> in.width;
|
||||||
|
n["height"] >> in.height;
|
||||||
|
n["fx"] >> in.fx;
|
||||||
|
n["fy"] >> in.fy;
|
||||||
|
n["cx"] >> in.cx;
|
||||||
|
n["cy"] >> in.cy;
|
||||||
|
n["model"] >> in.model;
|
||||||
|
for (std::size_t i = 0; i < 5; i++) {
|
||||||
|
in.coeffs[i] = n["coeffs"][i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator>>(const cv::FileNode &n, ImuIntrinsics &in) {
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
for (std::size_t j = 0; j < 3; j++) {
|
||||||
|
in.scale[i][j] = n["scale"][3 * i + j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
for (std::size_t j = 0; j < 3; j++) {
|
||||||
|
in.assembly[i][j] = n["assembly"][3 * i + j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
in.drift[i] = n["drift"][i];
|
||||||
|
}
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
in.noise[i] = n["noise"][i];
|
||||||
|
}
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
in.bias[i] = n["bias"][i];
|
||||||
|
}
|
||||||
|
for (std::size_t i = 0; i < 2; i++) {
|
||||||
|
in.x[i] = n["x"][i];
|
||||||
|
}
|
||||||
|
for (std::size_t i = 0; i < 2; i++) {
|
||||||
|
in.y[i] = n["y"][i];
|
||||||
|
}
|
||||||
|
for (std::size_t i = 0; i < 2; i++) {
|
||||||
|
in.z[i] = n["z"][i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator>>(const cv::FileNode &n, Extrinsics &ex) {
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
for (std::size_t j = 0; j < 3; j++) {
|
||||||
|
ex.rotation[i][j] = n["rotation"][3 * i + j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
ex.translation[i] = n["translation"][i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// old
|
||||||
|
void operator>>(const cv::FileNode &n, DeviceWriter::img_params_t ¶ms) {
|
||||||
|
auto in_left = std::make_shared<IntrinsicsPinhole>();
|
||||||
|
auto in_right = std::make_shared<IntrinsicsPinhole>();
|
||||||
|
params.in_left = in_left;
|
||||||
|
params.in_right = in_right;
|
||||||
|
n["in_left"] >> *in_left;
|
||||||
|
n["in_right"] >> *in_right;
|
||||||
|
n["ex_right_to_left"] >> params.ex_right_to_left;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<IntrinsicsPinhole> to_intrinsics_pinhole(
|
||||||
|
const cv::FileNode &n, const std::uint8_t &model,
|
||||||
|
const std::uint16_t &width, const std::uint16_t &height) {
|
||||||
|
auto in = std::make_shared<IntrinsicsPinhole>();
|
||||||
|
in->width = width;
|
||||||
|
in->height = height;
|
||||||
|
in->model = model;
|
||||||
|
n["fx"] >> in->fx;
|
||||||
|
n["fy"] >> in->fy;
|
||||||
|
n["cx"] >> in->cx;
|
||||||
|
n["cy"] >> in->cy;
|
||||||
|
for (std::size_t i = 0; i < 5; i++) {
|
||||||
|
in->coeffs[i] = n["coeffs"][i];
|
||||||
|
}
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<IntrinsicsEquidistant> to_intrinsics_equidistant(
|
||||||
|
const cv::FileNode &n, const std::uint8_t &model,
|
||||||
|
const std::uint16_t &width, const std::uint16_t &height) {
|
||||||
|
auto in = std::make_shared<IntrinsicsEquidistant>();
|
||||||
|
in->width = width;
|
||||||
|
in->height = height;
|
||||||
|
for (std::size_t i = 0; i < 8; i++) {
|
||||||
|
in->coeffs[i] = n["coeffs"][i];
|
||||||
|
}
|
||||||
|
MYNTEYE_UNUSED(model)
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceWriter::img_params_t to_img_params(
|
||||||
|
const cv::FileNode &n, const std::uint8_t &model,
|
||||||
|
const std::uint16_t &width, const std::uint16_t &height) {
|
||||||
|
DeviceWriter::img_params_t params;
|
||||||
|
params.ok = false;
|
||||||
|
|
||||||
|
CalibrationModel calib_model = static_cast<CalibrationModel>(model);
|
||||||
|
switch (calib_model) {
|
||||||
|
case CalibrationModel::PINHOLE: {
|
||||||
|
params.ok = true;
|
||||||
|
params.in_left = to_intrinsics_pinhole(
|
||||||
|
n["in_left"], model, width, height);
|
||||||
|
params.in_right = to_intrinsics_pinhole(
|
||||||
|
n["in_right"], model, width, height);
|
||||||
|
n["ex_right_to_left"] >> params.ex_right_to_left;
|
||||||
|
} break;
|
||||||
|
case CalibrationModel::KANNALA_BRANDT: {
|
||||||
|
params.ok = true;
|
||||||
|
params.in_left = to_intrinsics_equidistant(
|
||||||
|
n["in_left"], model, width, height);
|
||||||
|
params.in_right = to_intrinsics_equidistant(
|
||||||
|
n["in_right"], model, width, height);
|
||||||
|
n["ex_right_to_left"] >> params.ex_right_to_left;
|
||||||
|
} break;
|
||||||
|
default:
|
||||||
|
LOG(FATAL) << "Could not load img params as unknown calib model"
|
||||||
|
", please use latest SDK.";
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
DeviceWriter::dev_info_t DeviceWriter::LoadDeviceInfo(
|
||||||
|
const std::string &filepath) {
|
||||||
|
using FileStorage = cv::FileStorage;
|
||||||
|
FileStorage fs(filepath, FileStorage::READ);
|
||||||
|
if (!fs.isOpened()) {
|
||||||
|
LOG(FATAL) << "Failed to load file: " << filepath;
|
||||||
|
}
|
||||||
|
DeviceInfo info;
|
||||||
|
info.lens_type = Type(std::string(fs["lens_type"]));
|
||||||
|
info.imu_type = Type(std::string(fs["imu_type"]));
|
||||||
|
fs["nominal_baseline"] >> info.nominal_baseline;
|
||||||
|
fs.release();
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceWriter::img_params_map_t DeviceWriter::LoadImgParams(
|
||||||
|
const std::string &filepath) {
|
||||||
|
using FileStorage = cv::FileStorage;
|
||||||
|
FileStorage fs(filepath, FileStorage::READ);
|
||||||
|
if (!fs.isOpened()) {
|
||||||
|
LOG(FATAL) << "Failed to load file: " << filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
img_params_map_t img_params_map;
|
||||||
|
if (!fs["version"].isNone()) {
|
||||||
|
std::string version = std::string(fs["version"]);
|
||||||
|
// load params according to verison
|
||||||
|
if (version == "1.0") {
|
||||||
|
fs["img_params_map"][0] >> img_params_map[{752, 480}];
|
||||||
|
} else if (version == "1.1") {
|
||||||
|
fs["img_params_map"][0] >> img_params_map[{1280, 400}];
|
||||||
|
fs["img_params_map"][1] >> img_params_map[{2560, 800}];
|
||||||
|
} else if (version == "1.2") {
|
||||||
|
auto node = fs["img_params"];
|
||||||
|
for (auto it = node.begin(); it < node.end(); it++) {
|
||||||
|
std::uint8_t model;
|
||||||
|
std::uint16_t width, height;
|
||||||
|
(*it)["model"] >> model;
|
||||||
|
(*it)["width"] >> width;
|
||||||
|
(*it)["height"] >> height;
|
||||||
|
auto params = to_img_params(*it, model, width, height);
|
||||||
|
if (params.ok) {
|
||||||
|
params.version = version;
|
||||||
|
img_params_map[{width, height}] = params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Failed to load img params of version " << version
|
||||||
|
<< ", please use latest SDK.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// load old params s1030
|
||||||
|
auto in_left = std::make_shared<IntrinsicsPinhole>();
|
||||||
|
auto in_right = std::make_shared<IntrinsicsPinhole>();
|
||||||
|
Extrinsics ex_right_to_left;
|
||||||
|
if (fs["in_left"].isNone()) {
|
||||||
|
std::uint16_t w = 752;
|
||||||
|
std::uint16_t h = 480;
|
||||||
|
std::uint8_t m = 0;
|
||||||
|
if (!fs["width"].isNone())
|
||||||
|
w = static_cast<int>(fs["width"]);
|
||||||
|
if (!fs["height"].isNone())
|
||||||
|
h = static_cast<int>(fs["height"]);
|
||||||
|
if (!fs["model"].isNone())
|
||||||
|
m = static_cast<int>(fs["model"]);
|
||||||
|
|
||||||
|
cv::Mat M1, D1, M2, D2, R, T;
|
||||||
|
fs["M1"] >> M1;
|
||||||
|
fs["D1"] >> D1;
|
||||||
|
fs["M2"] >> M2;
|
||||||
|
fs["D2"] >> D2;
|
||||||
|
fs["R"] >> R;
|
||||||
|
fs["T"] >> T;
|
||||||
|
|
||||||
|
to_intrinsics(w, h, m, M1, D1, in_left.get());
|
||||||
|
to_intrinsics(w, h, m, M2, D2, in_right.get());
|
||||||
|
to_extrinsics(R, T, &ex_right_to_left);
|
||||||
|
} else {
|
||||||
|
fs["in_left"] >> *in_left;
|
||||||
|
fs["in_right"] >> *in_right;
|
||||||
|
fs["ex_right_to_left"] >> ex_right_to_left;
|
||||||
|
}
|
||||||
|
img_params_map[{752, 480}] = {
|
||||||
|
true, "1.0", in_left, in_right, ex_right_to_left
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.release();
|
||||||
|
return img_params_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceWriter::imu_params_t DeviceWriter::LoadImuParams(
|
||||||
|
const std::string &filepath) {
|
||||||
|
using FileStorage = cv::FileStorage;
|
||||||
|
FileStorage fs(filepath, FileStorage::READ);
|
||||||
|
if (!fs.isOpened()) {
|
||||||
|
LOG(FATAL) << "Failed to load file: " << filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
imu_params_t params;
|
||||||
|
if (!fs["version"].isNone()) {
|
||||||
|
std::string version = std::string(fs["version"]);
|
||||||
|
// load params according to verison
|
||||||
|
if (version == "1.2") {
|
||||||
|
params.version = version;
|
||||||
|
fs["in_accel"] >> params.in_accel;
|
||||||
|
fs["in_gyro"] >> params.in_gyro;
|
||||||
|
fs["ex_left_to_imu"] >> params.ex_left_to_imu;
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Failed to load imu params of version " << version
|
||||||
|
<< ", please use latest SDK.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// load old params
|
||||||
|
fs["in_accel"] >> params.in_accel;
|
||||||
|
fs["in_gyro"] >> params.in_gyro;
|
||||||
|
fs["ex_left_to_imu"] >> params.ex_left_to_imu;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.release();
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace tools
|
||||||
|
|
||||||
|
MYNTEYE_END_NAMESPACE
|
69
samples/device_writer.h
Normal file
69
samples/device_writer.h
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
#ifndef MYNTEYE_TOOLS_DEVICE_WRITER_H_ // NOLINT
|
||||||
|
#define MYNTEYE_TOOLS_DEVICE_WRITER_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "mynteye/device/device.h"
|
||||||
|
|
||||||
|
MYNTEYE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Device;
|
||||||
|
|
||||||
|
namespace tools {
|
||||||
|
|
||||||
|
class DeviceWriter {
|
||||||
|
public:
|
||||||
|
using dev_info_t = DeviceInfo;
|
||||||
|
using imu_params_t = device::imu_params_t;
|
||||||
|
using img_params_t = device::img_params_t;
|
||||||
|
using img_params_map_t = std::map<Resolution, device::img_params_t>;
|
||||||
|
|
||||||
|
explicit DeviceWriter(std::shared_ptr<Device> device);
|
||||||
|
~DeviceWriter();
|
||||||
|
|
||||||
|
bool WriteDeviceInfo(const dev_info_t &info);
|
||||||
|
bool WriteDeviceInfo(const std::string &filepath);
|
||||||
|
|
||||||
|
bool WriteImgParams(const img_params_map_t &img_params_map);
|
||||||
|
bool WriteImgParams(const std::string &filepath);
|
||||||
|
|
||||||
|
bool WriteImuParams(const imu_params_t ¶ms);
|
||||||
|
bool WriteImuParams(const std::string &filepath);
|
||||||
|
|
||||||
|
bool SaveDeviceInfo(const dev_info_t &info, const std::string &filepath);
|
||||||
|
bool SaveImgParams(const img_params_map_t &img_params_map,
|
||||||
|
const std::string &filepath);
|
||||||
|
bool SaveImuParams(const imu_params_t ¶ms, const std::string &filepath);
|
||||||
|
|
||||||
|
/** Save all infos of this device */
|
||||||
|
void SaveAllInfos(const std::string &dir);
|
||||||
|
|
||||||
|
private:
|
||||||
|
dev_info_t LoadDeviceInfo(const std::string &filepath);
|
||||||
|
img_params_map_t LoadImgParams(const std::string &filepath);
|
||||||
|
imu_params_t LoadImuParams(const std::string &filepath);
|
||||||
|
|
||||||
|
std::shared_ptr<Device> device_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace tools
|
||||||
|
|
||||||
|
MYNTEYE_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // MYNTEYE_TOOLS_DEVICE_WRITER_H_ NOLINT
|
43
samples/save_all_infos.cc
Normal file
43
samples/save_all_infos.cc
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
#include "mynteye/logger.h"
|
||||||
|
#include "mynteye/device/device.h"
|
||||||
|
#include "mynteye/device/utils.h"
|
||||||
|
|
||||||
|
#include "device_writer.h"
|
||||||
|
|
||||||
|
MYNTEYE_USE_NAMESPACE
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
glog_init _(argc, argv);
|
||||||
|
|
||||||
|
std::string dir{"config"};
|
||||||
|
if (argc >= 2) {
|
||||||
|
dir = argv[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
auto &&device = device::select();
|
||||||
|
if (!device)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
dir.append(MYNTEYE_OS_SEP).append(device->GetInfo()->name);
|
||||||
|
dir.append(MYNTEYE_OS_SEP "SN").append(device->GetInfo()->serial_number);
|
||||||
|
|
||||||
|
tools::DeviceWriter writer(device);
|
||||||
|
writer.SaveAllInfos(dir);
|
||||||
|
|
||||||
|
LOG(INFO) << "Save all infos to \"" << dir << "\"";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
41
samples/write_device_info.cc
Normal file
41
samples/write_device_info.cc
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
#include "mynteye/logger.h"
|
||||||
|
#include "mynteye/device/device.h"
|
||||||
|
#include "mynteye/device/utils.h"
|
||||||
|
|
||||||
|
#include "device_writer.h"
|
||||||
|
|
||||||
|
MYNTEYE_USE_NAMESPACE
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
glog_init _(argc, argv);
|
||||||
|
|
||||||
|
const char *filepath;
|
||||||
|
if (argc >= 2) {
|
||||||
|
filepath = argv[1];
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Usage: ./device_info_writer <filepath>";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto &&device = device::select();
|
||||||
|
if (!device)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
tools::DeviceWriter writer(device);
|
||||||
|
writer.WriteDeviceInfo(filepath);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
41
samples/write_img_params.cc
Normal file
41
samples/write_img_params.cc
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
#include "mynteye/logger.h"
|
||||||
|
#include "mynteye/device/device.h"
|
||||||
|
#include "mynteye/device/utils.h"
|
||||||
|
|
||||||
|
#include "device_writer.h"
|
||||||
|
|
||||||
|
MYNTEYE_USE_NAMESPACE
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
glog_init _(argc, argv);
|
||||||
|
|
||||||
|
const char *filepath;
|
||||||
|
if (argc >= 2) {
|
||||||
|
filepath = argv[1];
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Usage: ./img_params_writer <filepath>";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto &&device = device::select();
|
||||||
|
if (!device)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
tools::DeviceWriter writer(device);
|
||||||
|
writer.WriteImgParams(filepath);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
41
samples/write_imu_params.cc
Normal file
41
samples/write_imu_params.cc
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
#include "mynteye/logger.h"
|
||||||
|
#include "mynteye/device/device.h"
|
||||||
|
#include "mynteye/device/utils.h"
|
||||||
|
|
||||||
|
#include "device_writer.h"
|
||||||
|
|
||||||
|
MYNTEYE_USE_NAMESPACE
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
glog_init _(argc, argv);
|
||||||
|
|
||||||
|
const char *filepath;
|
||||||
|
if (argc >= 2) {
|
||||||
|
filepath = argv[1];
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Usage: ./imu_params_writer <filepath>";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto &&device = device::select();
|
||||||
|
if (!device)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
tools::DeviceWriter writer(device);
|
||||||
|
writer.WriteImuParams(filepath);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user