294 Commits

Author SHA1 Message Date
John Zhao
203c5ce18b Merge branch 'hotfix/2.2.4' 2018-12-31 15:40:27 +08:00
John Zhao
27ab088acd chore(README.md): remove firmware version info 2018-12-31 10:33:23 +08:00
John Zhao
2a2ea0b370 chore(README.md): update version and doc links 2018-12-31 10:14:21 +08:00
John Zhao
6172f4c1b8 chore(root): update version 2018-12-31 06:45:25 +08:00
kalman
a3206e5be5 style(ros):rename mutex_data 2018-12-29 16:47:18 +08:00
kalman
e34e6e1466 style(ros):fix spell mistake 2018-12-29 16:40:03 +08:00
kalman
87c3c81a93 fix(ros):delete timestamp repeated/abnormal jundge 2018-12-29 16:32:03 +08:00
TinyOh
ceec4f492a fix(ros): include publishOther and reduce the range 2018-12-29 09:53:25 +08:00
TinyOh
812638b7dc fix(ros): record -a core error 2018-12-28 17:49:59 +08:00
kalman
6e638813f2 chore(root):update readme 2018-12-25 19:21:26 +08:00
kalman
18258fe7c9 chore(root):update readme 2018-12-25 19:07:52 +08:00
kalman
0bcaa0801e fix(README):update url of api doc in English 2018-12-25 18:53:39 +08:00
kalman
b10415515e chore(root):update reademe 2018-12-25 18:45:48 +08:00
Osenberg
aa19d65272 docs(doc):: Modified version number for release 2018-12-25 11:09:16 +08:00
Osenberg
1f6acd3c98 style(ros):: Remove useless log 2018-12-25 10:35:25 +08:00
Osenberg
28e539e277 fix(ros):: test ros timestamp overflow. 2018-12-23 17:20:03 +08:00
Osenberg
2e97266516 fix(ros): ros time stamp overflow 2018-12-21 20:45:19 +08:00
Osenberg
9eea427d59 Fixed ros timestamp overflow. 2018-12-20 10:58:59 +08:00
John Zhao
f6abc57475 chore(samples): comment build uvc 2018-12-17 11:48:04 +08:00
John Zhao
e7dc4b7def chore(root): update readme 2018-12-16 22:53:08 +08:00
John Zhao
54a9159850 Update inlcudes 2018-12-16 19:53:27 +08:00
John Zhao
9b7c36c724 Merge remote-tracking branch 'origin/hotfix/pointcloud' into develop 2018-12-16 18:30:34 +08:00
kalman
324e68bca5 Update version 2018-12-13 17:00:31 +08:00
kalman
486e9d459d Fix timestamp bug and record bug in ros 2018-12-12 20:22:39 +08:00
kalman
515bcb5f8a Fix disparty bug 2018-12-11 20:12:26 +08:00
Tiny
a57c096e91 Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-sdk-2 into develop 2018-12-11 17:12:43 +08:00
Tiny
132cbc19e2 Merge branch 'develop' of https://github.com/slightech/MYNT-EYE-SDK-2 into develop 2018-12-11 17:08:38 +08:00
Tiny
66eb9883ff add mac uvc impl file. 2018-12-11 17:08:31 +08:00
kalman
206683b76f Fix disparity_processor.cc bug 2018-12-08 21:10:31 +08:00
kalman
b9db889fa3 Delete uesless space 2018-12-08 20:55:14 +08:00
kalman
28ca9b60b0 Rollback to sgbm 2018-12-08 20:53:11 +08:00
kalman
0ecb395044 Replace tab with space 2018-12-07 16:22:32 +08:00
kalman
97701188b8 Do samll change in wrapper_nodelet.cc 2018-12-07 16:00:29 +08:00
kalman
4ebdcf9bee Merge remote-tracking branch 'origin/tmp-pointcloud' into develop 2018-12-07 15:43:04 +08:00
kalman
0b2fabe550 Merge branch 'tmp-pointcloud' of http://gitlab.mynt.com/mynteye/mynt-eye-sdk-2 into tmp-pointcloud 2018-12-07 15:40:00 +08:00
kalman
3458aa19cf Merge branch 'develop' into tmp-pointcloud 2018-12-07 15:34:27 +08:00
Osenberg
1afe33f924 Merge branch 'master' into tmp-pointcloud 2018-12-05 20:14:16 +08:00
John Zhao
4c49a6af26 Update makefile 2018-12-04 15:46:54 +08:00
John Zhao
0c5a4f7014 Update README.md 2018-11-25 16:11:15 +08:00
John Zhao
f0d2950701 Change publish queue size 2018-11-25 16:05:51 +08:00
John Zhao
4fcdb6fc7b Update version 2018-11-24 20:49:14 +08:00
Osenberg
bd273eed4f merge develop 2018-11-21 18:03:10 +08:00
Osenberg
772ba8ebfa Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-sdk-2 into develop 2018-11-21 17:37:00 +08:00
kalman
0fc1196b52 Add imu range set in ros launch 2018-11-20 15:33:16 +08:00
kalman
ee19a8c857 Add imu range setting 2018-11-20 15:23:07 +08:00
John Zhao
6d39773439 Update README.md 2018-11-20 12:56:41 +08:00
John Zhao
677c10925f Update makefile 2018-11-19 14:15:47 +08:00
John Zhao
5e8bc7c05b Improve makefile targets 2018-11-18 22:17:54 +08:00
Osenberg
d9393cfe76 Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-sdk-2 into develop 2018-11-14 16:11:33 +08:00
John Zhao
ae8cc4cae2 Fix links 2018-11-09 00:13:14 +08:00
John Zhao
9ef4820226 Update README.md 2018-11-08 23:34:25 +08:00
John Zhao
256730eabe Change project name 2018-11-08 22:53:23 +08:00
John Zhao
aeefa8f48a Update version 2018-11-08 22:45:57 +08:00
John Zhao
fbec6bfc65 Change project name & links 2018-11-08 21:12:07 +08:00
John Zhao
154f5f1b91 Update readme 2018-11-08 17:35:02 +08:00
John Zhao
eef9dc0739 Update ros cmakelists 2018-11-08 15:59:18 +08:00
John Zhao
41610fd714 Fix push motion datas in callback 2018-11-07 17:11:44 +08:00
John Zhao
bb2f0e4dd1 Update makefile 2018-11-07 14:37:03 +08:00
John Zhao
1bd02ef56c Add image data to synthetic streams 2018-11-05 18:02:28 +08:00
John Zhao
21a54a4637 Update winpack.sh 2018-11-05 16:23:59 +08:00
John Zhao
6a15a87782 Change pkgname in winpack.sh 2018-11-05 15:37:56 +08:00
John Zhao
fccc52eceb Add get sdk dirs 2018-11-05 12:36:02 +08:00
John Zhao
f7abe90c04 Fix win readme.txt 2018-11-05 11:50:43 +08:00
John Zhao
66ce5c8ad0 Update opencv macros 2018-11-05 11:27:28 +08:00
John Zhao
d6cb89bc04 Update winpack.sh 2018-11-05 11:02:24 +08:00
John Zhao
528bf6e700 Add vs2017 project demo 2018-11-05 10:49:43 +08:00
John Zhao
8bc4089677 Add readme to winpack 2018-11-02 13:01:54 +08:00
John Zhao
6fa55e9ad7 Add win generate.bat 2018-11-02 10:56:00 +08:00
Tiny
7475dc3dbe uvc readme change. 2018-11-02 09:42:15 +08:00
Tiny
c214a0c9fd version.sh permission. 2018-11-02 09:25:56 +08:00
Tiny
9a3a53b240 Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-sdk-2 into develop 2018-11-02 09:14:26 +08:00
Tiny
8d12fc8f14 Merge branch 'develop' of https://github.com/slightech/MYNT-EYE-SDK-2 into develop 2018-11-02 09:11:13 +08:00
Tiny
969cbfd073 add macosx demo project in sub dir and change the project platform dir 2018-11-02 09:11:01 +08:00
John Zhao
3badd53c4b Update pkgname 2018-11-01 23:34:52 +08:00
John Zhao
f803e3a75b Update winpack script 2018-11-01 23:27:43 +08:00
John Zhao
f923414660 Support debug build 2018-11-01 20:42:44 +08:00
John Zhao
d443029599 Add make win pkg target 2018-11-01 20:03:40 +08:00
Tiny
b102e5ae19 add uvc code for test. 2018-11-01 16:59:05 +08:00
John Zhao
4c53515056 Improve ros cmake files 2018-10-31 10:38:27 +08:00
John Zhao
8e302b9d07 Update dataset record 2018-10-30 15:56:09 +08:00
John Zhao
3d38b43d04 Update jenkinsfile 2018-10-29 12:08:19 +08:00
John Zhao
e95a5e6b1d Change includes 2018-10-27 21:51:44 +08:00
John Zhao
972ab79a76 Rearrage include and src 2018-10-27 21:24:04 +08:00
John Zhao
08271be063 Add frame id to synthetic streams 2018-10-26 15:39:34 +08:00
John Zhao
1529e77ffd Update jenkinsfile 2018-10-24 22:10:54 +08:00
John Zhao
8c016597d2 Add jenkinsfile 2018-10-24 15:55:28 +08:00
John Zhao
e0161ef696 Update init & makefile 2018-10-24 13:00:27 +08:00
John Zhao
b07930cd55 Update README.md 2018-10-22 22:47:55 +08:00
John Zhao
721ad22b0a Update version 2018-10-22 22:18:22 +08:00
kalman
4d644a1d71 Update img.params 2018-10-18 15:11:21 +08:00
kalman
1f96a6ee29 Add frame rate 60 2018-10-17 11:12:40 +08:00
kalman
204fff2175 Update device.info,img.params and imu params 2018-10-17 10:59:50 +08:00
John Zhao
12f5a8f3cc Update README.md 2018-09-27 09:56:17 +08:00
John Zhao
6435bf04a2 Fix generate apidoc 2018-09-27 09:31:42 +08:00
John Zhao
2ae3116f0d Update doc version 2018-09-26 16:01:47 +08:00
John Zhao
a26dbec7b1 Fix log level & strip basename 2018-09-11 14:12:45 +08:00
John Zhao
0bcd3c02b9 Fix miniglog on win 2018-09-11 13:24:07 +08:00
John Zhao
c6f195360f Change make install 2018-09-11 10:58:42 +08:00
John Zhao
1b95e376a5 Update macros 2018-09-11 10:50:44 +08:00
John Zhao
cf9e714626 Fix flags on win 2018-09-11 10:10:14 +08:00
Osenberg-Y
5f233a35c0 Merge branch develop 2018-09-11 10:05:57 +08:00
Osenberg-Y
dfc0de34d4 Merge branch 'develop' of https://code.slightech.com:666/mynteye/mynt-eye-sdk-2 into develop 2018-09-06 19:47:23 +08:00
Osenberg-Y
36e90e3793 Fix bug in repeatedly publishing camera infomation. 2018-09-06 19:45:51 +08:00
John Zhao
ca605d6114 Set max log level to info for miniglog 2018-09-04 17:31:21 +08:00
John Zhao
89c798daa8 Change max log size 2018-09-04 17:18:35 +08:00
John Zhao
2784937ad1 Remove submodule glog 2018-09-04 17:11:39 +08:00
John Zhao
d96797c835 Add miniglog 2018-09-04 17:00:18 +08:00
John Zhao
94ecacef6c Build pass without glog 2018-09-04 16:07:36 +08:00
John Zhao
02856194a0 Update find mynteye in cmakelists of wrappers 2018-09-04 15:59:38 +08:00
John Zhao
4d5ff16f82 Change log header 2018-09-04 15:49:11 +08:00
John Zhao
30a9397602 Add glog option 2018-09-04 15:07:26 +08:00
John Zhao
55165b8878 Update init script, make linter optional 2018-09-04 10:47:54 +08:00
Osenberg-Y
12adc79096 Merge branch into develop 2018-09-03 14:42:25 +08:00
Osenberg-Y
4addab5cc0 Merge branch 'develop' of https://code.slightech.com:666/mynteye/mynt-eye-sdk-2 into develop 2018-09-02 14:50:49 +08:00
kalman
92585a3b8d Replace LOG(WARNING) with VLOG(2) When get imu params failed or image packet is unaccepted 2018-09-01 21:03:28 +08:00
kalman
54f01eec1a Miss blank line 2018-09-01 20:51:14 +08:00
kalman
d80d506360 Throw error in v4l2 when time out 2018-09-01 20:47:35 +08:00
Osenberg-Y
692cbac8d8 Temporary version 2018-08-28 16:46:51 +08:00
Osenberg-Y
d4343b574a Optimized the display of raw image and imu rate information 2018-08-17 17:56:41 +08:00
Osenberg-Y
c3fc4ba3ba Fixed no pointcloud on ros 2018-08-14 14:47:26 +08:00
Osenberg-Y
1f003f505b Fixed no pointcloud on ros 2018-08-14 14:16:07 +08:00
John Zhao
a96246cc20 Change install dir on win 2018-08-14 13:46:18 +08:00
John Zhao
5f24d0857e Update README.md 2018-08-14 11:13:21 +08:00
John Zhao
bbf789b174 Update doc version 2018-08-14 11:05:23 +08:00
John Zhao
66c9af58fc Install to default path 2018-08-14 10:45:13 +08:00
Osenberg-Y
94fd56a65d code style 2018-08-13 18:49:59 +08:00
Osenberg-Y
23e28e20a6 Made some modification of code style and perfect function 2018-08-13 18:42:53 +08:00
John Zhao
375acb534c Update README.md 2018-08-13 09:12:34 +08:00
John Zhao
28204d5c0a Format comments 2018-08-13 09:10:23 +08:00
John Zhao
c9483c2aca Remove frame rate 60 2018-08-12 11:36:04 +08:00
Osenberg-Y
5677aa56b2 Made some optimization about pointscloud 2018-08-10 15:55:22 +08:00
Osenberg-Y
f92ecd4371 optimized pointscloud 2018-08-09 12:14:54 +08:00
Osenberg-Y
45b4fdeedf Remove frame rate 60 2018-08-07 17:35:42 +08:00
Osenberg-Y
455b5b931e Modification of publishing topic only when that was subscribed. 2018-08-07 11:15:45 +08:00
John Zhao
8ab9b42896 Fix constexpr on VS 2015 2018-08-04 14:05:19 +08:00
Osenberg-Y
3258e969ee Merge branch develop 2018-08-02 17:14:41 +08:00
Osenberg-Y
cc74b2663b Fixed img_params_writer write img.params failure 2018-08-02 16:38:19 +08:00
John Zhao
e270e99340 Update glog flags 2018-08-01 15:11:47 +08:00
Osenberg-Y
0c92f770f2 Fix make tools compile fail when using opencv2.4.x version 2018-07-27 14:50:02 +08:00
Osenberg-Y
5a9fffe3ed Fix compile failure on VS2015. Using const instead of constexpr 2018-07-26 13:15:14 +08:00
John Zhao
384ff028a8 Publish more camera infos 2018-07-22 12:20:27 +08:00
John Zhao
0f9bdd5cf2 Fix ros camera info 2018-07-22 11:37:21 +08:00
John Zhao
54165b1acb Fix t as right to left 2018-07-22 10:42:15 +08:00
John Zhao
087ef28da1 Update ros rviz 2018-07-19 16:55:51 +08:00
John Zhao
b2bd1f389d Update glog & default flags 2018-07-19 15:46:19 +08:00
John Zhao
6a82b06b84 Update README.md 2018-07-18 09:23:51 +08:00
John Zhao
518416ac4d Update version 2018-07-17 21:58:03 +08:00
John Zhao
c53dd50730 Remove flags of opencv windows 2018-07-17 15:12:35 +08:00
John Zhao
4892f52158 Fix win flags with opencv2 2018-07-17 10:13:50 +08:00
John Zhao
3dc21c0378 Limit max data size for async callback 2018-07-11 15:04:14 +08:00
John Zhao
0153261447 Update cmake files 2018-07-11 13:31:48 +08:00
John Zhao
25f72dd74f Add WITH_DEVICE_INFO_REQUIRED option 2018-07-11 12:17:21 +08:00
John Zhao
438ba6481d Optimize cmake options and print summary 2018-07-11 12:00:16 +08:00
John Zhao
922bf624e7 Do small change 2018-07-11 11:58:32 +08:00
junyang
9014f3df57 Point cloud unit conversion in wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc 2018-07-11 02:14:19 +08:00
junyang
c2f04c487e Increase the effectiveness of checking all values. 2018-07-11 02:07:01 +08:00
John Zhao
725a8c2e57 Add api doc of en 2018-07-10 17:24:10 +08:00
John Zhao
d04078068a Update api doc 2018-07-10 17:23:33 +08:00
John Zhao
9567546894 Update api doc 2018-07-08 13:04:41 +08:00
KalmanSLightech
27eb9e6cb2 Change the position of 'hardTimeToSoftTime' 2018-07-03 18:56:16 +08:00
KalmanSLightech
c5b054c864 change function name 2018-07-03 18:06:24 +08:00
nico
becccd9b8f Timestamp synchronization through one association. 2018-07-02 12:20:24 +08:00
John Zhao
1c1503aae2 Add get_all_device_info sample 2018-06-14 09:38:38 +08:00
John Zhao
d3a67b7d29 Change output of processor to smart pointer 2018-06-13 18:00:31 +08:00
John Zhao
a119b36f72 Catch process exception 2018-06-12 23:08:28 +08:00
John Zhao
24ca757c92 Improve process childs 2018-06-12 22:05:47 +08:00
John Zhao
92b38291ee Check image params when use api 2018-06-12 15:58:13 +08:00
John Zhao
377f9b21f1 Check supports stream or not when get its data 2018-06-12 12:31:07 +08:00
John Zhao
591bbdd3e6 Fix doc comments of api 2018-06-12 10:46:39 +08:00
John Zhao
68e413e5e2 Try python2 after detect python 2018-06-12 10:43:09 +08:00
John Zhao
3e42060ff1 Make python optional in init.sh 2018-06-12 10:22:15 +08:00
John Zhao
40b7acd5c3 Update README.md 2018-06-10 22:26:25 +08:00
John Zhao
d5bdce4f75 Update README.md 2018-06-08 16:45:24 +08:00
John Zhao
7ed11b01ff Update doc version 2018-06-08 16:13:28 +08:00
John Zhao
9caf979d4c Merge branch 'feature/one-thread-read' into develop 2018-06-08 12:17:13 +08:00
John Zhao
9b91304f0b Get stream & motion datas in one thread 2018-06-07 11:19:58 +08:00
John Zhao
0286da50c6 Add intermediate tutorials 2018-06-05 15:28:10 +08:00
John Zhao
3e96e56d8b Detect OpenCV 4.x 2018-06-05 15:00:44 +08:00
John Zhao
9451fdd90c Fix view points rotation 2018-06-05 14:42:39 +08:00
John Zhao
1293757486 Update README.md 2018-06-05 00:30:44 +08:00
John Zhao
190c5d883c Update doc version 2018-06-04 22:41:25 +08:00
John Zhao
2fe6309994 Update get_depth_with_region sample 2018-06-04 22:27:23 +08:00
John Zhao
dfb574c179 Support find plugin to load 2018-06-04 22:09:20 +08:00
John Zhao
b7436e41b9 Output build.info 2018-06-04 14:15:54 +08:00
John Zhao
046661745d Update tools requirements 2018-06-02 16:43:48 +08:00
John Zhao
9d79526d6a Update uvc camera sample 2018-06-02 16:04:11 +08:00
John Zhao
7451b6417d Restore lock stream datas 2018-06-01 16:50:15 +08:00
John Zhao
9c20d62763 Increase v4l2 request buffers 2018-06-01 16:34:21 +08:00
John Zhao
a0cf8fd902 Do small changes 2018-06-01 07:09:03 +00:00
John Zhao
c5dd47708e Disable log to file 2018-06-01 10:55:45 +08:00
John Zhao
2fddba75e9 Update control channel doc 2018-06-01 10:40:57 +08:00
John Zhao
5a836b2ae3 Add proc period support 2018-06-01 10:32:36 +08:00
John Zhao
e4fddf2b8d Merge win support into develop 2018-06-01 00:38:37 +08:00
John Zhao
1da095f5c3 Optimize streams 2018-05-31 23:41:32 +08:00
John Zhao
f447739488 Add async callback for motion datas 2018-05-31 20:36:17 +08:00
KalmanSLightech
84103d91bb change the callback's parameter in uvc-v4l2.cc 2018-05-31 16:19:32 +08:00
KalmanSLightech
8bf0d982ea spelling mistake 2018-05-31 15:48:58 +08:00
John Zhao
7e55f78418 Add async callback support 2018-05-31 15:39:42 +08:00
kalman
5be47846e7 change the way to get xu control's range 2018-05-31 15:09:00 +08:00
John Zhao
425b181216 Improve lock stream datas 2018-05-31 10:28:52 +08:00
John Zhao
b96d7a1782 Fix log message 2018-05-30 22:15:50 +08:00
John Zhao
6c7b4e1fb2 Add get_info service to ros wrapper 2018-05-30 22:02:05 +08:00
John Zhao
240b18270b Change log fatal 2018-05-30 12:41:35 +08:00
John Zhao
87470f29a9 Update xu_control_range in uvc-wmf.cc 2018-05-30 11:12:28 +08:00
John Zhao
b4f73dfa0b Add show depth values sample 2018-05-29 17:38:44 +08:00
John Zhao
5daf4162e4 Add log info in uvc-wmf.cc 2018-05-29 12:23:11 +08:00
John Zhao
aed39f0942 Change channel value 2018-05-29 12:21:30 +08:00
John Zhao
3673324079 Update uvc-wmf.cc & add xu_control_range 2018-05-25 12:32:58 +08:00
John Zhao
f17eff7e01 Improve detect vs version in makefile 2018-05-24 16:00:22 +08:00
John Zhao
3112779174 Update doc version 2018-05-23 12:46:33 +08:00
John Zhao
1130a99c8d Update comments of samples 2018-05-22 11:33:07 +08:00
John Zhao
13939734a7 Update python wrapper 2018-05-22 11:32:30 +08:00
kalman
0b7375698d change xu guid 2018-05-18 18:36:52 +08:00
John Zhao
49771d5b8e Format uvc-wmf.cc 2018-05-18 11:47:05 +08:00
John Zhao
d414182721 Add api create to python wrapper 2018-05-18 00:19:12 +08:00
John Zhao
072fe4d397 Add python wrapper 2018-05-17 17:28:43 +08:00
John Zhao
2ff0ed504d Update md5sum.sh 2018-05-16 16:56:02 +08:00
John Zhao
25d3526086 Fix imu track period 2018-05-16 16:37:12 +08:00
John Zhao
3a49eec9c0 Update README.md 2018-05-16 11:43:46 +08:00
John Zhao
3547acc422 Update doc version 2018-05-16 11:00:54 +08:00
John Zhao
152af37138 Fix forward declaration 2018-05-16 10:48:15 +08:00
John Zhao
dd2fc88846 Update doc comments 2018-05-16 10:31:31 +08:00
John Zhao
de0f0d0639 Log error and return if no devices 2018-05-15 22:01:15 +08:00
John Zhao
58fdc4c01b Fix capture video stream in uvc-wmf 2018-05-15 17:32:04 +08:00
John Zhao
276406dd1e Add imu track period 2018-05-15 14:54:22 +08:00
John Zhao
a83be6bde6 Add ros README.md 2018-05-14 13:48:58 +08:00
John Zhao
9e7c2cfa68 Get real exposure time and draw 2018-05-13 10:34:03 +08:00
John Zhao
aca1f8b183 Done control tutorials 2018-05-13 10:12:24 +08:00
John Zhao
abef84e8dc Extract util in tutorials 2018-05-12 22:53:36 +08:00
John Zhao
012ddb2ed0 Update api camera sample 2018-05-12 22:19:45 +08:00
John Zhao
994342ae3a Merge branch 'develop' of https://code.slightech.com:666/mynteye/mynt-eye-sdk-2 into develop 2018-05-11 17:13:05 +08:00
John Zhao
42cf45a4c0 Add save_all_infos tool 2018-05-11 16:48:22 +08:00
John Zhao
ff70cc47f3 Update CMakeLists.txt 2018-05-11 16:15:26 +08:00
John Zhao
02d78f132d Update guide tools doc 2018-05-11 14:08:53 +08:00
John Zhao
76d12ccec7 Show depth if new in get_from_callbacks 2018-05-11 13:23:04 +08:00
John Zhao
8b7e43d76d Update comments in get_from_callbacks 2018-05-11 13:08:55 +08:00
John Zhao
806359e900 Add tutorial get_from_callbacks 2018-05-11 11:35:48 +08:00
John Zhao
c74ebb3cd5 Add draw img data 2018-05-11 10:14:58 +08:00
John Zhao
63105b5ae4 Add tutorial get_imu 2018-05-11 09:56:21 +08:00
John Zhao
90bb1cdd9a Update tutorial get_points 2018-05-10 22:11:20 +08:00
John Zhao
4dc9108ae4 Add copyright information 2018-05-10 14:46:34 +08:00
John Zhao
bbdc0ac178 Update uvc-wmf.cc 2018-05-10 14:46:21 +08:00
John Zhao
40dc61d2b6 Add get stream data tutorials 2018-05-10 13:55:20 +08:00
John Zhao
1fec1300a8 Add tutorial get_with_plugin 2018-05-09 13:40:34 +08:00
John Zhao
401c003906 Add plugin support 2018-05-08 11:12:45 +08:00
kalman
ca0ae22aea change a parameter of ksproperty 2018-05-07 21:58:01 +08:00
kalman
9988c49060 corrected a mistake about get 2018-05-07 21:53:59 +08:00
kalman
b8f20c570c change the node and confirm the KSNODETYPE_DEV 2018-05-07 20:33:10 +08:00
kalman
8ca90f3478 add KSNODETYPE_DEV_SPECIFIC_LOCAL 2018-05-07 16:43:47 +08:00
John Zhao
7f0fa15c06 Update CMakeLists.txt 2018-05-07 16:29:20 +08:00
kalman
b1b9b60626 add uvc extension unit guid 2018-05-07 15:03:52 +08:00
kalman
113d2e5951 add two space 2018-05-05 21:10:49 +08:00
kalman
ff33770ca4 add some log 2018-05-05 20:52:36 +08:00
kalman
8d017f5e2d add code in uvc-wmf.cc 2018-05-05 16:27:05 +08:00
John Zhao
e041d43183 Test addons support and add tutorial ir control 2018-05-04 15:59:07 +08:00
John Zhao
2e31a79b1a Add add-ons enum type 2018-05-04 13:44:13 +08:00
John Zhao
8b21989dcc Add tutorial get_device_info 2018-05-03 16:40:09 +08:00
John Zhao
fbc7c3b6ef Add api create methods 2018-05-03 16:33:27 +08:00
John Zhao
c6586cf164 Fix macro target_create_scripts 2018-05-03 16:13:39 +08:00
John Zhao
b0b12c2cc7 Update guide docs 2018-05-03 14:45:33 +08:00
John Zhao
505b7df188 Update init.sh 2018-05-03 14:21:28 +08:00
John Zhao
2d7ae598f0 Install curl in init.sh 2018-05-03 11:33:13 +08:00
John Zhao
54d5c85b48 Publish points in ros 2018-04-30 14:43:18 +08:00
John Zhao
f636ba3a86 Support enable stream and publish them in ros 2018-04-30 10:51:09 +08:00
John Zhao
f3d6fcdcb9 Could inverse extrinsics 2018-04-29 14:47:35 +08:00
John Zhao
77837933bc Publish camera info in ros wrapper 2018-04-29 14:15:38 +08:00
John Zhao
96b5e20580 Impl ros wrapper with api layer 2018-04-28 14:54:23 +08:00
John Zhao
2111a183d0 Done points and depth processor 2018-04-28 14:27:43 +08:00
John Zhao
c49342f9f7 Add process return bool 2018-04-28 13:37:25 +08:00
John Zhao
c176f55af2 Done disparity processor 2018-04-28 13:26:46 +08:00
John Zhao
21f2f91343 Done rectify processor 2018-04-28 12:44:15 +08:00
John Zhao
9e497cfa80 Process synthetic stream data and callback 2018-04-28 12:40:29 +08:00
John Zhao
cf80332e13 Complete native streams 2018-04-27 22:35:43 +08:00
John Zhao
3467c822c9 Combine enable/disable stream with processors 2018-04-27 15:47:54 +08:00
John Zhao
a5ce17a987 Add processor files 2018-04-27 09:58:53 +08:00
John Zhao
81be95db12 Update processor 2018-04-26 15:15:33 +08:00
John Zhao
b97baae06d Add processor and update api 2018-04-26 14:44:47 +08:00
John Zhao
8f10285773 Add synthetic files 2018-04-26 10:33:37 +08:00
John Zhao
1fd44f7f0c Update api & link libs 2018-04-26 09:22:29 +08:00
John Zhao
cd28fa58d3 Add with api option 2018-04-25 16:06:38 +08:00
John Zhao
2dc470e14f Update samples, tools readme and guide doc 2018-04-25 13:22:36 +08:00
John Zhao
44364e7d82 Create bat for all exe 2018-04-25 12:08:25 +08:00
John Zhao
f766f2df22 Create bat for test exe 2018-04-25 11:32:54 +08:00
John Zhao
9cf58f6e70 Make build on win 2018-04-23 23:11:11 +08:00
John Zhao
9bb99499a2 Update TargetArch.cmake 2016-02-12 01:52:59 +08:00
John Zhao
ddb5cb46b7 Update enable plugin log info 2018-06-08 00:49:07 +08:00
John Zhao
0af640015b Detect opencv with world 2018-06-08 00:48:25 +08:00
John Zhao
064b536822 Update tutorials with opencv 2018-06-08 00:22:59 +08:00
John Zhao
209617dd24 Get compiler version values 2018-06-07 23:47:01 +08:00
John Zhao
ac88a68ebc Update build.info and support native system on win 2018-06-07 23:32:36 +08:00
John Zhao
ee6d9f5a3b Use absolute paths in bat 2018-06-07 21:40:41 +08:00
John Zhao
09fb4c04df Obtain raw frame in api stream data 2018-06-07 17:39:51 +08:00
John Zhao
22ea971407 Fix default int value in build.info 2018-06-07 16:23:38 +08:00
John Zhao
87458482d9 Update default topics 2018-06-07 12:45:23 +08:00
384 changed files with 53042 additions and 2005 deletions

16
.gitignore vendored
View File

@@ -1,5 +1,7 @@
.DS_Store
/.vscode/
.vs/
.vscode/
_build/
_install/
@@ -12,6 +14,13 @@ _output/
/*ERROR*
/*FATAL*
/plugins/
/3rdparty/opencv/
/pkginfo.sh
/*.nsi
/*.exe
# ros
/wrappers/ros/build
@@ -27,3 +36,8 @@ _output/
/mynteye/
/mynteye.bag
/dataset*/
# wrappers
/wrappers/python/third_party/numpy-opencv-converter/
/wrappers/python/third_party/pyboostcvconverter/

3
.gitmodules vendored
View File

@@ -1,9 +1,6 @@
[submodule "test/gtest"]
path = test/gtest
url = https://github.com/google/googletest.git
[submodule "third_party/glog"]
path = third_party/glog
url = https://github.com/google/glog.git
[submodule "tools/linter"]
path = tools/linter
url = https://github.com/slightech/linter.git

View File

@@ -1,13 +1,40 @@
# 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.
cmake_minimum_required(VERSION 3.0)
project(mynteye VERSION 2.0.0 LANGUAGES C CXX)
project(mynteye VERSION 2.2.4 LANGUAGES C CXX)
include(cmake/Common.cmake)
if(NOT CMAKE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX d)
endif()
# options
include(cmake/Option.cmake)
# flags
if(OS_WIN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()
include(cmake/DetectCXX11.cmake)
@@ -21,9 +48,16 @@ message(STATUS "CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
# packages
LIST(APPEND CMAKE_PREFIX_PATH third_party/glog/_build)
find_package(glog REQUIRED)
message(STATUS "Found glog: ${glog_VERSION}")
find_package(Threads QUIET)
macro(target_link_threads NAME)
if(THREADS_HAVE_PTHREAD_ARG)
target_compile_options(PUBLIC ${NAME} "-pthread")
endif()
if(CMAKE_THREAD_LIBS_INIT)
target_link_libraries(${NAME} "${CMAKE_THREAD_LIBS_INIT}")
endif()
endmacro()
LIST(APPEND CMAKE_MODULE_PATH cmake)
@@ -31,17 +65,38 @@ include(CMakePackageConfigHelpers)
# config
set(MYNTEYE_NAME ${PROJECT_NAME})
set(MYNTEYE_NAMESPACE "mynteye")
message(STATUS "Namespace: ${MYNTEYE_NAMESPACE}")
if(MSVC)
string(REPLACE "/" "\\\\" MYNTEYE_SDK_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
string(REPLACE "/" "\\\\" MYNTEYE_SDK_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
else()
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" MYNTEYE_SDK_ROOT_DIR)
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" MYNTEYE_SDK_INSTALL_DIR)
endif()
configure_file(
include/mynteye/mynteye.h.in
include/mynteye/mynteye.h @ONLY
)
configure_file(
cmake/templates/pkginfo.sh.in
${CMAKE_CURRENT_SOURCE_DIR}/pkginfo.sh @ONLY
)
if(OS_WIN)
configure_file(
scripts/win/nsis/winpack.nsi.in
${CMAKE_CURRENT_SOURCE_DIR}/winpack.nsi @ONLY
)
endif()
# targets
include(cmake/Common.cmake)
add_definitions(-DMYNTEYE_EXPORTS)
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
set_outdir(
@@ -50,77 +105,109 @@ set_outdir(
"${OUT_DIR}/bin"
)
set(MYNTEYE_CMAKE_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
set(MYNTEYE_CMAKE_BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
set(MYNTEYE_CMAKE_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
set(MYNTEYE_CMAKE_INSTALLDIR "${MYNTEYE_CMAKE_LIBDIR}/cmake/${MYNTEYE_NAME}")
## main
if(WITH_GLOG)
add_executable(main src/main.cc)
target_link_libraries(main glog::glog)
target_include_directories(main PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include
)
endif()
## libmynteye
set(MYNTEYE_NAME ${PROJECT_NAME})
set(MYNTEYE_PUBLIC_H
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/callbacks.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/global.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/glog_init.h
${CMAKE_CURRENT_BINARY_DIR}/include/mynteye/mynteye.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/types.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/utils.h
${CMAKE_CURRENT_SOURCE_DIR}/src/device/context.h
${CMAKE_CURRENT_SOURCE_DIR}/src/device/device.h
${CMAKE_CURRENT_SOURCE_DIR}/src/internal/files.h
${CMAKE_CURRENT_SOURCE_DIR}/src/internal/strings.h
${CMAKE_CURRENT_SOURCE_DIR}/src/internal/times.h
)
if(NOT WITH_GLOG AND NOT OS_WIN)
set(__MINIGLOG_FLAGS "-Wno-unused-parameter -Wno-format -Wno-return-type")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${__MINIGLOG_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${__MINIGLOG_FLAGS}")
unset(__MINIGLOG_FLAGS)
endif()
if(OS_WIN)
set(UVC_SRC src/uvc/uvc-wmf.cc)
set(UVC_SRC src/mynteye/uvc/win/uvc-wmf.cc)
elseif(OS_MAC)
set(UVC_SRC src/uvc/uvc-libuvc.cc)
add_compile_options(-x objective-c++)
## INCLUDE_DIRECTORIES(src/mynteye/uvc/macosx)
## INCLUDE_DIRECTORIES(src/mynteye/uvc/macosx/VVUVCKit)
## aux_source_directory(src/mynteye/uvc/macosx/VVUVCKit/ MAC_VVUVCKIT_SRC_LIST)
## aux_source_directory(src/mynteye/uvc/macosx/USBBusProber/ MAC_USBBUSPROBER_SRC_LIST)
## add_library(usbBusProber SHARED ${MAC_USBBUSPROBER_SRC_LIST})
## set_target_properties(usbBusProber PROPERTIES FRAMEWORK TRUE )
## add_library(vvuvckit SHARED ${MAC_VVUVCKIT_SRC_LIST})
## set_target_properties(vvuvckit PROPERTIES FRAMEWORK TRUE )
INCLUDE_DIRECTORIES(src/mynteye/uvc/macosx/USBBusProber.framework/Headers)
INCLUDE_DIRECTORIES(src/mynteye/uvc/macosx/VVUVCKit.framework/Headers)
find_library(VVUVCKIT_LIBRARY VVUVCKit PATHS src/mynteye/uvc/macosx)
find_library(USB_LIBRARY USBBusProber PATHS src/mynteye/uvc/macosx)
MARK_AS_ADVANCED (VVUVCKIT_LIBRARY USB_LIBRARY)
SET(OSX_EXTRA_LIBS ${VVUVCKIT_LIBRARY} ${USB_LIBRARY})
set(UVC_SRC src/mynteye/uvc/macosx/CameraEngine.cpp src/mynteye/uvc/macosx/AVfoundationCamera.mm src/mynteye/uvc/macosx/uvc-vvuvckit.cc )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -framework CoreFoundation -framework AVFoundation -framework IOKit -framework AppKit -framework Cocoa -framework CoreMedia -framework CoreData -framework Foundation -framework CoreVideo ${__MACUVCLOG_FLAGS}")
find_package(libuvc REQUIRED)
set(UVC_LIB ${libuvc_LIBRARIES})
include_directories(${libuvc_INCLUDE_DIRS})
elseif(OS_LINUX)
set(UVC_SRC src/uvc/uvc-v4l2.cc)
set(UVC_SRC src/mynteye/uvc/linux/uvc-v4l2.cc)
else()
message(FATAL_ERROR "Unsupported OS.")
endif()
set(MYNTEYE_SRCS
${UVC_SRC}
src/internal/channels.cc
src/internal/config.cc
src/internal/files.cc
src/internal/motions.cc
src/internal/streams.cc
src/internal/strings.cc
src/internal/types.cc
src/public/types.cc
src/public/utils.cc
src/device/context.cc
src/device/device.cc
src/device/device_s.cc
src/mynteye/types.cc
src/mynteye/util/files.cc
src/mynteye/util/strings.cc
src/mynteye/device/channels.cc
src/mynteye/device/config.cc
src/mynteye/device/context.cc
src/mynteye/device/device.cc
src/mynteye/device/device_s.cc
src/mynteye/device/motions.cc
src/mynteye/device/streams.cc
src/mynteye/device/types.cc
src/mynteye/device/utils.cc
)
if(WITH_API)
list(APPEND MYNTEYE_SRCS
src/mynteye/api/api.cc
src/mynteye/api/dl.cc
src/mynteye/api/processor.cc
src/mynteye/api/synthetic.cc
src/mynteye/api/processor/rectify_processor.cc
src/mynteye/api/processor/disparity_processor.cc
src/mynteye/api/processor/disparity_normalized_processor.cc
src/mynteye/api/processor/depth_processor.cc
src/mynteye/api/processor/points_processor.cc
)
endif()
if(NOT WITH_GLOG)
list(APPEND MYNTEYE_SRCS src/mynteye/miniglog.cc)
endif()
set(MYNTEYE_LINKLIBS
glog::glog
${UVC_LIB}
)
set(MYNTEYE_LINKLIBS ${UVC_LIB})
if(WITH_API)
list(APPEND MYNTEYE_LINKLIBS ${OpenCV_LIBS})
endif()
if(WITH_BOOST_FILESYSTEM)
list(APPEND MYNTEYE_LINKLIBS ${Boost_LIBRARIES})
endif()
if(WITH_GLOG)
list(APPEND MYNTEYE_LINKLIBS glog::glog)
endif()
#message(STATUS "MYNTEYE_LINKLIBS: ${MYNTEYE_LINKLIBS}")
add_library(${MYNTEYE_NAME} SHARED ${MYNTEYE_SRCS})
target_link_libraries(${MYNTEYE_NAME} ${MYNTEYE_LINKLIBS})
if(OS_MAC)
target_link_libraries( ${MYNTEYE_NAME} ${OSX_EXTRA_LIBS} )
endif()
target_link_threads(${MYNTEYE_NAME})
if(OS_WIN)
target_compile_definitions(${MYNTEYE_NAME}
@@ -132,27 +219,78 @@ target_include_directories(${MYNTEYE_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
"$<INSTALL_INTERFACE:${MYNTEYE_CMAKE_INCLUDE_DIR}>"
"$<INSTALL_INTERFACE:include>"
)
set_target_properties(${MYNTEYE_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
set_target_properties(${MYNTEYE_NAME} PROPERTIES
PUBLIC_HEADER "${MYNTEYE_PUBLIC_H}"
)
# install
#message(STATUS "MYNTEYE_CMAKE_INCLUDE_DIR: ${MYNTEYE_CMAKE_INCLUDE_DIR}")
#message(STATUS "MYNTEYE_CMAKE_BINDIR: ${MYNTEYE_CMAKE_BINDIR}")
#message(STATUS "MYNTEYE_CMAKE_LIBDIR: ${MYNTEYE_CMAKE_LIBDIR}")
#message(STATUS "MYNTEYE_CMAKE_INSTALLDIR: ${MYNTEYE_CMAKE_INSTALLDIR}")
set(MYNTEYE_CMAKE_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/${MYNTEYE_NAME}")
set(MYNTEYE_CMAKE_BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
set(MYNTEYE_CMAKE_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
set(MYNTEYE_CMAKE_INSTALLDIR "${MYNTEYE_CMAKE_LIBDIR}/cmake/${MYNTEYE_NAME}")
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/include/mynteye/mynteye.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/global.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/logger.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/types.h
DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR}
)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/device/callbacks.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/device/context.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/device/device.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/device/utils.h
DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR}/device
)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/util/files.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/util/strings.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/util/times.h
DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR}/util
)
if(WITH_API)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/api/api.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/api/plugin.h
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/api/object.h
DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR}/api
)
endif()
if(NOT WITH_GLOG)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/mynteye/miniglog.h
DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR}
)
endif()
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/callbacks.h
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/context.h
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/device.h
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/files.h
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/glog_init.h
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/strings.h
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/times.h
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/utils.h
DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR}
)
if(WITH_API)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/api.h
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/plugin.h
${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/object.h
DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR}
)
endif()
install(TARGETS ${MYNTEYE_NAME}
EXPORT ${MYNTEYE_NAME}-targets
PUBLIC_HEADER DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR}/${MYNTEYE_NAME}
RUNTIME DESTINATION ${MYNTEYE_CMAKE_BINDIR}
LIBRARY DESTINATION ${MYNTEYE_CMAKE_LIBDIR}
ARCHIVE DESTINATION ${MYNTEYE_CMAKE_LIBDIR}
@@ -177,3 +315,31 @@ install(FILES
install(EXPORT ${MYNTEYE_NAME}-targets
DESTINATION ${MYNTEYE_CMAKE_INSTALLDIR}
)
## build.info
# set default int values for yaml file (build.info)
set_default_value(CMAKE_CXX_COMPILER_VERSION_MAJOR 0)
set_default_value(CMAKE_CXX_COMPILER_VERSION_MINOR 0)
set_default_value(CMAKE_CXX_COMPILER_VERSION_PATCH 0)
set_default_value(CMAKE_CXX_COMPILER_VERSION_TWEAK 0)
set_default_value(CUDA_VERSION_MAJOR 0)
set_default_value(CUDA_VERSION_MINOR 0)
set_default_value(OpenCV_VERSION_MAJOR 0)
set_default_value(OpenCV_VERSION_MINOR 0)
set_default_value(OpenCV_VERSION_PATCH 0)
set_default_value(OpenCV_VERSION_TWEAK 0)
set_default_value(${PROJECT_NAME}_VERSION_MAJOR 0)
set_default_value(${PROJECT_NAME}_VERSION_MINOR 0)
set_default_value(${PROJECT_NAME}_VERSION_PATCH 0)
set_default_value(${PROJECT_NAME}_VERSION_TWEAK 0)
configure_file(
cmake/templates/build.info.in
build.info @ONLY
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/build.info
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/mynteye
)

2
CPPLINT.cfg Normal file
View File

@@ -0,0 +1,2 @@
set noparent
filter=-build/c++11

View File

@@ -1,3 +1,16 @@
# 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 _COMMON_DEFS_MAKE_
_COMMON_DEFS_MAKE_ := 1
@@ -13,6 +26,16 @@ SINGLE_QUOTE := '
OPEN_PAREN := (
CLOSE_PAREN := )
# Options
#
# VS_CODE: ignore to auto detect, otherwise specify the version
# 15|2017, 14|2015, 12|2013, 11|2012, 10|2010, 9|2008, 8|2005
# BUILD_TYPE: Debug|Release
#
# e.g. make [TARGET] VS_CODE=2017 BUILD_TYPE=Debug
BUILD_TYPE ?= Release
# Host detection
ifeq ($(OS),Windows_NT)
@@ -111,7 +134,7 @@ ifeq ($(HOST_OS),Win)
CC := cl
CXX := cl
MAKE := make
BUILD := msbuild.exe ALL_BUILD.vcxproj /property:Configuration=Release
BUILD := msbuild.exe ALL_BUILD.vcxproj /property:Configuration=$(BUILD_TYPE)
endif
else
# mac & linux
@@ -131,8 +154,7 @@ endif
# CMake
CMAKE := cmake
# CMAKE := $(CMAKE) -DCMAKE_BUILD_TYPE=Debug
CMAKE := $(CMAKE) -DCMAKE_BUILD_TYPE=Release
CMAKE := $(CMAKE) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
ifneq ($(CC),)
CMAKE := $(CMAKE) -DCMAKE_C_COMPILER=$(CC)
endif
@@ -150,7 +172,6 @@ ifneq ($(MAKE),)
endif
CMAKE_OPTIONS :=
CMAKE_OPTIONS += -DCMAKE_INSTALL_PREFIX=$(shell pwd)/_install
# CMAKE_OPTIONS += -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
CMAKE_OPTIONS_AFTER :=
@@ -159,28 +180,46 @@ ifeq ($(HOST_OS),Win)
ifeq ($(HOST_NAME),MinGW)
CMAKE += -G "MinGW Makefiles"
else ifeq ($(HOST_ARCH),x64)
VS_VERSION := $(shell echo "$(shell which cl)" | sed "s/.*Visual\sStudio\s\([0-9]\+\).*/\1/g")
ifeq (15,$(VS_VERSION))
ifeq ($(VS_CODE),)
WHICH_CL := $(shell which cl)
ifeq ($(WHICH_CL),)
$(error "Visual Studio version is unknown. Could set VS_CODE to specify it, e.g. make [TARGET] VS_CODE=2017")
endif
# C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\...
# C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\...
VS_CODE := $(shell echo "$(WHICH_CL)" | grep -Po "(?<=Visual Studio[ /])[0-9]+")
endif
# $(call mkinfo,"VS_CODE: $(VS_CODE)")
ifeq ($(filter $(VS_CODE),15 2017),$(VS_CODE))
CMAKE += -G "Visual Studio 15 2017 Win64"
else ifeq (14,$(VS_VERSION))
else ifeq ($(filter $(VS_CODE),14 2015),$(VS_CODE))
CMAKE += -G "Visual Studio 14 2015 Win64"
else ifeq (12,$(VS_VERSION))
else ifeq ($(filter $(VS_CODE),12 2013),$(VS_CODE))
CMAKE += -G "Visual Studio 12 2013 Win64"
else ifeq (11,$(VS_VERSION))
else ifeq ($(filter $(VS_CODE),11 2012),$(VS_CODE))
CMAKE += -G "Visual Studio 11 2012 Win64"
else ifeq (10,$(VS_VERSION))
else ifeq ($(filter $(VS_CODE),10 2010),$(VS_CODE))
CMAKE += -G "Visual Studio 10 2010 Win64"
else ifeq (9,$(VS_VERSION))
else ifeq ($(filter $(VS_CODE),9 2008),$(VS_CODE))
CMAKE += -G "Visual Studio 9 2008 Win64"
else ifeq (8,$(VS_VERSION))
else ifeq ($(filter $(VS_CODE),8 2005),$(VS_CODE))
CMAKE += -G "Visual Studio 8 2005 Win64"
else
$(call mkinfo,"Connot specify Visual Studio Win64")
$(error "Visual Studio version is not proper, VS_CODE: $(VS_CODE)")
endif
endif
endif
# Package
PKGVERSION := $(shell ./scripts/version.sh)
PKGNAME := mynteye-s-$(PKGVERSION)-$(HOST_OS)-$(HOST_ARCH)
ifeq ($(HOST_OS),Linux)
PKGNAME := $(PKGNAME)-gcc$(shell gcc -dumpversion | cut -c 1-1)
endif
PKGNAME := $(call lower,$(PKGNAME))
# Shell
# `sh` is not possible to export a function

103
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,103 @@
pipeline {
agent {
// docker { image 'ros:kinetic-ros-base-xenial' }
docker { image 'joinaero/kinetic-ros-opencv-xenial' }
}
/*
environment {
// FindOpenCV.cmake
OpenCV_DIR = '/opt/ros/kinetic/share/OpenCV-3.3.1-dev'
}
*/
stages {
stage('Prepare') {
steps {
echo "WORKSPACE: ${env.WORKSPACE}"
echo 'apt-get ..'
sh 'apt-get update'
}
}
stage('Init') {
steps {
echo 'make init ..'
sh 'make init INIT_OPTIONS=-y'
// echo 'skip get submodules and make test'
// sh './scripts/init.sh -y'
}
}
stage('Build') {
steps {
echo 'make build ..'
sh '. /opt/ros/kinetic/setup.sh; make build'
}
}
stage('Install') {
steps {
echo 'make install ..'
sh '. /opt/ros/kinetic/setup.sh; make install SUDO='
}
}
stage('Test') {
steps {
echo 'make test ..'
sh '. /opt/ros/kinetic/setup.sh; make test SUDO='
}
}
stage('Samples') {
steps {
echo 'make samples ..'
sh '. /opt/ros/kinetic/setup.sh; make samples SUDO='
}
}
stage('Tools') {
steps {
echo 'make tools ..'
sh '. /opt/ros/kinetic/setup.sh; make tools SUDO='
}
}
stage('ROS') {
steps {
echo 'make ros ..'
sh '''
. /opt/ros/kinetic/setup.sh
rosdep install --from-paths wrappers/ros/src --ignore-src --rosdistro kinetic -y
make ros SUDO=
'''
}
}
/*
stage('Clean') {
steps {
echo 'clean ..'
sh '''
rm -rf /var/lib/apt/lists/*
'''
}
}
*/
}
post {
always {
echo 'This will always run'
}
success {
echo 'This will run only if successful'
}
failure {
echo 'This will run only if failed'
mail to: 'mynteye-ci@slightech.com',
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}"
}
unstable {
echo 'This will run only if the run was marked as unstable'
}
changed {
echo 'This will run only if the state of the Pipeline has changed'
echo 'For example, if the Pipeline was previously failing but is now successful'
}
}
}

163
Makefile
View File

@@ -1,6 +1,30 @@
# 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 CommonDefs.mk
.DEFAULT_GOAL := help
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
# CMAKE_INSTALL_PREFIX:
# https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
#
# UNIX: /usr/local
# Windows: c:/Program Files/${PROJECT_NAME}
SUDO ?= sudo
.DEFAULT_GOAL := all
help:
@echo "Usage:"
@@ -9,20 +33,27 @@ help:
@echo " make opendoc open api doc (html)"
@echo " make init init project"
@echo " make build build project"
@echo " make test build test and run"
@echo " make install install project"
@echo " make test build test and run"
@echo " make samples build samples"
@echo " make tools build tools"
@echo " make pkg package sdk"
@echo " make ros build ros wrapper"
@echo " make py build python wrapper"
@echo " make clean|cleanall clean generated or useless things"
.PHONY: help
all: init samples tools ros
.PHONY: all
# doc
apidoc:
@$(call echo,Make $@)
@[ -e ./_install/include ] || $(MAKE) install
@# @[ -e ./_install/include ] || $(MAKE) install
@[ -e /usr/local/include/mynteye ] || $(MAKE) install
@$(SH) ./doc/build.sh
opendoc: apidoc
@@ -33,45 +64,55 @@ opendoc: apidoc
[ -f "$$html" ] && $(SH) ./scripts/open.sh $$html; \
done
.PHONY: apidoc opendoc
cleandoc:
@$(call rm,./doc/_output/)
.PHONY: apidoc opendoc cleandoc
# deps
submodules:
@git submodule update --init
third_party: submodules
@$(call echo,Make $@)
@$(call echo,Make glog,33)
@$(call cmake_build,./third_party/glog/_build)
.PHONY: submodules third_party
.PHONY: submodules
# init
init: submodules
init:
@$(call echo,Make $@)
@$(SH) ./scripts/init.sh
@$(SH) ./scripts/init.sh $(INIT_OPTIONS)
.PHONY: init
# build
build: third_party
build:
@$(call echo,Make $@)
@$(call cmake_build,./_build)
ifeq ($(HOST_OS),Win)
@$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install)
else
@$(call cmake_build,./_build,..)
endif
.PHONY: build
# test
test: install
test: submodules install
@$(call echo,Make $@)
@$(call echo,Make gtest,33)
ifeq ($(HOST_OS),Win)
@$(call cmake_build,./test/gtest/_build,..,-Dgtest_force_shared_crt=ON)
else
@$(call cmake_build,./test/gtest/_build)
endif
@$(call echo,Make test,33)
@$(call cmake_build,./test/_build)
ifeq ($(HOST_OS),Win)
@.\\\test\\\_output\\\bin\\\mynteye_test.bat
else
@./test/_output/bin/mynteye_test
endif
.PHONY: test
@@ -79,10 +120,33 @@ test: install
install: build
@$(call echo,Make $@)
ifeq ($(HOST_OS),Win)
ifneq ($(HOST_NAME),MinGW)
@cd ./_build; msbuild.exe INSTALL.vcxproj /property:Configuration=Release
else
@cd ./_build; make install
endif
else
ifeq ($(HOST_OS),Linux)
@cd ./_build; $(SUDO) make install
else
@cd ./_build; make install
endif
endif
.PHONY: install
uninstall:
@$(call echo,Make $@)
ifeq ($(HOST_OS),Linux)
$(SUDO) rm -rf /usr/local/include/mynteye/
$(SUDO) rm -rf /usr/local/lib/libmynteye.so*
$(SUDO) rm -rf /usr/local/lib/cmake/mynteye/
$(SUDO) rm -rf /usr/local/share/mynteye/
endif
.PHONY: uninstall
# samples
samples: install
@@ -99,11 +163,31 @@ tools: install
.PHONY: tools
# pkg
pkg: clean
@$(call echo,Make $@)
ifeq ($(HOST_OS),Win)
@$(SH) ./scripts/win/winpack.sh "$(PKGNAME)"
else
$(error "Can't make pkg on $(HOST_OS)")
endif
cleanpkg:
@$(call echo,Make $@)
@$(call rm_f,$(PKGNAME)*)
.PHONY: pkg cleanpkg
# ros
ros: install
@$(call echo,Make $@)
@cd ./wrappers/ros && catkin_make
ifeq ($(HOST_OS),Linux)
@cd ./wrappers/ros && catkin_make -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
else
$(error "Can't make ros on $(HOST_OS)")
endif
.PHONY: ros
@@ -121,6 +205,44 @@ cleanros:
.PHONY: cleanros
# python
PBCVT_DIR := wrappers/python/third_party/pyboostcvconverter
$(PBCVT_DIR):
@git clone https://github.com/Algomorph/pyboostcvconverter.git $@
pbcvt: $(PBCVT_DIR)
@$(call cmake_build,$(PBCVT_DIR)/_build,.., \
-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/wrappers/python/_install \
-DPYTHON_DESIRED_VERSION=2.X)
@cd $(PBCVT_DIR)/_build; make install
.PHONY: pbcvt
NPCV_DIR := wrappers/python/third_party/numpy-opencv-converter
$(NPCV_DIR):
@git clone https://github.com/GarrickLin/numpy-opencv-converter.git $@
py: python
python: install $(NPCV_DIR)
@$(call echo,Make $@)
@$(call cmake_build,./wrappers/python/_build)
@cd ./wrappers/python/_build; make install
.PHONY: py python
cleanpy:
@$(call echo,Make $@)
@$(call rm,./wrappers/python/_build/)
@$(call rm,./wrappers/python/_output/)
@$(call rm,./wrappers/python/_install/)
@$(call rm,./$(PBCVT_DIR)/_build/)
.PHONY: cleanpy
# clean
clean:
@@ -138,6 +260,7 @@ clean:
ifeq ($(HOST_OS),Linux)
@$(MAKE) cleanros
endif
@$(MAKE) cleanpy
cleanlog:
@$(call rm_f,*INFO*)
@@ -145,11 +268,12 @@ cleanlog:
@$(call rm_f,*ERROR*)
@$(call rm_f,*FATAL*)
cleanall: clean
@$(call rm,./doc/_output/)
cleanall: clean cleandoc
@$(call rm,./test/gtest/_build/)
@$(call rm,./third_party/glog/_build/)
@$(FIND) . -type f -name ".DS_Store" -print0 | xargs -0 rm -f
@$(call rm,./$(PBCVT_DIR)/)
@$(call rm,./$(NPCV_DIR)/)
.PHONY: clean cleanlog cleanall
@@ -157,6 +281,8 @@ cleanall: clean
host:
@$(call echo,Make $@)
@echo MKFILE_PATH: $(MKFILE_PATH)
@echo MKFILE_DIR: $(MKFILE_DIR)
@echo HOST_OS: $(HOST_OS)
@echo HOST_ARCH: $(HOST_ARCH)
@echo HOST_NAME: $(HOST_NAME)
@@ -169,6 +295,7 @@ host:
@echo BUILD: $(BUILD)
@echo LDD: $(LDD)
@echo CMAKE: $(CMAKE)
@echo PKGNAME: $(PKGNAME)
.PHONY: host

View File

@@ -1,11 +1,40 @@
# MYNT® EYE SDK
# MYNT® EYE S SDK
[![](https://img.shields.io/badge/MYNT%20EYE%20S%20SDK-2.2.4-brightgreen.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK)
## Overview
MYNT® EYE SDK 2.0 is a cross-platform library for MYNT® EYE cameras.
MYNT® EYE S SDK is a cross-platform library for MYNT® EYE Standard cameras.
The following platforms have been tested:
* Windows 10
* Ubuntu 16.04 / 14.04
* Jetson TX2
Please follow the guide doc to install the SDK on different platforms.
## Documentations
* [API Doc](https://github.com/slightech/MYNT-EYE-S-SDK/releases): API reference, some guides and data spec.
* en: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2717670/mynt-eye-s-sdk-apidoc-2.2.4-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2717671/mynt-eye-s-sdk-apidoc-2.2.4-en.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](https://slightech.github.io/MYNT-EYE-S-SDK/)
* zh-Hans: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2717672/mynt-eye-s-sdk-apidoc-2.2.4-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2717673/mynt-eye-s-sdk-apidoc-2.2.4-zh-Hans.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](http://doc.myntai.com/resource/api/mynt-eye-s-sdk-apidoc-2.2.4-zh-Hans/mynt-eye-s-sdk-apidoc-2.2.4-zh-Hans/index.html)
* [Guide Doc](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/releases): How to install and start using the SDK.
* en: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2717663/mynt-eye-s-sdk-guide-2.2.4-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2717664/mynt-eye-s-sdk-guide-2.2.4-en.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](https://slightech.github.io/MYNT-EYE-S-SDK-Guide/)
* zh-Hans: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2717665/mynt-eye-s-sdk-guide-2.2.4-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2717666/mynt-eye-s-sdk-guide-2.2.4-zh-Hans.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](http://doc.myntai.com/resource/sdk/mynt-eye-s-sdk-guide-2.2.4-zh-Hans/mynt-eye-s-sdk-guide-2.2.4-zh-Hans/index.html)
> Supported languages: `en`, `zh-Hans`.
## Firmwares
[MYNTEYE_BOX]: http://doc.myntai.com/mynteye/s/download
Get firmwares from our online disks: [MYNTEYE_BOX][].
## Usage
In short,
```bash
$ make
Usage:
@@ -30,13 +59,10 @@ make samples
./samples/_output/bin/device/camera_d
```
## Firmwares
## Mirrors
[Google Drive]: https://drive.google.com/drive/folders/1tdFCcTBMNcImEGZ39tdOZmlX2SHKCr2f
[百度网盘]: https://pan.baidu.com/s/1yPQDp2r0x4jvNwn2UjlMUQ
Get firmwares from our online disks: [Google Drive][], [百度网盘][].
国内镜像:[码云](https://gitee.com/mynt/MYNT-EYE-S-SDK)。
## License
This project is licensed under the Apache License, Version 2.0. Copyright 2018 Slightech Co., Ltd.
This project is licensed under the [Apache License, Version 2.0](LICENSE). Copyright 2018 Slightech Co., Ltd.

View File

@@ -1,15 +1,60 @@
# 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(${CMAKE_CURRENT_LIST_DIR}/IncludeGuard.cmake)
cmake_include_guard()
include(CMakeParseArguments)
set(CUR_DIR ${CMAKE_CURRENT_LIST_DIR})
if(MSVC OR MSYS OR MINGW)
set(OS_WIN TRUE)
set(HOST_OS Win)
elseif(APPLE)
set(OS_MAC TRUE)
set(HOST_OS Mac)
elseif(UNIX)
set(OS_LINUX TRUE)
set(HOST_OS Linux)
else()
message(FATAL_ERROR "Unsupported OS.")
endif()
set(HOST_NAME "${HOST_OS}")
if(OS_LINUX)
execute_process(COMMAND uname -a COMMAND tr -d '\n' OUTPUT_VARIABLE UNAME_A)
string(TOLOWER "${UNAME_A}" UNAME_A)
if(${UNAME_A} MATCHES ".*(tegra|jetsonbot).*")
set(OS_TEGRA TRUE)
set(HOST_NAME Tegra)
elseif(${UNAME_A} MATCHES ".*ubuntu.*")
set(OS_UBUNTU TRUE)
set(HOST_NAME Ubuntu)
endif()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/TargetArch.cmake)
target_architecture(HOST_ARCH)
message(STATUS "HOST_ARCH: ${HOST_ARCH}")
# CMAKE_CXX_COMPILER_ID
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
# CMAKE_CXX_COMPILER_VERSION
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_VERSION.html
# set_outdir(ARCHIVE_OUTPUT_DIRECTORY
# LIBRARY_OUTPUT_DIRECTORY
# RUNTIME_OUTPUT_DIRECTORY)
@@ -24,3 +69,54 @@ macro(set_outdir ARCHIVE_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY RUNTIME_OUTPU
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endforeach()
endmacro()
if(NOT __exe2bat_relative_path)
set(__exe2bat_relative_path false)
endif()
macro(exe2bat exe_name exe_dir dll_search_paths)
message(STATUS "Generating ${exe_name}.bat")
set(__exe_name ${exe_name})
if(__exe2bat_relative_path)
set(__dll_relative_search_paths "")
foreach(path ${dll_search_paths})
file(RELATIVE_PATH __relative_path "${exe_dir}" "${path}")
file(TO_NATIVE_PATH ${__relative_path} __relative_path)
list(APPEND __dll_relative_search_paths ${__relative_path})
endforeach()
set(__dll_search_paths "${__dll_relative_search_paths}")
else()
set(__dll_native_search_paths "")
foreach(path ${dll_search_paths})
file(TO_NATIVE_PATH ${path} __native_path)
list(APPEND __dll_native_search_paths ${__native_path})
endforeach()
set(__dll_search_paths "${__dll_native_search_paths}")
endif()
configure_file(
"${CUR_DIR}/templates/exe.bat.in"
"${exe_dir}/${__exe_name}.bat"
)
endmacro()
# target_create_scripts(NAME
# [BIN_DIR bin_dir]
# [DLL_SEARCH_PATHS path1 path2 ...])
macro(target_create_scripts NAME)
set(options)
set(oneValueArgs BIN_DIR)
set(multiValueArgs DLL_SEARCH_PATHS)
cmake_parse_arguments(THIS "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT THIS_BIN_DIR)
set(THIS_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
#message(STATUS "NAME: ${NAME}")
#message(STATUS "THIS_BIN_DIR: ${THIS_BIN_DIR}")
#message(STATUS "THIS_DLL_SEARCH_PATHS: ${THIS_DLL_SEARCH_PATHS}")
if(OS_WIN)
exe2bat("${NAME}" "${THIS_BIN_DIR}" "${THIS_DLL_SEARCH_PATHS}")
endif()
endmacro()

View File

@@ -1,3 +1,19 @@
# 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(${CMAKE_CURRENT_LIST_DIR}/IncludeGuard.cmake)
cmake_include_guard()
if(MSVC)

26
cmake/DetectGLog.cmake Normal file
View File

@@ -0,0 +1,26 @@
# 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(${CMAKE_CURRENT_LIST_DIR}/IncludeGuard.cmake)
cmake_include_guard()
get_filename_component(__pro_dir ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
LIST(APPEND CMAKE_PREFIX_PATH ${__pro_dir}/third_party/glog/_build)
find_package(glog REQUIRED)
if(glog_FOUND)
add_definitions(-DWITH_GLOG)
endif()
unset(__pro_dir)

54
cmake/DetectOpenCV.cmake Normal file
View File

@@ -0,0 +1,54 @@
# 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(${CMAKE_CURRENT_LIST_DIR}/IncludeGuard.cmake)
cmake_include_guard()
if(OpenCV_FIND_QUIET)
find_package(OpenCV QUIET)
else()
find_package(OpenCV REQUIRED)
endif()
if(OpenCV_FOUND)
#message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
set(WITH_OPENCV TRUE)
add_definitions(-DWITH_OPENCV)
if(OpenCV_VERSION VERSION_LESS 3.0)
add_definitions(-DWITH_OPENCV2)
elseif(OpenCV_VERSION VERSION_LESS 4.0)
add_definitions(-DWITH_OPENCV3)
else()
add_definitions(-DWITH_OPENCV4)
endif()
list(FIND OpenCV_LIBS "opencv_world" __index)
if(${__index} GREATER -1)
set(WITH_OPENCV_WORLD TRUE)
endif()
if(MSVC OR MSYS OR MINGW)
get_filename_component(OpenCV_LIB_SEARCH_PATH "${OpenCV_LIB_PATH}/../bin" ABSOLUTE)
else()
set(OpenCV_LIB_SEARCH_PATH "${OpenCV_LIB_PATH}")
endif()
else()
set(WITH_OPENCV FALSE)
endif()

1741
cmake/FindCUDA.cmake Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
#
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
#
# Copyright (c) 2007-2009
# Scientific Computing and Imaging Institute, University of Utah
#
# This code is licensed under the MIT License. See the FindCUDA.cmake script
# for the text of the license.
# The MIT License
#
# License for the specific language governing rights and limitations under
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
#######################################################################
# This converts a file written in makefile syntax into one that can be included
# by CMake.
file(READ ${input_file} depend_text)
if (NOT "${depend_text}" STREQUAL "")
# message("FOUND DEPENDS")
string(REPLACE "\\ " " " depend_text ${depend_text})
# This works for the nvcc -M generated dependency files.
string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text})
set(dependency_list "")
foreach(file ${depend_text})
string(REGEX REPLACE "^ +" "" file ${file})
# OK, now if we had a UNC path, nvcc has a tendency to only output the first '/'
# instead of '//'. Here we will test to see if the file exists, if it doesn't then
# try to prepend another '/' to the path and test again. If it still fails remove the
# path.
if(NOT EXISTS "${file}")
if (EXISTS "/${file}")
set(file "/${file}")
else()
message(WARNING " Removing non-existent dependency file: ${file}")
set(file "")
endif()
endif()
if(NOT IS_DIRECTORY "${file}")
# If softlinks start to matter, we should change this to REALPATH. For now we need
# to flatten paths, because nvcc can generate stuff like /bin/../include instead of
# just /include.
get_filename_component(file_absolute "${file}" ABSOLUTE)
list(APPEND dependency_list "${file_absolute}")
endif()
endforeach()
else()
# message("FOUND NO DEPENDS")
endif()
# Remove the duplicate entries and sort them.
list(REMOVE_DUPLICATES dependency_list)
list(SORT dependency_list)
foreach(file ${dependency_list})
set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n")
endforeach()
file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n")

View File

@@ -0,0 +1,109 @@
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
#
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
#
# Copyright (c) 2007-2009
# Scientific Computing and Imaging Institute, University of Utah
#
# This code is licensed under the MIT License. See the FindCUDA.cmake script
# for the text of the license.
# The MIT License
#
# License for the specific language governing rights and limitations under
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
#######################################################################
# Parses a .cubin file produced by nvcc and reports statistics about the file.
file(READ ${input_file} file_text)
if (NOT "${file_text}" STREQUAL "")
string(REPLACE ";" "\\;" file_text ${file_text})
string(REPLACE "\ncode" ";code" file_text ${file_text})
list(LENGTH file_text len)
foreach(line ${file_text})
# Only look at "code { }" blocks.
if(line MATCHES "^code")
# Break into individual lines.
string(REGEX REPLACE "\n" ";" line ${line})
foreach(entry ${line})
# Extract kernel names.
if (${entry} MATCHES "[^g]name = ([^ ]+)")
set(entry "${CMAKE_MATCH_1}")
# Check to see if the kernel name starts with "_"
set(skip FALSE)
# if (${entry} MATCHES "^_")
# Skip the rest of this block.
# message("Skipping ${entry}")
# set(skip TRUE)
# else ()
message("Kernel: ${entry}")
# endif ()
endif()
# Skip the rest of the block if necessary
if(NOT skip)
# Registers
if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
set(entry "${CMAKE_MATCH_3}")
message("Registers: ${entry}")
endif()
# Local memory
if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
set(entry "${CMAKE_MATCH_3}")
message("Local: ${entry}")
endif()
# Shared memory
if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
set(entry "${CMAKE_MATCH_3}")
message("Shared: ${entry}")
endif()
if (${entry} MATCHES "^}")
message("")
endif()
endif()
endforeach()
endif()
endforeach()
else()
# message("FOUND NO DEPENDS")
endif()

View File

@@ -0,0 +1,288 @@
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
#
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
#
# This code is licensed under the MIT License. See the FindCUDA.cmake script
# for the text of the license.
# The MIT License
#
# License for the specific language governing rights and limitations under
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
##########################################################################
# This file runs the nvcc commands to produce the desired output file along with
# the dependency file needed by CMake to compute dependencies. In addition the
# file checks the output of each command and if the command fails it deletes the
# output files.
# Input variables
#
# verbose:BOOL=<> OFF: Be as quiet as possible (default)
# ON : Describe each step
#
# build_configuration:STRING=<> Typically one of Debug, MinSizeRel, Release, or
# RelWithDebInfo, but it should match one of the
# entries in CUDA_HOST_FLAGS. This is the build
# configuration used when compiling the code. If
# blank or unspecified Debug is assumed as this is
# what CMake does.
#
# generated_file:STRING=<> File to generate. This argument must be passed in.
#
# generated_cubin_file:STRING=<> File to generate. This argument must be passed
# in if build_cubin is true.
if(NOT generated_file)
message(FATAL_ERROR "You must specify generated_file on the command line")
endif()
# Set these up as variables to make reading the generated file easier
set(CMAKE_COMMAND "@CMAKE_COMMAND@") # path
set(source_file "@source_file@") # path
set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@") # path
set(cmake_dependency_file "@cmake_dependency_file@") # path
set(CUDA_make2cmake "@CUDA_make2cmake@") # path
set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
set(build_cubin @build_cubin@) # bool
set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path
# We won't actually use these variables for now, but we need to set this, in
# order to force this file to be run again if it changes.
set(generated_file_path "@generated_file_path@") # path
set(generated_file_internal "@generated_file@") # path
set(generated_cubin_file_internal "@generated_cubin_file@") # path
set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path
set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list
@CUDA_NVCC_FLAGS_CONFIG@
set(nvcc_flags "@nvcc_flags@") # list
set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly).
set(format_flag "@format_flag@") # string
if(build_cubin AND NOT generated_cubin_file)
message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
endif()
# This is the list of host compilation flags. It C or CXX should already have
# been chosen by FindCUDA.cmake.
@CUDA_HOST_FLAGS@
# Take the compiler flags and package them up to be sent to the compiler via -Xcompiler
set(nvcc_host_compiler_flags "")
# If we weren't given a build_configuration, use Debug.
if(NOT build_configuration)
set(build_configuration Debug)
endif()
string(TOUPPER "${build_configuration}" build_configuration)
#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}")
foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
# Extra quotes are added around each flag to help nvcc parse out flags with spaces.
set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"")
endforeach()
if (nvcc_host_compiler_flags)
set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags})
endif()
#message("nvcc_host_compiler_flags = \"${nvcc_host_compiler_flags}\"")
# Add the build specific configuration flags
list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
if (CUDA_HOST_COMPILER STREQUAL "@_CUDA_MSVC_HOST_COMPILER@" AND DEFINED CCBIN)
set(CCBIN -ccbin "${CCBIN}")
else()
set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
endif()
endif()
# cuda_execute_process - Executes a command with optional command echo and status message.
#
# status - Status message to print if verbose is true
# command - COMMAND argument from the usual execute_process argument structure
# ARGN - Remaining arguments are the command with arguments
#
# CUDA_result - return value from running the command
#
# Make this a macro instead of a function, so that things like RESULT_VARIABLE
# and other return variables are present after executing the process.
macro(cuda_execute_process status command)
set(_command ${command})
if(NOT "x${_command}" STREQUAL "xCOMMAND")
message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
endif()
if(verbose)
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status})
# Now we need to build up our command string. We are accounting for quotes
# and spaces, anything else is left up to the user to fix if they want to
# copy and paste a runnable command line.
set(cuda_execute_process_string)
foreach(arg ${ARGN})
# If there are quotes, excape them, so they come through.
string(REPLACE "\"" "\\\"" arg ${arg})
# Args with spaces need quotes around them to get them to be parsed as a single argument.
if(arg MATCHES " ")
list(APPEND cuda_execute_process_string "\"${arg}\"")
else()
list(APPEND cuda_execute_process_string ${arg})
endif()
endforeach()
# Echo the command
execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string})
endif()
# Run the command
execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result )
endmacro()
# Delete the target file
cuda_execute_process(
"Removing ${generated_file}"
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
)
# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag
# for dependency generation and hope for the best.
set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
set(CUDA_VERSION @CUDA_VERSION@)
if(CUDA_VERSION VERSION_LESS "3.0")
cmake_policy(PUSH)
# CMake policy 0007 NEW states that empty list elements are not
# ignored. I'm just setting it to avoid the warning that's printed.
cmake_policy(SET CMP0007 NEW)
# Note that this will remove all occurrences of -G.
list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
cmake_policy(POP)
endif()
# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This
# can cause incorrect dependencies when #including files based on this macro which is
# defined in the generating passes of nvcc invocation. We will go ahead and manually
# define this for now until a future version fixes this bug.
set(CUDACC_DEFINE -D__CUDACC__)
# Generate the dependency file
cuda_execute_process(
"Generating dependency file: ${NVCC_generated_dependency_file}"
COMMAND "${CUDA_NVCC_EXECUTABLE}"
-M
${CUDACC_DEFINE}
"${source_file}"
-o "${NVCC_generated_dependency_file}"
${CCBIN}
${nvcc_flags}
${nvcc_host_compiler_flags}
${depends_CUDA_NVCC_FLAGS}
-DNVCC
${CUDA_NVCC_INCLUDE_ARGS}
)
if(CUDA_result)
message(FATAL_ERROR "Error generating ${generated_file}")
endif()
# Generate the cmake readable dependency file to a temp file. Don't put the
# quotes just around the filenames for the input_file and output_file variables.
# CMake will pass the quotes through and not be able to find the file.
cuda_execute_process(
"Generating temporary cmake readable file: ${cmake_dependency_file}.tmp"
COMMAND "${CMAKE_COMMAND}"
-D "input_file:FILEPATH=${NVCC_generated_dependency_file}"
-D "output_file:FILEPATH=${cmake_dependency_file}.tmp"
-P "${CUDA_make2cmake}"
)
if(CUDA_result)
message(FATAL_ERROR "Error generating ${generated_file}")
endif()
# Copy the file if it is different
cuda_execute_process(
"Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}"
)
if(CUDA_result)
message(FATAL_ERROR "Error generating ${generated_file}")
endif()
# Delete the temporary file
cuda_execute_process(
"Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}"
COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
)
if(CUDA_result)
message(FATAL_ERROR "Error generating ${generated_file}")
endif()
# Generate the code
cuda_execute_process(
"Generating ${generated_file}"
COMMAND "${CUDA_NVCC_EXECUTABLE}"
"${source_file}"
${format_flag} -o "${generated_file}"
${CCBIN}
${nvcc_flags}
${nvcc_host_compiler_flags}
${CUDA_NVCC_FLAGS}
-DNVCC
${CUDA_NVCC_INCLUDE_ARGS}
)
if(CUDA_result)
# Since nvcc can sometimes leave half done files make sure that we delete the output file.
cuda_execute_process(
"Removing ${generated_file}"
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
)
message(FATAL_ERROR "Error generating file ${generated_file}")
else()
if(verbose)
message("Generated ${generated_file} successfully.")
endif()
endif()
# Cubin resource report commands.
if( build_cubin )
# Run with -cubin to produce resource usage report.
cuda_execute_process(
"Generating ${generated_cubin_file}"
COMMAND "${CUDA_NVCC_EXECUTABLE}"
"${source_file}"
${CUDA_NVCC_FLAGS}
${nvcc_flags}
${CCBIN}
${nvcc_host_compiler_flags}
-DNVCC
-cubin
-o "${generated_cubin_file}"
${CUDA_NVCC_INCLUDE_ARGS}
)
# Execute the parser script.
cuda_execute_process(
"Executing the parser script"
COMMAND "${CMAKE_COMMAND}"
-D "input_file:STRING=${generated_cubin_file}"
-P "${CUDA_parse_cubin}"
)
endif()

23
cmake/IncludeGuard.cmake Normal file
View File

@@ -0,0 +1,23 @@
# 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_guard: https://cmake.org/cmake/help/latest/command/include_guard.html
macro(cmake_include_guard)
get_property(INCLUDE_GUARD GLOBAL PROPERTY "_INCLUDE_GUARD_${CMAKE_CURRENT_LIST_FILE}")
if(INCLUDE_GUARD)
return()
endif()
set_property(GLOBAL PROPERTY "_INCLUDE_GUARD_${CMAKE_CURRENT_LIST_FILE}" TRUE)
endmacro()

154
cmake/Option.cmake Normal file
View File

@@ -0,0 +1,154 @@
# 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(${CMAKE_CURRENT_LIST_DIR}/IncludeGuard.cmake)
cmake_include_guard()
include(${CMAKE_CURRENT_LIST_DIR}/Utils.cmake)
# build components
option(WITH_API "Build with API layer, need OpenCV" ON)
option(WITH_DEVICE_INFO_REQUIRED "Build with device info required" ON)
# 3rdparty components
option(WITH_BOOST "Include Boost support" ON)
# How to install glog?
# Ubuntu: `sudo apt-get install libgoogle-glog-dev`
option(WITH_GLOG "Include glog support" OFF)
# packages
if(WITH_API)
include(${CMAKE_CURRENT_LIST_DIR}/DetectOpenCV.cmake)
endif()
if(WITH_DEVICE_INFO_REQUIRED)
add_definitions(-DWITH_DEVICE_INFO_REQUIRED)
endif()
if(WITH_BOOST)
find_package(Boost COMPONENTS filesystem)
if(Boost_FOUND)
set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
set(WITH_FILESYSTEM TRUE)
set(WITH_BOOST_FILESYSTEM TRUE)
add_definitions(-DWITH_FILESYSTEM)
add_definitions(-DWITH_BOOST_FILESYSTEM)
endif()
endif()
if(NOT WITH_FILESYSTEM)
if(MSVC OR MSYS OR MINGW) # win
set(WITH_FILESYSTEM TRUE)
set(WITH_NATIVE_FILESYSTEM TRUE)
add_definitions(-DWITH_FILESYSTEM)
add_definitions(-DWITH_NATIVE_FILESYSTEM)
endif()
endif()
if(WITH_GLOG)
include(${CMAKE_CURRENT_LIST_DIR}/DetectGLog.cmake)
endif()
find_package(CUDA QUIET)
# summary
set_version_values(CMAKE_CXX_COMPILER_VERSION)
status("")
status("Platform:")
status(" HOST_OS: ${HOST_OS}")
status(" HOST_NAME: ${HOST_NAME}")
status(" HOST_ARCH: ${HOST_ARCH}")
status(" HOST_COMPILER: ${CMAKE_CXX_COMPILER_ID}")
status(" COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
status(" COMPILER_VERSION_MAJOR: ${CMAKE_CXX_COMPILER_VERSION_MAJOR}")
status(" COMPILER_VERSION_MINOR: ${CMAKE_CXX_COMPILER_VERSION_MINOR}")
status(" COMPILER_VERSION_PATCH: ${CMAKE_CXX_COMPILER_VERSION_PATCH}")
status(" COMPILER_VERSION_TWEAK: ${CMAKE_CXX_COMPILER_VERSION_TWEAK}")
if(CUDA_FOUND)
status(" CUDA_VERSION: ${CUDA_VERSION}")
status(" CUDA_VERSION_MAJOR: ${CUDA_VERSION_MAJOR}")
status(" CUDA_VERSION_MINOR: ${CUDA_VERSION_MINOR}")
status(" CUDA_VERSION_STRING: ${CUDA_VERSION_STRING}")
endif()
if(OpenCV_FOUND)
status(" OpenCV_VERSION: ${OpenCV_VERSION}")
status(" OpenCV_VERSION_MAJOR: ${OpenCV_VERSION_MAJOR}")
status(" OpenCV_VERSION_MINOR: ${OpenCV_VERSION_MINOR}")
status(" OpenCV_VERSION_PATCH: ${OpenCV_VERSION_PATCH}")
status(" OpenCV_VERSION_TWEAK: ${OpenCV_VERSION_TWEAK}")
status(" OpenCV_VERSION_STATUS: ${OpenCV_VERSION_STATUS}")
status(" OpenCV_WITH_WORLD: ${WITH_OPENCV_WORLD}")
endif()
if(mynteye_VERSION)
status(" MYNTEYE_VERSION: ${mynteye_VERSION}")
status(" MYNTEYE_VERSION_MAJOR: ${mynteye_VERSION_MAJOR}")
status(" MYNTEYE_VERSION_MINOR: ${mynteye_VERSION_MINOR}")
status(" MYNTEYE_VERSION_PATCH: ${mynteye_VERSION_PATCH}")
status(" MYNTEYE_VERSION_TWEAK: ${mynteye_VERSION_TWEAK}")
endif()
status("")
status("Options:")
status(" WITH_API: ${WITH_API}")
if(WITH_API)
if(OpenCV_FOUND)
status(" OpenCV: YES")
status(" OpenCV_VERSION: ${OpenCV_VERSION}")
status(" OpenCV_WORLD: " IF WITH_OPENCV_WORLD "YES" ELSE "NO")
else()
status(" OpenCV: NO")
endif()
endif()
status(" WITH_DEVICE_INFO_REQUIRED: ${WITH_DEVICE_INFO_REQUIRED}")
status(" WITH_BOOST: ${WITH_BOOST}")
if(WITH_BOOST)
if(Boost_FOUND)
status(" Boost: YES")
status(" Boost_VERSION: ${Boost_VERSION_STRING}")
#status(" Boost_LIBRARIES: ${Boost_LIBRARIES}")
else()
status(" Boost: NO")
endif()
endif()
status(" WITH_GLOG: ${WITH_GLOG}")
if(WITH_GLOG)
if(glog_FOUND)
status(" glog: YES")
status(" glog_VERSION: ${glog_VERSION}")
else()
status(" glog: NO")
endif()
endif()
status("")
status("Features:")
status(" Filesystem: "
IF WITH_BOOST_FILESYSTEM "boost"
ELIF WITH_NATIVE_FILESYSTEM "native"
ELSE "none"
)
status("")

167
cmake/TargetArch.cmake Executable file
View File

@@ -0,0 +1,167 @@
# Based on the Qt 5 processor detection code, so should be very accurate
# http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/global/qprocessordetection.h
# Currently handles arm (v5, v6, v7, v8), x86 (32/64), ia64, and ppc (32/64)
# Regarding POWER/PowerPC, just as is noted in the Qt source,
# "There are many more known variants/revisions that we do not handle/detect."
set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) \\
|| defined(__aarch64__) || defined(__ARM64__)
#if defined(__aarch64__) || defined(__ARM64__)
#define cmake_ARM_64
#else
#define cmake_ARM_32
#endif
#if defined(__ARM_ARCH) && __ARM_ARCH > 1
#define cmake_ARM __ARM_ARCH
#elif defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM > 1
#define cmake_ARM __TARGET_ARCH_ARM
#elif defined(_M_ARM) && _M_ARM > 1
#define cmake_ARM _M_ARM
#elif defined(__ARM64_ARCH_8__) \\
|| defined(__aarch64__) \\
|| defined(__ARMv8__) \\
|| defined(__ARMv8_A__)
#define cmake_ARM 8
#elif defined(__ARM_ARCH_7__) \\
|| defined(__ARM_ARCH_7A__) \\
|| defined(__ARM_ARCH_7R__) \\
|| defined(__ARM_ARCH_7M__) \\
|| defined(__ARM_ARCH_7S__) \\
|| defined(_ARM_ARCH_7) \\
|| defined(__CORE_CORTEXA__)
#define cmake_ARM 7
#elif defined(__ARM_ARCH_6__) \\
|| defined(__ARM_ARCH_6J__) \\
|| defined(__ARM_ARCH_6T2__) \\
|| defined(__ARM_ARCH_6Z__) \\
|| defined(__ARM_ARCH_6K__) \\
|| defined(__ARM_ARCH_6ZK__) \\
|| defined(__ARM_ARCH_6M__)
#define cmake_ARM 6
#elif defined(__ARM_ARCH_5TEJ__) \\
|| defined(__ARM_ARCH_5TE__)
#define cmake_ARM 5
#else
#define cmake_ARM 0
#endif
#if cmake_ARM >= 8
#error cmake_ARCH armv8
#elif cmake_ARM >= 7
#error cmake_ARCH armv7
#elif cmake_ARM >= 6
#error cmake_ARCH armv6
#elif cmake_ARM >= 5
#error cmake_ARCH armv5
#else
#if defined(cmake_ARM_64)
#error cmake_ARCH arm64
#else
#error cmake_ARCH arm
#endif
#endif
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#error cmake_ARCH x86_64
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
#error cmake_ARCH ia64
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
|| defined(_M_MPPC) || defined(_M_PPC)
#if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
#error cmake_ARCH ppc64
#else
#error cmake_ARCH ppc
#endif
#endif
#error cmake_ARCH unknown
")
# Set ppc_support to TRUE before including this file or ppc and ppc64
# will be treated as invalid architectures since they are no longer supported by Apple
function(target_architecture output_var)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
# On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
# First let's normalize the order of the values
# Note that it's not possible to compile PowerPC applications if you are using
# the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
# disable it by default
# See this page for more information:
# http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4
# Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
# On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
set(osx_arch_ppc TRUE)
elseif("${osx_arch}" STREQUAL "i386")
set(osx_arch_i386 TRUE)
elseif("${osx_arch}" STREQUAL "x86_64")
set(osx_arch_x86_64 TRUE)
elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
set(osx_arch_ppc64 TRUE)
else()
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
endif()
endforeach()
# Now add all the architectures in our normalized order
if(osx_arch_ppc)
list(APPEND ARCH ppc)
endif()
if(osx_arch_i386)
list(APPEND ARCH i386)
endif()
if(osx_arch_x86_64)
list(APPEND ARCH x86_64)
endif()
if(osx_arch_ppc64)
list(APPEND ARCH ppc64)
endif()
else()
file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")
enable_language(C)
# Detect the architecture in a rather creative way...
# This compiles a small C program which is a series of ifdefs that selects a
# particular #error preprocessor directive whose message string contains the
# target architecture. The program will always fail to compile (both because
# file is not a valid C program, and obviously because of the presence of the
# #error preprocessor directives... but by exploiting the preprocessor in this
# way, we can detect the correct target architecture even when cross-compiling,
# since the program itself never needs to be run (only the compiler/preprocessor)
try_run(
run_result_unused
compile_result_unused
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}/arch.c"
COMPILE_OUTPUT_VARIABLE ARCH
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
)
# Parse the architecture name from the compiler output
string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
# Get rid of the value marker leaving just the architecture name
string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
# If we are compiling with an unknown architecture this variable should
# already be set to "unknown" but in the case that it's empty (i.e. due
# to a typo in the code), then set it to unknown
if (NOT ARCH)
set(ARCH unknown)
endif()
endif()
set(${output_var} "${ARCH}" PARENT_SCOPE)
endfunction()

136
cmake/Utils.cmake Normal file
View File

@@ -0,0 +1,136 @@
# 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(${CMAKE_CURRENT_LIST_DIR}/IncludeGuard.cmake)
cmake_include_guard()
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
# make_executable(NAME
# [SRCS src1 src2 ...]
# [LINK_LIBS lib1 lib2 ...]
# [DLL_SEARCH_PATHS path1 path2 ...]
# [WITH_THREAD])
macro(make_executable NAME)
set(options WITH_THREAD)
set(oneValueArgs)
set(multiValueArgs SRCS LINK_LIBS DLL_SEARCH_PATHS)
cmake_parse_arguments(THIS "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
add_executable(${NAME} ${THIS_SRCS})
target_link_libraries(${NAME} ${THIS_LINK_LIBS})
target_create_scripts(${NAME} DLL_SEARCH_PATHS ${THIS_DLL_SEARCH_PATHS})
if(OS_WIN)
target_compile_definitions(${NAME}
PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES
)
endif()
if(THIS_WITH_THREAD)
#find_package(Threads REQUIRED)
if(THREADS_HAVE_PTHREAD_ARG)
target_compile_options(PUBLIC ${NAME} "-pthread")
endif()
if(CMAKE_THREAD_LIBS_INIT)
target_link_libraries(${NAME} "${CMAKE_THREAD_LIBS_INIT}")
endif()
endif()
endmacro()
# set_default_value(VARIABLE DEFAULT)
macro(set_default_value VARIABLE DEFAULT)
if(NOT ${VARIABLE})
set(${VARIABLE} ${DEFAULT})
endif()
endmacro()
# set_version_values(VARIABLE)
macro(set_version_values VARIABLE)
string(REPLACE "." ";" __version_list "${${VARIABLE}}")
list(LENGTH __version_list __len)
if(${__len} GREATER 0)
list(GET __version_list 0 ${VARIABLE}_MAJOR)
endif()
if(${__len} GREATER 1)
list(GET __version_list 1 ${VARIABLE}_MINOR)
endif()
if(${__len} GREATER 2)
list(GET __version_list 2 ${VARIABLE}_PATCH)
endif()
if(${__len} GREATER 3)
list(GET __version_list 3 ${VARIABLE}_TWEAK)
endif()
endmacro()
# status(TEXT [IF cond text [ELIF cond text] [ELSE cond text]])
macro(status TEXT)
set(options)
set(oneValueArgs)
set(multiValueArgs IF ELIF ELSE)
cmake_parse_arguments(THIS "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
#message(STATUS "TEXT: ${TEXT}")
#message(STATUS "THIS_IF: ${THIS_IF}")
#message(STATUS "THIS_ELIF: ${THIS_ELIF}")
#message(STATUS "THIS_ELSE: ${THIS_ELSE}")
set(__msg_list "${TEXT}")
set(__continue TRUE)
if(__continue AND DEFINED THIS_IF)
#message(STATUS "-- THIS_IF: ${THIS_IF}")
list(LENGTH THIS_IF __if_len)
if(${__if_len} GREATER 1)
list(GET THIS_IF 0 __if_cond)
if(${__if_cond})
list(REMOVE_AT THIS_IF 0)
list(APPEND __msg_list ${THIS_IF})
set(__continue FALSE)
endif()
else()
message(FATAL_ERROR "status() IF must have cond and text, >= 2 items")
endif()
endif()
if(__continue AND DEFINED THIS_ELIF)
#message(STATUS "-- THIS_ELIF: ${THIS_ELIF}")
list(LENGTH THIS_ELIF __elif_len)
if(${__elif_len} GREATER 1)
list(GET THIS_ELIF 0 __elif_cond)
if(${__elif_cond})
list(REMOVE_AT THIS_ELIF 0)
list(APPEND __msg_list ${THIS_ELIF})
set(__continue FALSE)
endif()
else()
message(FATAL_ERROR "status() ELIF must have cond and text, >= 2 items")
endif()
endif()
if(__continue AND DEFINED THIS_ELSE)
#message(STATUS "-- THIS_ELSE: ${THIS_ELSE}")
list(LENGTH THIS_ELSE __else_len)
if(${__else_len} GREATER 0)
list(APPEND __msg_list ${THIS_ELSE})
else()
message(FATAL_ERROR "status() ELSE must have text, >= 1 items")
endif()
endif()
string(REPLACE ";" "" __msg_list "${__msg_list}")
message(STATUS "${__msg_list}")
endmacro()

View File

@@ -0,0 +1,27 @@
%YAML:1.0
---
HOST_OS: "@HOST_OS@"
HOST_NAME: "@HOST_NAME@"
HOST_ARCH: "@HOST_ARCH@"
HOST_COMPILER: "@CMAKE_CXX_COMPILER_ID@"
COMPILER_VERSION: "@CMAKE_CXX_COMPILER_VERSION@"
COMPILER_VERSION_MAJOR: @CMAKE_CXX_COMPILER_VERSION_MAJOR@
COMPILER_VERSION_MINOR: @CMAKE_CXX_COMPILER_VERSION_MINOR@
COMPILER_VERSION_PATCH: @CMAKE_CXX_COMPILER_VERSION_PATCH@
COMPILER_VERSION_TWEAK: @CMAKE_CXX_COMPILER_VERSION_TWEAK@
CUDA_VERSION: "@CUDA_VERSION@"
CUDA_VERSION_MAJOR: @CUDA_VERSION_MAJOR@
CUDA_VERSION_MINOR: @CUDA_VERSION_MINOR@
CUDA_VERSION_STRING: "@CUDA_VERSION_STRING@"
OpenCV_VERSION: "@OpenCV_VERSION@"
OpenCV_VERSION_MAJOR: @OpenCV_VERSION_MAJOR@
OpenCV_VERSION_MINOR: @OpenCV_VERSION_MINOR@
OpenCV_VERSION_PATCH: @OpenCV_VERSION_PATCH@
OpenCV_VERSION_TWEAK: @OpenCV_VERSION_TWEAK@
OpenCV_VERSION_STATUS: "@OpenCV_VERSION_STATUS@"
OpenCV_WITH_WORLD: "@WITH_OPENCV_WORLD@"
MYNTEYE_VERSION: "@mynteye_VERSION@"
MYNTEYE_VERSION_MAJOR: @mynteye_VERSION_MAJOR@
MYNTEYE_VERSION_MINOR: @mynteye_VERSION_MINOR@
MYNTEYE_VERSION_PATCH: @mynteye_VERSION_PATCH@
MYNTEYE_VERSION_TWEAK: @mynteye_VERSION_TWEAK@

View File

@@ -0,0 +1,13 @@
@echo off
set "MY_DIR=%~dp0"
set "MY_PWD=%cd%"
if "%MY_PATH_SET_@__exe_name@%"=="" (
set "MY_PATH_SET_@__exe_name@=1"
set "PATH=@__dll_search_paths@;%PATH%"
)
::cd "%MY_DIR%"
"%MY_DIR%@__exe_name@.exe" %*
::cd "%MY_PWD%"
::pause >nul

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
OpenCV_VERSION=@OpenCV_VERSION@
OpenCV_VERSION_MAJOR=@OpenCV_VERSION_MAJOR@
OpenCV_VERSION_MINOR=@OpenCV_VERSION_MINOR@
OpenCV_VERSION_PATCH=@OpenCV_VERSION_PATCH@
OpenCV_VERSION_STATUS=@OpenCV_VERSION_STATUS@
_contains() {
[ `echo $1 | grep -c "$2"` -gt 0 ]
}
if _contains "@OpenCV_INCLUDE_DIRS@" "/ros/"; then
ROS_VERSION=$(rosversion -d)
OpenCV_VERSION=ros-$ROS_VERSION
fi

View File

@@ -1,4 +1,18 @@
#!/usr/bin/env bash
# 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.
# _VERBOSE_=1
# _TEST_=1
@@ -26,8 +40,8 @@ OUTPUT="$BASE_DIR/_output"
_texcjk() {
tex="$1"; shift;
_echo_in "add cjk to $tex"
sed -i "" -e $'s/^\\\\begin{document}$/\\\\usepackage{CJKutf8}\\\n\\\\begin{document}\\\n\\\\begin{CJK}{UTF8}{gbsn}/g' $tex
sed -i "" -e $'s/^\\\\end{document}$/\\\\end{CJK}\\\n\\\\end{document}/g' $tex
sed -i "" -E $'s/^\\\\begin{document}$/\\\\usepackage{CJKutf8}\\\n\\\\begin{document}\\\n\\\\begin{CJK}{UTF8}{gbsn}/g' $tex
sed -i "" -E $'s/^\\\\end{document}$/\\\\end{CJK}\\\n\\\\end{document}/g' $tex
}
for lang in "${LANGS[@]}"; do
@@ -38,11 +52,30 @@ for lang in "${LANGS[@]}"; do
_mkdir "$OUTPUT/$lang"
_echo_i "doxygen $DOXYFILE"
doxygen $DOXYFILE
version=`cat $DOXYFILE | grep -m1 "^PROJECT_NUMBER\s*=" | \
sed -E "s/^.*=[[:space:]]*(.*)[[:space:]]*$/\1/g"`
# html
if [ -d "$OUTPUT/$lang/html" ]; then
dirname="mynt-eye-s-sdk-apidoc"; \
[ -n "$version" ] && dirname="$dirname-$version"; \
dirname="$dirname-$lang"
cd "$OUTPUT/$lang"
[ -d "$dirname" ] && rm -rf "$dirname"
mv "html" "$dirname" && zip -r "$dirname.zip" "$dirname"
fi
# latex
if [ $pdflatex_FOUND ] && [ -f "$OUTPUT/$lang/latex/Makefile" ]; then
_echo_in "doxygen make latex"
filename="mynt-eye-s-sdk-apidoc"; \
[ -n "$version" ] && filename="$filename-$version"; \
filename="$filename-$lang.pdf"
cd "$OUTPUT/$lang/latex" && _texcjk refman.tex && make
[ -f "refman.pdf" ] && mv "refman.pdf" "../mynteye-apidoc.pdf"
[ -f "refman.pdf" ] && mv "refman.pdf" "../$filename"
fi
_echo_d "doxygen completed"
else
_echo_e "$DOXYFILE not found"

2495
doc/en/api.doxyfile Normal file

File diff suppressed because it is too large Load Diff

11
doc/en/mainpage.md Normal file
View File

@@ -0,0 +1,11 @@
# MYNT EYE S SDK {#mainpage}
* <a class="el" href="annotated.html">API Classes</a>
* <a class="el" href="modules.html">API Modules</a>
* \link enumerations Enumerations\endlink
* \link datatypes Datatypes\endlink
* \link utils Utiliities\endlink
* \link calibration Intrinsics & Extrinsics\endlink
* <span style="font-weight:bold">Device Specifications</span>
* @subpage specs_data
* @subpage specs_ctrl

View File

@@ -0,0 +1,26 @@
# Control Protocols {#spec_control_api}
There are two control modes, one is through UVC standard protocol, the other is through UVC custom protocol with extension unit.
## Standard Protocol
| Name | Field | Bytes | Default | Min | Max | Stored | Flash Address | Note |
| :--- | :---- | :---- | :------ | :-- | :-- | :----- | :------------ | :--- |
| Gain | gain | 2 | 24 | 0 | 48 | √ | 0x12 | valid if manual-exposure |
| Brightness | brightness/exposure_time | 2 | 120 | 0 | 240 | √ | 0x14 | valid if manual-exposure |
| Contrast | contrast/black_level_calibration | 2 | 127 | 0 | 255 | √ | 0x10 | valid if manual-exposure |
## Custom Protocol
| Name | Field | Bytes | Default | Min | Max | Stored | Flash Address | Channel | Note |
| :--- | :---- | :---- | :------ | :-- | :-- | :----- | :------------ | :------ | :----- |
| Frame rate | frame_rate | 2 | 25 | 10 | 60 | √ | 0x21 | XU_CAM_CTRL | values: {10,15,20,25,30,35,40,45,50,55,60} |
| IMU frequency | imu_frequency | 2 | 200 | 100 | 500 | √ | 0x23 | XU_CAM_CTRL | values: {100,200,250,333,500} |
| Exposure mode | exposure_mode | 1 | 0 | 0 | 1 | √ | 0x0F | XU_CAM_CTRL | 0: enable auto-exposure; 1: manual-exposure |
| Max gain | max_gain | 2 | 48 | 0 | 48 | √ | 0x1D | XU_CAM_CTRL | valid if auto-exposure |
| Max exposure time | max_exposure_time | 2 | 240 | 0 | 240 | √ | 0x1B | XU_CAM_CTRL | valid if auto-exposure |
| Desired brightness | desired_brightness | 2 | 192 | 0 | 255 | √ | 0x19 | XU_CAM_CTRL | valid if auto-exposure |
| IR control | ir_control | 1 | 0 | 0 | 160 | × | - | XU_CAM_CTRL | |
| HDR mode | hdr_mode | 1 | 0 | 0 | 1 | √ | 0x1F | XU_CAM_CTRL | 0: 10-bit; 1: 12-bit |
| Zero drift calibration | zero_drift_calibration | | - | - | - | × | - | XU_HALF_DUPLEX | |
| Erase chip | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | |

View File

@@ -0,0 +1,53 @@
# Control Channels {#spec_control_channel}
| Name | Field | Address | Bandwidth | Node |
| :----- | :----- | :----- | :----- | :----- |
| Camera control channel | XU_CAM_CTRL_CHANNEL | 1 | 3 | |
| Half-Duplex channel | XU_HALF_DUPLEX_CHANNEL | 2 | 20 | |
| IMU write channel | XU_IMUDATA_WRITE_CHANNEL | 3 | 5 | |
| IMU read channel | XU_IMUDATA_READ_CHANNEL | 4 | 2000 | |
| File channel | XU_FILE_CHANNEL | 5 | 2000 | |
## Camera Control Channel
The channel provides get, set and query (min, max, default).
## Half-Duplex Channel
The channel only provides set, such as zero drift correction.
## IMU Channel
The channel is used to request and response IMU data, see @ref spec_imu_data.
## File Channel
The channel is used to read and write device information, image params, and IMU params.
| Name | Header | Size | File | Checksum |
| :--- | :- | :--- | :--- | :-------- |
| Bytes | 1 | 2 | - | 1 |
| Type | uint8_t | uint16_t | - | uint8_t |
| Description | Flags | Content size | Content data | Checksum, XOR of all content bytes |
| Header Bit Subscript | Description |
| :------------------- | :---------- |
| 0 | Device information |
| 1 | Image params |
| 2 | IMU params |
| 3~6 | Undefined |
| 7 | 0: Get; 1: Set |
### File Content Packet
| Name | ID | Size | Content |
| :--- | :- | :--- | :------ |
| Bytes | 1 | 2 | - |
| Type | uint8_t | uint16_t | - |
| Description | Content ID | Content size | Content data |
| File | ID | Max Size |
| :--- | :- | :------- |
| Device information | 1 | 250 |
| Image params | 2 | 250 |
| IMU params | 4 | 500 |

View File

@@ -0,0 +1,14 @@
# Device Information {#spec_hardware_info}
| Name | Field | Fixed Value | USB Descriptor | UVC Extension Unit | Bytes | Note |
| :----- | :----- | :-------- | :-------------- | :----------------- | :-------- | :----- |
| VID | vid | 0x04B4 | √ | × | 2 | |
| PID | pid | 0x00F9 | √ | × | 2 | |
| Device name | name | MYNT-EYE-? | √ | √ Get | 16 | MYNT-EYE-S1000 |
| Serial number | serial_number | - | √ | √ Get | 16 | |
| Firmware version | firmware_version | - | √ | √ Get | 2 | major,minor |
| Hardware version | hardware_version | - | × | √ Get | 3 | major,minor,flag |
| Spec version | spec_version | - | × | √ Get | 2 | major,minor |
| Lens type | lens_type | - | × | √ Get/Set | 4 | vendor(2),product(2); default: 0 |
| IMU type | imu_type | - | × | √ Get/Set | 4 | vendor(2),product(2); default: 0 |
| Nominal baseline | nominal_baseline | - | × | √ Get/Set | 2 | unit: mm; default: 0 |

20
doc/en/spec_image_data.md Normal file
View File

@@ -0,0 +1,20 @@
# Image Data {#spec_image_data}
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Frame ID | frame_id | - | 2 | uint16_t; [0,65535] |
| Timestamp | timestamp | 10 us | 4 | uint32_t |
| Exposure Time | exposure_time | 10 us | 2 | uint16_t |
## Image Packet
| Name | Header | Size | Frame ID | Timestamp | Exposure Time | Checksum |
| :--- | :----- | :--- | :------- | :-------- | :------------ | :------- |
| Bytes | 1 | 1 | 2 | 4 | 2 | 1 |
| Type | uint8_t | uint8_t | uint16_t | uint32_t | uint16_t | uint8_t |
| Description | 0x3B | 0x08, content size | Frame ID | Timestamp | Exposure time | Checksum, XOR of all content bytes |
* The image packet will be dropped, if checksum is incorrect.
* The accuracy of the time unit: 0.01 ms / 10 us.
* The timestamp could indicate 11.9 hours, it will accumulate again after overflow.
* The timestamp accumulation starts from the time of power-on, instead of opening.

View File

@@ -0,0 +1,23 @@
# Image Params {#spec_image_params}
## Image Intrinsics
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Image width | width | px | 2 | uint16_t; [0,65535] |
| Image height | height | px | 2 | uint16_t; [0,65535] |
| Focal length | fx | - | 8 | double |
| ^ | fy | - | 8 | double |
| Principal point | cx | - | 8 | double |
| ^ | cy | - | 8 | double |
| Distortion model | model | - | 1 | uint8_t; pinhole,... |
| Distortion coefficients | coeffs[5] | - | 40 | double; k1,k2,p1,p2,k3 |
## Image Extrinsics
Transformation matrix from left image to right image.
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Rotation matrix | rotation[3][3] | - | 72 | double |
| Translation vector | translation[3] | - | 24 | double |

42
doc/en/spec_imu_data.md Normal file
View File

@@ -0,0 +1,42 @@
# IMU Data {#spec_imu_data}
## IMU Request Packet
| Name | Header | Serial Number |
| :--- | :----- | :------------ |
| Bytes | 1 | 4 |
| Type | uint8_t | uint32_t |
| Description | 0x5A | First request should be 0, otherwise the last one |
## IMU Response Packet
The IMU response packet contains multiple IMU packets, and each IMU packet contains multiple IMU segments.
| Name | Header | State | Size | IMU Packets | Checksum |
| :--- | :----- | :---- | :--- | :---------- | :------- |
| Bytes | 1 | 1 | 2 | ... | 1 |
| Type | uint8_t | uint8_t | uint16_t | - | uint8_t |
| Description | 0x5B | 0 is success, others are failed | Content size | IMU packets | Checksum, XOR of all content bytes |
### IMU Packet
The IMU packet is an array of IMU datas.
| Name | Serial Number | Timestamp | Count | IMU Datas |
| :--- | :------------ | :-------- | :---- | :-------- |
| Bytes | 4 | 4 | 1 | ... |
| Type | uint32_t | uint32_t | uint8_t | - |
| Description | Serial number | IMU basic timestamp | The number of IMU datas | IMU datas |
### IMU Segment
| Name | Offset | Frame ID | Accelerometer | Temperature | Gyroscope |
| :--- | :----- | :------- | :------------ | :---------- | :-------- |
| Bytes | 2 | 2 | 6 | 2 | 6 |
| Type | int16_t | uint16_t | int16_t * 3 | int16_t | int16_t * 3 |
| Description | The timestamp offset | Image frame ID | Accel x,y,z values | IMU temperature | Gyro x,y,z values |
* Formula for converting the accel & gyro values to real ones: **real = data * range / 0x10000** .
* ``accel`` default ``range`` is **8 g**, ``gyro`` default ``range`` is **1000 deg/s**.
* Formula for converting the temperature to real value: **real = data / ratio + offset** .
* default ``ratio`` is **326.8**, default ``offset`` is **25℃**.

23
doc/en/spec_imu_params.md Normal file
View File

@@ -0,0 +1,23 @@
# IMU Params {#spec_imu_params}
## IMU Intrinsics
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Scale matrix | acc_scale[3][3] | - | 72 | double |
| ^ | gyro_scale[3][3] | - | 72 | double |
| Zero-drift | acc_drift[3] | - | 24 | double |
| ^ | gyro_drift[3] | - | 24 | double |
| Noise density | acc_noise[3] | - | 24 | double |
| ^ | gyro_noise[3] | - | 24 | double |
| Random walk | acc_bias[3] | - | 24 | double |
| ^ | gyro_bias[3] | - | 24 | double |
## IMU Extrinsics
Transformation matrix from left image to IMU.
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Rotation matrix | rotation[3][3] | - | 72 | double |
| Translation vector | translation[3] | - | 24 | double |

4
doc/en/specs_ctrl.md Normal file
View File

@@ -0,0 +1,4 @@
# Device Control Specification {#specs_ctrl}
* @subpage spec_control_api
* @subpage spec_control_channel

7
doc/en/specs_data.md Normal file
View File

@@ -0,0 +1,7 @@
# Device Data Specification {#specs_data}
* @subpage spec_hardware_info
* @subpage spec_image_params
* @subpage spec_imu_params
* @subpage spec_image_data
* @subpage spec_imu_data

View File

@@ -1,4 +1,18 @@
#!/usr/bin/env bash
# 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.
LANGS=(
en
zh-Hans

View File

@@ -1,4 +1,4 @@
# Doxyfile 1.8.13
# Doxyfile 1.8.14
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@@ -20,8 +20,8 @@
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all text
# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
# for the list of possible encodings.
# built into libc) for the transcoding. See
# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
# The default value is: UTF-8.
DOXYFILE_ENCODING = UTF-8
@@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME = "MYNT EYE SDK"
PROJECT_NAME = "MYNT EYE S SDK"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = v2.0
PROJECT_NUMBER = 2.2.4
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = http://www.myntai.com/camera
PROJECT_BRIEF = http://www.myntai.com/mynteye/standard
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
@@ -236,7 +236,8 @@ TAB_SIZE = 2
# will allow you to put the command \sideeffect (or @sideeffect) in the
# documentation, which will result in a user-defined paragraph with heading
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
# newlines (in the resulting output). You can put ^^ in the value part of an
# alias to insert a newline as if a physical newline was in the original file.
ALIASES =
@@ -337,7 +338,7 @@ BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
# will parse them like normal C++ but will assume all classes use public instead
# of private inheritance when no explicit protection keyword is present.
# The default value is: NO.
@@ -708,7 +709,7 @@ LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
# extension is automatically appended if omitted. This requires the bibtex tool
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
# For LaTeX the style of the bibliography can be controlled using
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
@@ -791,13 +792,6 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched.
INPUT = mainpage.md \
guides.md \
guide_build_linux.md \
guide_samples.md \
guide_tools.md \
guide_log.md \
guide_opencv.md \
guide_ros.md \
specs_data.md \
spec_hardware_info.md \
spec_image_params.md \
@@ -807,12 +801,12 @@ INPUT = mainpage.md \
specs_ctrl.md \
spec_control_api.md \
spec_control_channel.md \
../../_install/include
/usr/local/include/mynteye
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
# documentation (see: http://www.gnu.org/software/libiconv) for the list of
# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
# possible encodings.
# The default value is: UTF-8.
@@ -890,7 +884,8 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE =
EXCLUDE = /usr/local/include/mynteye/logger.h \
/usr/local/include/mynteye/miniglog.h
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -1060,7 +1055,7 @@ SOURCE_TOOLTIPS = YES
# If the USE_HTAGS tag is set to YES then the references to source code will
# point to the HTML generated by the htags(1) tool instead of doxygen built-in
# source browser. The htags tool is part of GNU's global source tagging system
# (see http://www.gnu.org/software/global/global.html). You will need version
# (see https://www.gnu.org/software/global/global.html). You will need version
# 4.8.6 or higher.
#
# To use it do the following:
@@ -1205,7 +1200,7 @@ HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
# this color. Hue is specified as an angle on a colorwheel, see
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
# Minimum value: 0, maximum value: 359, default value: 220.
@@ -1241,6 +1236,17 @@ HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via Javascript. If disabled, the navigation index will
# consists of multiple levels of tabs that are statically embedded in every HTML
# page. Disable this option to support browsers that do not have Javascript,
# like the Qt help browser.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_DYNAMIC_MENUS = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded.
@@ -1264,12 +1270,12 @@ HTML_INDEX_NUM_ENTRIES = 100
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
# generated that can be used as input for Apple's Xcode 3 integrated development
# environment (see: http://developer.apple.com/tools/xcode/), introduced with
# environment (see: https://developer.apple.com/tools/xcode/), introduced with
# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
# Makefile in the HTML output directory. Running make will produce the docset in
# that directory and running make install will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# for more information.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -1304,7 +1310,7 @@ DOCSET_PUBLISHER_ID = com.slightech.mynteye.documentation
# The default value is: Publisher.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_PUBLISHER_NAME = MYNT EYE SDK
DOCSET_PUBLISHER_NAME = MYNT EYE S SDK
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
@@ -1385,7 +1391,7 @@ QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1393,8 +1399,7 @@ QHP_NAMESPACE = com.slightech.mynteye
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
# folders).
# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1402,23 +1407,21 @@ QHP_VIRTUAL_FOLDER = doc
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
# filters).
# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
# filters).
# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_SECT_FILTER_ATTRS =
@@ -1511,7 +1514,7 @@ EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are not
# supported properly for IE 6.0, but are supported on all modern browsers.
#
@@ -1523,7 +1526,7 @@ FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# http://www.mathjax.org) which uses client side Javascript for the rendering
# https://www.mathjax.org) which uses client side Javascript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
@@ -1550,11 +1553,11 @@ MATHJAX_FORMAT = HTML-CSS
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from http://www.mathjax.org before deployment.
# The default value is: http://cdn.mathjax.org/mathjax/latest.
# MathJax from https://www.mathjax.org before deployment.
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
@@ -1612,7 +1615,7 @@ SERVER_BASED_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/).
# Xapian (see: https://xapian.org/).
#
# See the section "External Indexing and Searching" for details.
# The default value is: NO.
@@ -1625,7 +1628,7 @@ EXTERNAL_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/). See the section "External Indexing and
# Xapian (see: https://xapian.org/). See the section "External Indexing and
# Searching" for details.
# This tag requires that the tag SEARCHENGINE is set to YES.
@@ -1814,7 +1817,7 @@ LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# The default value is: plain.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@@ -1997,9 +2000,9 @@ DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
# AutoGen Definitions (see http://autogen.sf.net) file that captures the
# structure of the code including all documentation. Note that this feature is
# still experimental and incomplete at the moment.
# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
# the structure of the code including all documentation. Note that this feature
# is still experimental and incomplete at the moment.
# The default value is: NO.
GENERATE_AUTOGEN_DEF = NO
@@ -2099,7 +2102,9 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = DOXYGEN_WORKING
PREDEFINED = DOXYGEN_WORKING \
"MYNTEYE_BEGIN_NAMESPACE=namespace mynteye {" \
"MYNTEYE_END_NAMESPACE=}"
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The

View File

@@ -1,18 +1,32 @@
# 编译 on Linux {#guide_build_linux}
> Ubuntu 16.04, Ubuntu 14.04
## 获取代码
```bash
git clone https://github.com/slightech/MYNT-EYE-SDK-2.git
git clone https://github.com/slightech/MYNT-EYE-S-SDK.git
```
## 准备依赖
```bash
cd mynt-eye-sdk-2/
cd mynt-eye-s-sdk/
make init
```
### [OpenCV](https://opencv.org/)
编译前可在系统终端Windows 命令提示符)里如下指定 OpenCV 路径,其为 `OpenCVConfig.cmake` 目录:
```bash
# Linux, macOS
export OpenCV_DIR=~/opencv
# Windows
set OpenCV_DIR=C:\opencv
```
## 编译代码
```bash

View File

@@ -0,0 +1,113 @@
# 编译 on Windows {#guide_build_win}
> Windows 10
## 前提条件
* [Git](https://git-scm.com/downloads),用于获取代码。
* [CMake](https://cmake.org/download/),用于构建编译。
* [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html),用于生成文档。
最终命令提示符Command Prompt, cmd里可找到如下命令
```cmd
>cmake --version
cmake version 3.10.1
>git --version
git version 2.11.1.windows.1
>doxygen --version
1.8.13
```
* [Visual Studio](https://www.visualstudio.com/)
* [Visual Studio 2015](https://my.visualstudio.com/Downloads?q=Visual Studio 2015)
* [Visual Studio 2017](https://my.visualstudio.com/Downloads?q=Visual Studio 2017)
* [Windows 10 SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk)
以 Visual Studio 2015 举例,请在系统环境变量 `PATH` 里添加上如下路径:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
C:\Program Files (x86)\MSBuild\14.0\Bin
最终命令提示符Command Prompt, cmd里可找到如下命令
```cmd
>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
>link
Microsoft (R) Incremental Linker Version 14.00.24215.1
>lib
Microsoft (R) Library Manager Version 14.00.24215.1
>msbuild
Microsoft (R) 生成引擎版本 14.0.25420.1
```
* [MSYS2](http://www.msys2.org/)
* [国内镜像](https://lug.ustc.edu.cn/wiki/mirrors/help/msys2)
* [pacman](https://wiki.archlinux.org/index.php/pacman)
打开 MSYS2 MSYS ,然后执行:
```msys
$ pacman -Syu
$ pacman -S make
```
并在系统环境变量 `PATH` 里添加上如下路径:
C:\msys64\usr\bin
最终命令提示符Command Prompt, cmd里可找到如下命令
```cmd
>make --version
GNU Make 4.2.1
```
## 获取代码
```cmd
>git clone https://github.com/slightech/MYNT-EYE-S-SDK.git
```
## 准备依赖
```cmd
>cd mynt-eye-s-sdk
>make init
Make init
Init deps
Install cmd: pacman -S
Install deps: git clang-format
pacman -S clang-format (not exists)
error: target not found: clang-format
pip install --upgrade autopep8 cpplint pylint requests
...
Init git hooks
ERROR: clang-format-diff is not installed!
Expect cmake version >= 3.0
cmake version 3.10.1
```
### [OpenCV](https://opencv.org/)
编译前可在系统终端Windows 命令提示符)里如下指定 OpenCV 路径,其为 `OpenCVConfig.cmake` 目录:
```bash
# Linux, macOS
export OpenCV_DIR=~/opencv
# Windows
set OpenCV_DIR=C:\opencv
```
## 编译代码
```cmd
>make install
```

View File

@@ -1,6 +1,6 @@
# 日志 {#guide_log}
日志系统用的 `glog` ,通用配置在头文件 `glog_init.h` 里。
日志系统用的 `glog` ,通用配置在头文件 `logger.h` 里。
* 日志文件会存储在当前工作目录, `make cleanlog` 可以清理。
* 如果需要打开详细日志,请取消 `glog_init.h` 里注释的 `FLAGS_v = 2;` ,重新编译。
* 如果需要打开详细日志,请取消 `logger.h` 里注释的 `FLAGS_v = 2;` ,重新编译。

View File

@@ -1,3 +1,13 @@
# OpenCV 依赖 {#guide_opencv}
目前 SDK 本身未依赖 OpenCV ,仅是样例依赖其显示图像。
SDK 提供了三层接口,其 OpenCV 依赖情况如下:
* `api` 上层接口,依赖 OpenCV 。
* `device`,中间层接口,不依赖 OpenCV 。
* `uvc`,底层接口,不依赖 OpenCV 。
如果不想使用 OpenCV ,你可编辑 `<sdk>/cmake/Option.cmake` 里的 `WITH_API` 选项,设为 `OFF` 就能关闭 `api` 层代码编译:
```cmake
option(WITH_API "Build with API layer, need OpenCV" ON)
```

View File

@@ -2,15 +2,18 @@
样例在 `<sdk>/samples` 目录,其提供了不同接口层的使用范例。
* `api` API 层接口,依赖 OpenCV 。
* `device`,中间层接口,不依赖 OpenCV 。
* `uvc`,底层接口。
> 目前 API 层接口,正在实现中。
## 依赖
* [OpenCV](https://opencv.org/),用于显示图像。
* 编译前可在系统终端Windows 命令提示符)里如下指定 OpenCV 路径,其为 `OpenCVConfig.cmake` 目录:
```bash
# Linux, macOS
export OpenCV_DIR=~/opencv
# Windows
set OpenCV_DIR=C:\opencv
```
## 编译
@@ -20,8 +23,24 @@ make samples
## 运行
运行 `api` 层接口样例,显示图像并输出 IMU 。
```bash
./samples/_output/bin/api/camera_a
# Windows
.\samples\_output\bin\api\camera_a.bat
```
运行 `device` 层接口样例,显示图像并输出 IMU 。
```bash
./samples/_output/bin/device/camera_d
# Windows
.\samples\_output\bin\device\camera_d.bat
```
## 结语
更多样例的说明,请见 `samples/README.md`

View File

@@ -1,20 +1,40 @@
# 工具 {#guide_tools}
样例`<sdk>/tools` 目录,其提供一些有用的工具
工具`<sdk>/tools` 目录,其提供一些有用的脚本和程序
## 准备
## 依赖
* [OpenCV](https://opencv.org/),部分工具需要。
* 编译前可在系统终端Windows 命令提示符)里如下指定 OpenCV 路径,其为 `OpenCVConfig.cmake` 目录:
```bash
# Linux, macOS
export OpenCV_DIR=~/opencv
# Windows
set OpenCV_DIR=C:\opencv
```
* Python 第三方库,脚本需要。
```bash
cd tools/
sudo pip install -r requirements.txt
```
## 编译
```bash
make tools
cd tools/
sudo pip install -r requirements.txt
```
## 录制数据集
```bash
./tools/_output/bin/dataset/record
# Windows
.\tools\_output\bin\dataset\record.bat
```
默认录制进 `dataset` 目录,加参数可指定该目录。
@@ -46,6 +66,8 @@ python tools/analytics/stamp_analytics.py -i dataset -c tools/config/mynteye/myn
\includegraphics[width=0.6\textwidth,keepaspectratio]{stamp_analytics.png}
\endlatexonly
> 如果用 ROS ,分析脚本也支持 ROS Bag 格式。
## 结语
如果用 ROS ,分析脚本也支持 ROS Bag 格式。关于 ROS 的录制和分析,请见 `tools/README.md`
设备信息读写、校验码等更多工具的说明,请见 `tools/README.md`

View File

@@ -1,6 +1,7 @@
# SDK 指导 {#guides}
* @subpage guide_build_linux
* @subpage guide_build_win
* @subpage guide_samples
* @subpage guide_tools
* @subpage guide_log

View File

@@ -1,9 +1,11 @@
# MYNT EYE SDK {#mainpage}
# MYNT EYE S SDK {#mainpage}
* API 模块
* <a class="el" href="annotated.html">API 类</a>
* <a class="el" href="modules.html">API 模块</a>
* \link enumerations 枚举类型\endlink
* \link datatypes 数据类型\endlink
* \link utils 工具函数\endlink
* \link calibration 内参与外参\endlink
* 设备说明
* <span style="font-weight:bold">设备说明</span>
* @subpage specs_data
* @subpage specs_ctrl

View File

@@ -1,4 +1,4 @@
# 控制 API 说明 {#spec_contorl_api}
# 控制 API 说明 {#spec_control_api}
控制有两种实现方式,一是通过 UVC 标准协议,二是通过 UVC 拓展通道自定义协议。
@@ -8,21 +8,23 @@
| :----- | :----- | :-------- | :-------- | :-------- | :-------- | :----------- | :----------- | :----- |
| 增益 | gain | 2 | 24 | 0 | 48 | √ | 0x12 | 关闭自动曝光,手动设定的参数 |
| 亮度 | brightness/exposure_time | 2 | 120 | 0 | 240 | √ | 0x14 | 关闭自动曝光,手动设定的参数 |
| 对比度 | contrast/black_level_calibration | 2 | 127 | 0 | 255 | √ | 0x10 | |
| 对比度 | contrast/black_level_calibration | 2 | 127 | 0 | 255 | √ | 0x10 | 关闭自动曝光,手动设定的参数 |
> UVC 标准协议实现的控制,有现成的 API 进行 Get & Set ,包括 Min, Max, Default 。
## 自定义协议
| 名称 | 字段 | 字节数 | 默认值 | 最小值 | 最大值 | 是否储存 | Flash 地址 | 所属通道 | 通道地址 | 说明 |
| :----- | :----- | :-------- | :-------- | :-------- | :-------- | :----------- | :----------- | :----------- | :----------- | :----- |
| 图像帧率 | frame_rate | 2 | 25 | 10 | 60 | √ | 0x21 | XU_CAM_CTRL | 0x0100 | 步进为5即有效值为{10,15,20,25,30,35,40,45,50,55,60} |
| IMU 频率 | imu_frequency | 2 | 200 | 100 | 500 | √ | 0x23 | XU_CAM_CTRL | 0x0100 | 有效值为{100,200,250,333,500} |
| 曝光模式 | exposure_mode | 1 | 0 | 0 | 1 | √ | 0x0F | XU_CAM_CTRL | 0x0100 | 0开启自动曝光 1关闭 |
| 最大增益 | max_gain | 2 | 48 | 0 | 48 | √ | 0x1D | XU_CAM_CTRL | 0x0100 | 开始自动曝光,可设定的阈值 |
| 最大曝光时间 | max_exposure_time | 2 | 240 | 0 | 240 | √ | 0x1B | XU_CAM_CTRL | 0x0100 | 开始自动曝光,可设定的阈值 |
| 期望亮度 | desired_brightness | 2 | 192 | 0 | 255 | √ | 0x19 | XU_CAM_CTRL | 0x0100 | |
| IR 控制 | ir_control | 1 | 0 | 0 | 160 | × | - | XU_CAM_CTRL | 0x0100 | |
| HDR 模式 | hdr_mode | 1 | 0 | 0 | 1 | √ | 0x1F | XU_CAM_CTRL | 0x0100 | 010-bit112-bit |
| 零漂标定 | zero_drift_calibration | | - | - | - | × | - | XU_HALF_DUPLEX | 0x0200 | |
| 擦除芯片 | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | 0x0200 | |
| 名称 | 字段 | 字节数 | 默认值 | 最小值 | 最大值 | 是否储存 | Flash 地址 | 所属通道 | 说明 |
| :----- | :----- | :-------- | :-------- | :-------- | :-------- | :----------- | :----------- | :----------- | :----- |
| 图像帧率 | frame_rate | 2 | 25 | 10 | 60 | √ | 0x21 | XU_CAM_CTRL | 步进为5即有效值为{10,15,20,25,30,35,40,45,50,55,60} |
| IMU 频率 | imu_frequency | 2 | 200 | 100 | 500 | √ | 0x23 | XU_CAM_CTRL | 有效值为{100,200,250,333,500} |
| 曝光模式 | exposure_mode | 1 | 0 | 0 | 1 | √ | 0x0F | XU_CAM_CTRL | 0开启自动曝光 1关闭 |
| 最大增益 | max_gain | 2 | 48 | 0 | 48 | √ | 0x1D | XU_CAM_CTRL | 开始自动曝光,可设定的阈值 |
| 最大曝光时间 | max_exposure_time | 2 | 240 | 0 | 240 | √ | 0x1B | XU_CAM_CTRL | 开始自动曝光,可设定的阈值 |
| 期望亮度 | desired_brightness | 2 | 192 | 0 | 255 | √ | 0x19 | XU_CAM_CTRL | 开始自动曝光,可设定的阈值 |
| IR 控制 | ir_control | 1 | 0 | 0 | 160 | × | - | XU_CAM_CTRL | |
| HDR 模式 | hdr_mode | 1 | 0 | 0 | 1 | √ | 0x1F | XU_CAM_CTRL | 010-bit112-bit |
| 零漂标定 | zero_drift_calibration | | - | - | - | × | - | XU_HALF_DUPLEX | |
| 擦除芯片 | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | |
| 加速度计量程 | accelerometer_range | 2 | 12 | 6 | 48 | √ | - | XU_CAM_CTRL | 0x0100 | |
| 陀螺仪量程 | gyroscope_range | 2 | 1000 | 250 | 4000 | √ | - | XU_CAM_CTRL | 0x0100 | |

View File

@@ -1,12 +1,12 @@
# 拓展通道说明 {#spec_contorl_channel}
# 拓展通道说明 {#spec_control_channel}
| 名称 | 字段 | 地址 | 带宽 | 说明 |
| :----- | :----- | :----- | :----- | :----- |
| 相机控制通道 | XU_CAM_CTRL_CHANNEL | 0x0100 | 3 | |
| 半双工通道 | XU_HALF_DUPLEX_CHANNEL | 0x0200 | 20 | |
| IMU 请求通道 | XU_IMUDATA_WRITE_CHANNEL | 0x0300 | 5 | |
| IMU 响应通道 | XU_IMUDATA_READ_CHANNEL | 0x0400 | 2000 | |
| 文件通道 | XU_FILE_CHANNEL | 0x0500 | 2000 | |
| 相机控制通道 | XU_CAM_CTRL_CHANNEL | 1 | 3 | |
| 半双工通道 | XU_HALF_DUPLEX_CHANNEL | 2 | 20 | |
| IMU 请求通道 | XU_IMUDATA_WRITE_CHANNEL | 3 | 5 | |
| IMU 响应通道 | XU_IMUDATA_READ_CHANNEL | 4 | 2000 | |
| 文件通道 | XU_FILE_CHANNEL | 5 | 2000 | |
## 相机控制通道
@@ -14,7 +14,7 @@
## 半双工通道
半双工通道是那些仅需 Get 或 Set 的控制通道,如请求零漂矫正。
半双工通道是那些仅需 Set 的控制通道,如请求零漂矫正。
## IMU 通道
@@ -25,18 +25,18 @@
用来读写硬件信息、图像参数、 IMU 参数的通道。
| Name | Header | Size | File | Checksum |
| :--- | :- | :--- | :--- | :-------- |
| :--- | :----- | :--- | :--- | :-------- |
| 字节数 | 1 | 2 | - | 1 |
| 类型 | uint8_t | uint16_t | - | uint8_t |
| 描述 | 标识 | 文件内容大小 | 文件内容 | 校验码(文件内容所有字节异或) |
| Header bit | Description |
| :--------- | :---------- |
| 0 | 0: Get; 1: Set |
| 1~4 | 未定义 |
| 5 | IMU 参数 |
| 6 | 图像参数 |
| 7 | 硬件信息 |
| Header Bit Subscript | Description |
| :------------------- | :---------- |
| 0 | 硬件信息 |
| 1 | 图像参数 |
| 2 | IMU 参数 |
| 3~6 | 未定义 |
| 7 | 0: Get; 1: Set |
### 文件内容包

View File

@@ -11,12 +11,12 @@
## 图像数据包
| Name | Header | Size | Frame ID | Timestamp | Exposure Time | Checksum |
| :--- | :----- | :--- | :------ | :-------- | :----------- | :------- |
| :--- | :----- | :--- | :------- | :-------- | :------------ | :------- |
| 字节数 | 1 | 1 | 2 | 4 | 2 | 1 |
| 类型 | uint8_t | uint8_t | uint16_t | uint32_t | uint16_t | uint8_t |
| 描述 | 0x3B | 0x08 (数据内容大小) | 帧 ID | 时间戳 | 曝光时间 | 校验码(数据内容所有字节异或) |
* 数据包校验不过,会丢弃该帧。
* 时间单位精度为: 0.01 ms / 10 us 。
* 时间单位精度为: 0.01 ms / 10 us 。
* 4 字节能表示的最大时间约是 11.9 小时,溢出后将重累计。
* 时间累计是从上电时从开始,而不是从打开时开始。

View File

@@ -13,7 +13,7 @@
| 畸变模型 | model | - | 1 | uint8_t; pinhole,... |
| 畸变参数 | coeffs[5] | - | 40 | double; k1,k2,p1,p2,k3 |
> 图像内参不同分辨率会不同。如果多分辨率的话,就会有多个。
> 图像分辨率不同,内参不同。多分辨率的话,有多个内参
## 图像外参

View File

@@ -31,10 +31,10 @@ IMU 包/小包,是一组 IMU 数据。
### IMU 段
| Name | Offset | Frame ID | Accelerometer | Temperature | Gyroscope |
| :--- | :----- | :------ | :------------ | :---------- | :-------- |
| :--- | :----- | :------- | :------------ | :---------- | :-------- |
| 字节数 | 2 | 2 | 6 | 2 | 6 |
| 类型 | int16_t | uint16_t | int16_t * 3 | int16_t | int16_t * 3 |
| Description | 相对基准时间戳的偏移量 | 图像帧 ID | 加速度计 x y z 三轴的值 | IMU 的温度 | 陀螺仪 x y z 三轴的值 |
| 描述 | 相对基准时间戳的偏移量 | 图像帧 ID | 加速度计 x y z 三轴的值 | IMU 的温度 | 陀螺仪 x y z 三轴的值 |
* 加速度计和陀螺仪的计量值换算成物理值公式: **real = data * range / 0x10000**
* 加速度计量程默认值为 **8 g** ,陀螺仪量程默认值为 **1000 deg/s**

View File

@@ -1,4 +1,4 @@
# 设备控制说明 {#specs_ctrl}
* @subpage spec_contorl_api
* @subpage spec_contorl_channel
* @subpage spec_control_api
* @subpage spec_control_channel

View File

@@ -0,0 +1 @@
#include "mynteye/api/api.h"

View File

@@ -0,0 +1 @@
#include "mynteye/device/callbacks.h"

View File

@@ -0,0 +1 @@
#include "mynteye/device/context.h"

View File

@@ -0,0 +1 @@
#include "mynteye/device/device.h"

View File

@@ -0,0 +1 @@
#include "mynteye/util/files.h"

View File

@@ -0,0 +1 @@
#include "mynteye/logger.h"

View File

@@ -0,0 +1 @@
#include "mynteye/api/object.h"

View File

@@ -0,0 +1 @@
#include "mynteye/api/plugin.h"

View File

@@ -0,0 +1 @@
#include "mynteye/util/strings.h"

View File

@@ -0,0 +1 @@
#include "mynteye/util/times.h"

View File

@@ -0,0 +1 @@
#include "mynteye/device/utils.h"

286
include/mynteye/api/api.h Normal file
View File

@@ -0,0 +1,286 @@
// 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_API_API_H_
#define MYNTEYE_API_API_H_
#pragma once
#include <functional>
#include <limits>
#include <memory>
#include <string>
#include <vector>
#include <opencv2/core/core.hpp>
#include "mynteye/mynteye.h"
#include "mynteye/types.h"
MYNTEYE_BEGIN_NAMESPACE
class Device;
class Synthetic;
namespace device {
class Frame;
} // namespace device
namespace api {
/**
* @ingroup datatypes
* API stream data.
*/
struct MYNTEYE_API StreamData {
/** ImgData. */
std::shared_ptr<ImgData> img;
/** Frame. */
cv::Mat frame;
/** Raw frame. */
std::shared_ptr<device::Frame> frame_raw;
/** Frame ID. */
std::uint16_t frame_id;
bool operator==(const StreamData &other) const {
if (img && other.img) {
return img->frame_id == other.img->frame_id &&
img->timestamp == other.img->timestamp;
}
return false;
}
};
/**
* @ingroup datatypes
* API motion data.
*/
struct MYNTEYE_API MotionData {
/** ImuData. */
std::shared_ptr<ImuData> imu;
bool operator==(const MotionData &other) const {
if (imu && other.imu) {
return imu->frame_id == other.imu->frame_id &&
imu->timestamp == other.imu->timestamp;
}
return false;
}
};
} // namespace api
/**
* The API class to communicate with MYNT® EYE device.
*/
class MYNTEYE_API API {
public:
/** The api::StreamData callback. */
using stream_callback_t = std::function<void(const api::StreamData &data)>;
/** The api::MotionData callback. */
using motion_callback_t = std::function<void(const api::MotionData &data)>;
explicit API(std::shared_ptr<Device> device);
virtual ~API();
/**
* Create the API instance.
* @return the API instance.
* @note This will call device::select() to select a device.
*/
static std::shared_ptr<API> Create();
/**
* Create the API instance.
* @param device the selected device.
* @return the API instance.
*/
static std::shared_ptr<API> Create(std::shared_ptr<Device> device);
/**
* Create the API instance.
* @param argc the arg count.
* @param argv the arg values.
* @return the API instance.
* @note This will init glog with args and call device::select() to select a
* device.
*/
static std::shared_ptr<API> Create(int argc, char *argv[]);
/**
* Create the API instance.
* @param argc the arg count.
* @param argv the arg values.
* @param device the selected device.
* @return the API instance.
* @note This will init glog with args.
*/
static std::shared_ptr<API> Create(
int argc, char *argv[], std::shared_ptr<Device> device);
/**
* Get the model.
*/
Model GetModel() const;
/**
* Supports the stream or not.
*/
bool Supports(const Stream &stream) const;
/**
* Supports the capability or not.
*/
bool Supports(const Capabilities &capability) const;
/**
* Supports the option or not.
*/
bool Supports(const Option &option) const;
/**
* Supports the addon or not.
*/
bool Supports(const AddOns &addon) const;
/**
* Get all stream requests of the capability.
*/
const std::vector<StreamRequest> &GetStreamRequests(
const Capabilities &capability) const;
/**
* Config the stream request to the capability.
*/
void ConfigStreamRequest(
const Capabilities &capability, const StreamRequest &request);
/**
* Get the device info.
*/
std::string GetInfo(const Info &info) const;
/**
* Get the intrinsics of stream.
*/
Intrinsics GetIntrinsics(const Stream &stream) const;
/**
* Get the extrinsics from one stream to another.
*/
Extrinsics GetExtrinsics(const Stream &from, const Stream &to) const;
/**
* Get the intrinsics of motion.
*/
MotionIntrinsics GetMotionIntrinsics() const;
/**
* Get the extrinsics from one stream to motion.
*/
Extrinsics GetMotionExtrinsics(const Stream &from) const;
/**
* Log all option infos.
*/
void LogOptionInfos() const;
/**
* Get the option info.
*/
OptionInfo GetOptionInfo(const Option &option) const;
/**
* Get the option value.
*/
std::int32_t GetOptionValue(const Option &option) const;
/**
* Set the option value.
*/
void SetOptionValue(const Option &option, std::int32_t value);
/**
* Run the option action.
*/
bool RunOptionAction(const Option &option) const;
/**
* Set the callback of stream.
*/
void SetStreamCallback(const Stream &stream, stream_callback_t callback);
/**
* Set the callback of motion.
*/
void SetMotionCallback(motion_callback_t callback);
/**
* Has the callback of stream.
*/
bool HasStreamCallback(const Stream &stream) const;
/**
* Has the callback of motion.
*/
bool HasMotionCallback() const;
/**
* Start capturing the source.
*/
void Start(const Source &source);
/**
* Stop capturing the source.
*/
void Stop(const Source &source);
/**
* Wait the streams are ready.
*/
void WaitForStreams();
/**
* Enable the data of stream.
* @note must enable the stream if it's a synthetic one. This means the stream
* in not native, the device has the capability to provide this stream, but
* still support this stream.
*/
void EnableStreamData(const Stream &stream);
/**
* Disable the data of stream.
*/
void DisableStreamData(const Stream &stream);
/**
* Get the latest data of stream.
*/
api::StreamData GetStreamData(const Stream &stream);
/**
* Get the datas of stream.
* @note default cache 4 datas at most.
*/
std::vector<api::StreamData> GetStreamDatas(const Stream &stream);
/**
* Enable cache motion datas.
*/
void EnableMotionDatas(
std::size_t max_size = std::numeric_limits<std::size_t>::max());
/**
* Get the motion datas.
*/
std::vector<api::MotionData> GetMotionDatas();
/**
* Enable the plugin.
*/
void EnablePlugin(const std::string &path);
std::shared_ptr<Device> device();
private:
std::shared_ptr<Device> device_;
std::unique_ptr<Synthetic> synthetic_;
};
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_API_API_H_

View File

@@ -0,0 +1,129 @@
// 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_API_OBJECT_H_
#define MYNTEYE_API_OBJECT_H_
#pragma once
#include <memory>
#include <opencv2/core/core.hpp>
#include "mynteye/mynteye.h"
MYNTEYE_BEGIN_NAMESPACE
struct ImgData;
/**
* Input & output object.
*/
struct MYNTEYE_API Object {
Object() = default;
virtual ~Object() = default;
virtual Object *Clone() const = 0;
virtual bool DecValidity() const = 0;
/** Cast the obj to T pointer */
template <typename T>
static T *Cast(Object *obj) {
return dynamic_cast<T *>(obj);
}
/** Cast the obj to const T pointer */
template <typename T>
static const T *Cast(const Object *obj) {
return dynamic_cast<const T *>(obj);
}
template <typename T>
static std::shared_ptr<T> Cast(const std::shared_ptr<Object> &obj) {
return std::dynamic_pointer_cast<T>(obj);
}
};
/**
* Input & output object of one cv::Mat.
*/
struct MYNTEYE_API ObjMat : public Object {
ObjMat() = default;
ObjMat(const cv::Mat &value, std::uint16_t id,
const std::shared_ptr<ImgData> &data)
: value(value), id(id), data(data) {}
/** The value */
cv::Mat value;
/** The id **/
std::uint16_t id;
/** The data **/
std::shared_ptr<ImgData> data;
Object *Clone() const {
ObjMat *mat = new ObjMat;
mat->value = value.clone();
mat->id = id;
mat->data = data;
return mat;
}
bool DecValidity() const {
return !value.empty();
}
};
/**
* Input & output object of two cv::Mat.
*/
struct MYNTEYE_API ObjMat2 : public Object {
ObjMat2() = default;
ObjMat2(const cv::Mat &first, std::uint16_t first_id,
const std::shared_ptr<ImgData> &first_data,
const cv::Mat &second, std::uint16_t second_id,
const std::shared_ptr<ImgData> &second_data)
: first(first), first_id(first_id), first_data(first_data),
second(second), second_id(second_id), second_data(second_data) {}
/** The first value */
cv::Mat first;
/** The first id **/
std::uint16_t first_id;
/** The first data **/
std::shared_ptr<ImgData> first_data;
/** The second value */
cv::Mat second;
/** The second id **/
std::uint16_t second_id;
/** The second data **/
std::shared_ptr<ImgData> second_data;
Object *Clone() const {
ObjMat2 *mat2 = new ObjMat2;
mat2->first = first.clone();
mat2->first_id = first_id;
mat2->first_data = first_data;
mat2->second = second.clone();
mat2->second_id = second_id;
mat2->second_data = second_data;
return mat2;
}
bool DecValidity() const {
return !first.empty() && !second.empty();
}
};
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_API_OBJECT_H_

View File

@@ -0,0 +1,141 @@
// 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_API_PLUGIN_H_
#define MYNTEYE_API_PLUGIN_H_
#pragma once
#include <cstdint>
#include <opencv2/core/core.hpp>
#include "mynteye/mynteye.h"
#ifndef MYNTEYE_PLUGIN_VERSION_CODE
#define MYNTEYE_PLUGIN_VERSION_CODE 0
#endif
MYNTEYE_BEGIN_NAMESPACE
class API;
struct Object;
/**
* The plugin which could implement processing by yourself.
*/
class MYNTEYE_API Plugin {
public:
Plugin() = default;
virtual ~Plugin() = 0;
/**
* Called when plugin created.
* @param api the API instacne.
*/
virtual void OnCreate(API *api) {
api_ = api;
}
/**
* Called when process rectify.
* @param in input object.
* @param out output object.
* @return `true` if you process rectify.
*/
virtual bool OnRectifyProcess(Object *const in, Object *const out) {
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}
/**
* Called when process disparity.
* @param in input object.
* @param out output object.
* @return `true` if you process disparity.
*/
virtual bool OnDisparityProcess(Object *const in, Object *const out) {
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}
/**
* Called when process normalized disparity.
* @param in input object.
* @param out output object.
* @return `true` if you process normalized disparity.
*/
virtual bool OnDisparityNormalizedProcess(
Object *const in, Object *const out) {
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}
/**
* Called when process points.
* @param in input object.
* @param out output object.
* @return `true` if you process points.
*/
virtual bool OnPointsProcess(Object *const in, Object *const out) {
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}
/**
* Called when process depth.
* @param in input object.
* @param out output object.
* @return `true` if you process depth.
*/
virtual bool OnDepthProcess(Object *const in, Object *const out) {
MYNTEYE_UNUSED(in)
MYNTEYE_UNUSED(out)
return false;
}
protected:
API *api_;
};
inline Plugin::~Plugin() = default;
using plugin_version_code_t = std::uint32_t();
using plugin_create_t = Plugin *();
using plugin_destroy_t = void(Plugin *);
MYNTEYE_END_NAMESPACE
extern "C" {
/**
* Get the plugin version code.
*/
MYNTEYE_API std::uint32_t plugin_version_code();
/**
* Create the plugin.
*/
MYNTEYE_API mynteye::Plugin *plugin_create();
/**
* Destroy the plugin.
*/
MYNTEYE_API void plugin_destroy(mynteye::Plugin *plugin);
}
#endif // MYNTEYE_API_PLUGIN_H_

View File

@@ -1,5 +1,18 @@
#ifndef MYNTEYE_CALLBACKS_H_ // NOLINT
#define MYNTEYE_CALLBACKS_H_
// 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_DEVICE_CALLBACKS_H_
#define MYNTEYE_DEVICE_CALLBACKS_H_
#pragma once
#include <cstdint>
@@ -16,13 +29,23 @@ MYNTEYE_BEGIN_NAMESPACE
namespace device {
class Frame {
/**
* @ingroup datatypes
* Frame with raw data.
*/
class MYNTEYE_API Frame {
public:
using data_t = std::vector<std::uint8_t>;
/**
* Construct the frame with StreamRequest and raw data.
*/
Frame(const StreamRequest &request, const void *data)
: Frame(request.width, request.height, request.format, data) {}
/**
* Construct the frame with stream info and raw data.
*/
Frame(
std::uint16_t width, std::uint16_t height, Format format,
const void *data)
@@ -36,30 +59,37 @@ class Frame {
}
}
/** Get the width. */
std::uint16_t width() const {
return width_;
}
/** Get the height. */
std::uint16_t height() const {
return height_;
}
/** Get the format. */
Format format() const {
return format_;
}
/** Get the data. */
std::uint8_t *data() {
return data_.data();
}
/** Get the const data. */
const std::uint8_t *data() const {
return data_.data();
}
/** Get the size of data. */
std::size_t size() const {
return data_.size();
}
/** Clone a new frame. */
Frame clone() const {
Frame frame(width_, height_, format_, nullptr);
std::copy(data_.begin(), data_.end(), frame.data_.begin());
@@ -74,12 +104,25 @@ class Frame {
data_t data_;
};
/**
* @ingroup datatypes
* Device stream data.
*/
struct MYNTEYE_API StreamData {
/** ImgData. */
std::shared_ptr<ImgData> img;
/** Frame. */
std::shared_ptr<Frame> frame;
/** Frame ID. */
std::uint16_t frame_id;
};
/**
* @ingroup datatypes
* Device motion data.
*/
struct MYNTEYE_API MotionData {
/** ImuData. */
std::shared_ptr<ImuData> imu;
};
@@ -90,4 +133,4 @@ using MotionCallback = std::function<void(const MotionData &data)>;
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_CALLBACKS_H_ NOLINT
#endif // MYNTEYE_DEVICE_CALLBACKS_H_

View File

@@ -0,0 +1,56 @@
// 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_DEVICE_CONTEXT_H_
#define MYNTEYE_DEVICE_CONTEXT_H_
#pragma once
#include <memory>
#include <vector>
#include "mynteye/mynteye.h"
MYNTEYE_BEGIN_NAMESPACE
namespace uvc {
struct context;
} // namespace uvc
class Device;
/**
* The context about devices.
*/
class MYNTEYE_API Context {
public:
Context();
~Context();
/**
* Get all devices now.
* @return a vector of all devices.
*/
std::vector<std::shared_ptr<Device>> devices() const {
return devices_;
}
private:
std::shared_ptr<uvc::context> context_;
std::vector<std::shared_ptr<Device>> devices_;
};
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_DEVICE_CONTEXT_H_

View File

@@ -0,0 +1,327 @@
// 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_DEVICE_DEVICE_H_
#define MYNTEYE_DEVICE_DEVICE_H_
#pragma once
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
#include "mynteye/mynteye.h"
#include "mynteye/types.h"
#include "mynteye/device/callbacks.h"
MYNTEYE_BEGIN_NAMESPACE
namespace uvc {
struct device;
} // namespace uvc
namespace tools {
class DeviceWriter;
} // namespace tools
struct DeviceInfo;
class API;
class Channels;
class Motions;
class Streams;
template <class Data>
class AsyncCallback;
/**
* The Device class to communicate with MYNT® EYE device.
*/
class MYNTEYE_API Device {
public:
/** The device::StreamData callback. */
using stream_callback_t = device::StreamCallback;
/** The device::MotionData callback. */
using motion_callback_t = device::MotionCallback;
using stream_callbacks_t = std::map<Stream, stream_callback_t>;
using stream_async_callback_t = AsyncCallback<device::StreamData>;
using motion_async_callback_t = AsyncCallback<device::MotionData>;
using stream_async_callback_ptr_t = std::shared_ptr<stream_async_callback_t>;
using motion_async_callback_ptr_t = std::shared_ptr<motion_async_callback_t>;
Device(const Model &model, std::shared_ptr<uvc::device> device);
virtual ~Device();
/**
* Create the Device instance.
* @param name the device name.
* @param device the device from uvc.
* @return the Device instance.
*/
static std::shared_ptr<Device> Create(
const std::string &name, std::shared_ptr<uvc::device> device);
/**
* Get the model.
*/
Model GetModel() const {
return model_;
}
/**
* Supports the stream or not.
*/
bool Supports(const Stream &stream) const;
/**
* Supports the capability or not.
*/
bool Supports(const Capabilities &capability) const;
/**
* Supports the option or not.
*/
bool Supports(const Option &option) const;
/**
* Supports the addon or not.
*/
bool Supports(const AddOns &addon) const;
/**
* Get all stream requests of the capability.
*/
const std::vector<StreamRequest> &GetStreamRequests(
const Capabilities &capability) const;
/**
* Config the stream request to the capability.
*/
void ConfigStreamRequest(
const Capabilities &capability, const StreamRequest &request);
/**
* Get the device info.
*/
std::shared_ptr<DeviceInfo> GetInfo() const;
/**
* Get the device info of a field.
*/
std::string GetInfo(const Info &info) const;
/**
* Get the intrinsics of stream.
*/
Intrinsics GetIntrinsics(const Stream &stream) const;
/**
* Get the extrinsics from one stream to another.
*/
Extrinsics GetExtrinsics(const Stream &from, const Stream &to) const;
/**
* Get the intrinsics of motion.
*/
MotionIntrinsics GetMotionIntrinsics() const;
/**
* Get the extrinsics from one stream to motion.
*/
Extrinsics GetMotionExtrinsics(const Stream &from) const;
/**
* Get the intrinsics of stream.
*/
Intrinsics GetIntrinsics(const Stream &stream, bool *ok) const;
/**
* Get the extrinsics from one stream to another.
*/
Extrinsics GetExtrinsics(
const Stream &from, const Stream &to, bool *ok) const;
/**
* Get the intrinsics of motion.
*/
MotionIntrinsics GetMotionIntrinsics(bool *ok) const;
/**
* Get the extrinsics from one stream to motion.
*/
Extrinsics GetMotionExtrinsics(const Stream &from, bool *ok) const;
/**
* Set the intrinsics of stream.
*/
void SetIntrinsics(const Stream &stream, const Intrinsics &in);
/**
* Set the extrinsics from one stream to another.
*/
void SetExtrinsics(
const Stream &from, const Stream &to, const Extrinsics &ex);
/**
* Set the intrinsics of motion.
*/
void SetMotionIntrinsics(const MotionIntrinsics &in);
/**
* Set the extrinsics from one stream to motion.
*/
void SetMotionExtrinsics(const Stream &from, const Extrinsics &ex);
/**
* Log all option infos.
*/
void LogOptionInfos() const;
/**
* Get the option info.
*/
OptionInfo GetOptionInfo(const Option &option) const;
/**
* Get the option value.
*/
std::int32_t GetOptionValue(const Option &option) const;
/**
* Set the option value.
*/
void SetOptionValue(const Option &option, std::int32_t value);
/**
* Run the option action.
*/
bool RunOptionAction(const Option &option) const;
/**
* Set the callback of stream.
*/
void SetStreamCallback(
const Stream &stream, stream_callback_t callback, bool async = false);
/**
* Set the callback of motion.
*/
void SetMotionCallback(motion_callback_t callback, bool async = false);
/**
* Has the callback of stream.
*/
bool HasStreamCallback(const Stream &stream) const;
/**
* Has the callback of motion.
*/
bool HasMotionCallback() const;
/**
* Start capturing the source.
*/
virtual void Start(const Source &source);
/**
* Stop capturing the source.
*/
virtual void Stop(const Source &source);
/**
* Wait the streams are ready.
*/
void WaitForStreams();
/**
* Get the datas of stream.
* @note default cache 4 datas at most.
*/
std::vector<device::StreamData> GetStreamDatas(const Stream &stream);
/**
* Get the latest data of stream.
*/
device::StreamData GetLatestStreamData(const Stream &stream);
/**
* Enable cache motion datas.
*/
void EnableMotionDatas();
/**
* Enable cache motion datas.
*/
void EnableMotionDatas(std::size_t max_size);
/**
* Get the motion datas.
*/
std::vector<device::MotionData> GetMotionDatas();
protected:
std::shared_ptr<uvc::device> device() const {
return device_;
}
std::shared_ptr<Streams> streams() const {
return streams_;
}
std::shared_ptr<Channels> channels() const {
return channels_;
}
std::shared_ptr<Motions> motions() const {
return motions_;
}
const StreamRequest &GetStreamRequest(const Capabilities &capability);
virtual void StartVideoStreaming();
virtual void StopVideoStreaming();
virtual void StartMotionTracking();
virtual void StopMotionTracking();
virtual void OnStereoStreamUpdate();
virtual std::vector<Stream> GetKeyStreams() const = 0;
bool video_streaming_;
bool motion_tracking_;
private:
Model model_;
std::shared_ptr<uvc::device> device_;
std::shared_ptr<DeviceInfo> device_info_;
std::map<Stream, Intrinsics> stream_intrinsics_;
std::map<Stream, std::map<Stream, Extrinsics>> stream_from_extrinsics_;
std::shared_ptr<MotionIntrinsics> motion_intrinsics_;
std::map<Stream, Extrinsics> motion_from_extrinsics_;
stream_callbacks_t stream_callbacks_;
motion_callback_t motion_callback_;
std::map<Stream, stream_async_callback_ptr_t> stream_async_callbacks_;
motion_async_callback_ptr_t motion_async_callback_;
std::shared_ptr<Streams> streams_;
std::map<Capabilities, StreamRequest> stream_config_requests_;
std::mutex mtx_streams_;
std::shared_ptr<Channels> channels_;
std::shared_ptr<Motions> motions_;
void ReadAllInfos();
void CallbackPushedStreamData(const Stream &stream);
void CallbackMotionData(const device::MotionData &data);
friend API;
friend tools::DeviceWriter;
};
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_DEVICE_DEVICE_H_

View File

@@ -0,0 +1,77 @@
// 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_DEVICE_UTILS_H_
#define MYNTEYE_DEVICE_UTILS_H_
#pragma once
#include <memory>
#include <string>
#include "mynteye/mynteye.h"
MYNTEYE_BEGIN_NAMESPACE
/**
* @defgroup utils Utiliities
*/
class Device;
namespace device {
/**
* @ingroup utils
*
* Detecting MYNT EYE devices and prompt user to select one.
*
* @return the selected device, or `nullptr` if none.
*/
MYNTEYE_API std::shared_ptr<Device> select();
} // namespace device
namespace utils {
/**
* @ingroup utils
*
* Get real exposure time in ms from virtual value, according to its frame rate.
*
* @param frame_rate the frame rate of the device.
* @param exposure_time the virtual exposure time.
* @return the real exposure time in ms, or the virtual value if frame rate is
* invalid.
*/
MYNTEYE_API float get_real_exposure_time(
std::int32_t frame_rate, std::uint16_t exposure_time);
/**
* @ingroup utils
*
* Get sdk root dir.
*/
MYNTEYE_API std::string get_sdk_root_dir();
/**
* @ingroup utils
*
* Get sdk install dir.
*/
MYNTEYE_API std::string get_sdk_install_dir();
} // namespace utils
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_DEVICE_UTILS_H_

View File

@@ -1,74 +1,85 @@
// 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_GLOBAL_H_
#define MYNTEYE_GLOBAL_H_
#pragma once
#ifdef _WIN32
#define OS_WIN
#define MYNTEYE_OS_WIN
#ifdef _WIN64
#define OS_WIN64
#define MYNTEYE_OS_WIN64
#else
#define OS_WIN32
#define MYNTEYE_OS_WIN32
#endif
#if defined(__MINGW32__) || defined(__MINGW64__)
#define OS_MINGW
#define MYNTEYE_OS_MINGW
#ifdef __MINGW64__
#define OS_MINGW64
#define MYNTEYE_OS_MINGW64
#else
#define OS_MINGW32
#define MYNTEYE_OS_MINGW32
#endif
#elif defined(__CYGWIN__) || defined(__CYGWIN32__)
#define OS_CYGWIN
#define MYNTEYE_OS_CYGWIN
#endif
#elif __APPLE__
#include "TargetConditionals.h"
#include <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR
#define OS_IPHONE
#define OS_IPHONE_SIMULATOR
#define MYNTEYE_OS_IPHONE
#define MYNTEYE_OS_IPHONE_SIMULATOR
#elif TARGET_OS_IPHONE
#define OS_IPHONE
#define MYNTEYE_OS_IPHONE
#elif TARGET_OS_MAC
#define OS_MAC
#define MYNTEYE_OS_MAC
#else
#error "Unknown Apple platform"
#endif
#elif __ANDROID__
#define OS_ANDROID
#define MYNTEYE_OS_ANDROID
#elif __linux__
#define OS_LINUX
#define MYNTEYE_OS_LINUX
#elif __unix__
#define OS_UNIX
#define MYNTEYE_OS_UNIX
#elif defined(_POSIX_VERSION)
#define OS_POSIX
#define MYNTEYE_OS_POSIX
#else
#error "Unknown compiler"
#endif
#ifdef OS_WIN
#define DECL_EXPORT __declspec(dllexport)
#define DECL_IMPORT __declspec(dllimport)
#define DECL_HIDDEN
#ifdef MYNTEYE_OS_WIN
#define MYNTEYE_DECL_EXPORT __declspec(dllexport)
#define MYNTEYE_DECL_IMPORT __declspec(dllimport)
#define MYNTEYE_DECL_HIDDEN
#else
#define DECL_EXPORT __attribute__((visibility("default")))
#define DECL_IMPORT __attribute__((visibility("default")))
#define DECL_HIDDEN __attribute__((visibility("hidden")))
#define MYNTEYE_DECL_EXPORT __attribute__((visibility("default")))
#define MYNTEYE_DECL_IMPORT __attribute__((visibility("default")))
#define MYNTEYE_DECL_HIDDEN __attribute__((visibility("hidden")))
#endif
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#define OS_SEP "\\"
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && \
!defined(MYNTEYE_OS_CYGWIN)
#define MYNTEYE_OS_SEP "\\"
#else
#define OS_SEP "/"
#define MYNTEYE_OS_SEP "/"
#endif
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
#define MYNTEYE_STRINGIFY_HELPER(X) #X
#define MYNTEYE_STRINGIFY(X) MYNTEYE_STRINGIFY_HELPER(X)
#define DISABLE_COPY(Class) \
#define MYNTEYE_DISABLE_COPY(Class) \
Class(const Class &) = delete; \
Class &operator=(const Class &) = delete;
#define UNUSED(x) (void)x;
template <typename... T>
void unused(T &&...) {}
#define MYNTEYE_UNUSED(x) (void)x;
#endif // MYNTEYE_GLOBAL_H_

View File

@@ -1,30 +0,0 @@
#ifndef MYNTEYE_GLOG_INIT_H_ // NOLINT
#define MYNTEYE_GLOG_INIT_H_
#pragma once
#include <glog/logging.h>
struct glog_init {
glog_init(int /*argc*/, char *argv[]) {
// FLAGS_logtostderr = true;
FLAGS_alsologtostderr = true;
FLAGS_colorlogtostderr = true;
FLAGS_log_dir = ".";
FLAGS_max_log_size = 1024;
FLAGS_stop_logging_if_full_disk = true;
// FLAGS_v = 2;
google::InitGoogleLogging(argv[0]);
VLOG(2) << __func__;
}
~glog_init() {
VLOG(2) << __func__;
google::ShutdownGoogleLogging();
}
};
#endif // MYNTEYE_GLOG_INIT_H_ NOLINT

83
include/mynteye/logger.h Normal file
View File

@@ -0,0 +1,83 @@
// 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_LOGGER_H_
#define MYNTEYE_LOGGER_H_
#pragma once
#ifdef WITH_GLOG
#include <glog/logging.h>
/** Helper to init glog with args. */
struct glog_init {
/**
* Init glog with args in constructor, and shutdown it in destructor.
*/
glog_init(int argc, char *argv[]) {
(void)argc;
// Set whether log messages go to stderr instead of logfiles
FLAGS_logtostderr = true;
// Set whether log messages go to stderr in addition to logfiles.
// FLAGS_alsologtostderr = true;
// Set color messages logged to stderr (if supported by terminal).
FLAGS_colorlogtostderr = true;
// Log suppression level: messages logged at a lower level than this
// are suppressed.
FLAGS_minloglevel = google::GLOG_INFO;
// If specified, logfiles are written into this directory instead of the
// default logging directory.
FLAGS_log_dir = ".";
// Sets the maximum log file size (in MB).
FLAGS_max_log_size = 8;
// Sets whether to avoid logging to the disk if the disk is full.
FLAGS_stop_logging_if_full_disk = true;
// Show all VLOG(m) messages for m <= this.
// FLAGS_v = 2;
google::InitGoogleLogging(argv[0]);
VLOG(2) << __func__;
}
~glog_init() {
VLOG(2) << __func__;
google::ShutdownGoogleLogging();
}
};
#else
struct glog_init {
glog_init(int argc, char *argv[]) {
(void)argc;
(void)argv;
// Do nothing.
}
};
#define MYNTEYE_MAX_LOG_LEVEL google::INFO
#include "mynteye/miniglog.h"
#endif
#endif // MYNTEYE_LOGGER_H_

469
include/mynteye/miniglog.h Normal file
View File

@@ -0,0 +1,469 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2013 Google Inc. All rights reserved.
// http://code.google.com/p/ceres-solver/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: settinger@google.com (Scott Ettinger)
// mierle@gmail.com (Keir Mierle)
//
// Simplified Glog style logging with Android support. Supported macros in
// decreasing severity level per line:
//
// VLOG(2), VLOG(N)
// VLOG(1),
// LOG(INFO), VLOG(0), LG
// LOG(WARNING),
// LOG(ERROR),
// LOG(FATAL),
//
// With VLOG(n), the output is directed to one of the 5 Android log levels:
//
// 2 - Verbose
// 1 - Debug
// 0 - Info
// -1 - Warning
// -2 - Error
// -3 - Fatal
//
// Any logging of level 2 and above is directed to the Verbose level. All
// Android log output is tagged with the string "native".
//
// If the symbol ANDROID is not defined, all output goes to std::cerr.
// This allows code to be built on a different system for debug.
//
// Portions of this code are taken from the GLOG package. This code is only a
// small subset of the GLOG functionality. Notable differences from GLOG
// behavior include lack of support for displaying unprintable characters and
// lack of stack trace information upon failure of the CHECK macros. On
// non-Android systems, log output goes to std::cerr and is not written to a
// file.
//
// CHECK macros are defined to test for conditions within code. Any CHECK that
// fails will log the failure and terminate the application.
// e.g. CHECK_GE(3, 2) will pass while CHECK_GE(3, 4) will fail after logging
// "Check failed 3 >= 4".
//
// The following CHECK macros are defined:
//
// CHECK(condition) - fails if condition is false and logs condition.
// CHECK_NOTNULL(variable) - fails if the variable is NULL.
//
// The following binary check macros are also defined :
//
// Macro Operator equivalent
// -------------------- -------------------
// CHECK_EQ(val1, val2) val1 == val2
// CHECK_NE(val1, val2) val1 != val2
// CHECK_GT(val1, val2) val1 > val2
// CHECK_GE(val1, val2) val1 >= val2
// CHECK_LT(val1, val2) val1 < val2
// CHECK_LE(val1, val2) val1 <= val2
//
// Debug only versions of all of the check macros are also defined. These
// macros generate no code in a release build, but avoid unused variable
// warnings / errors.
//
// To use the debug only versions, prepend a D to the normal check macros, e.g.
// DCHECK_EQ(a, b).
#ifndef MYNTEYE_MINIGLOG_H_
#define MYNTEYE_MINIGLOG_H_
#include <algorithm>
#include <ctime>
#include <fstream>
#include <iostream>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include "mynteye/mynteye.h"
#ifdef MYNTEYE_OS_ANDROID
# include <android/log.h>
#endif // ANDROID
// Log severity level constants.
#ifdef MYNTEYE_OS_WIN
const int FATAL = -1;
#ifndef ERROR // NOT windows.h
const int ERROR = 0;
#endif
const int WARNING = 1;
const int INFO = 2;
#else
const int FATAL = -3;
const int ERROR = -2;
const int WARNING = -1;
const int INFO = 0;
#endif
// ------------------------- Glog compatibility ------------------------------
namespace google {
typedef int LogSeverity;
const int FATAL = ::FATAL;
#ifndef ERROR // NOT windows.h
const int ERROR = ::ERROR;
#endif
const int WARNING = ::WARNING;
const int INFO = ::INFO;
// Sink class used for integration with mock and test functions. If sinks are
// added, all log output is also sent to each sink through the send function.
// In this implementation, WaitTillSent() is called immediately after the send.
// This implementation is not thread safe.
class MYNTEYE_API LogSink {
public:
virtual ~LogSink() {}
virtual void send(LogSeverity severity,
const char* full_filename,
const char* base_filename,
int line,
const struct tm* tm_time,
const char* message,
size_t message_len) = 0;
virtual void WaitTillSent() = 0;
};
// Global set of log sinks. The actual object is defined in logging.cc.
MYNTEYE_API extern std::set<LogSink *> log_sinks_global;
// Added by chachi - a runtime global maximum log level. Defined in logging.cc
MYNTEYE_API extern int log_severity_global;
inline void InitGoogleLogging(char */*argv*/) {
// Do nothing; this is ignored.
}
// Note: the Log sink functions are not thread safe.
inline void AddLogSink(LogSink *sink) {
// TODO(settinger): Add locks for thread safety.
log_sinks_global.insert(sink);
}
inline void RemoveLogSink(LogSink *sink) {
log_sinks_global.erase(sink);
}
} // namespace google
// ---------------------------- Logger Class --------------------------------
// Class created for each use of the logging macros.
// The logger acts as a stream and routes the final stream contents to the
// Android logcat output at the proper filter level. If ANDROID is not
// defined, output is directed to std::cerr. This class should not
// be directly instantiated in code, rather it should be invoked through the
// use of the log macros LG, LOG, or VLOG.
class MYNTEYE_API MessageLogger {
public:
MessageLogger(const char *file, int line, const char *tag, int severity)
: file_(file), line_(line), tag_(tag), severity_(severity) {
// Pre-pend the stream with the file and line number.
StripBasename(std::string(file), &filename_only_);
stream_ << SeverityLabel() << "/" << filename_only_ << ":" << line << " ";
}
// Output the contents of the stream to the proper channel on destruction.
~MessageLogger() {
stream_ << "\n";
#ifdef MYNTEYE_OS_ANDROID
static const int android_log_levels[] = {
ANDROID_LOG_FATAL, // LOG(FATAL)
ANDROID_LOG_ERROR, // LOG(ERROR)
ANDROID_LOG_WARN, // LOG(WARNING)
ANDROID_LOG_INFO, // LOG(INFO), LG, VLOG(0)
ANDROID_LOG_DEBUG, // VLOG(1)
ANDROID_LOG_VERBOSE, // VLOG(2) .. VLOG(N)
};
// Bound the logging level.
const int kMaxVerboseLevel = 2;
int android_level_index = std::min(std::max(FATAL, severity_),
kMaxVerboseLevel) - FATAL;
int android_log_level = android_log_levels[android_level_index];
// Output the log string the Android log at the appropriate level.
__android_log_write(android_log_level, tag_.c_str(), stream_.str().c_str());
// Indicate termination if needed.
if (severity_ == FATAL) {
__android_log_write(ANDROID_LOG_FATAL,
tag_.c_str(),
"terminating.\n");
}
#else
// If not building on Android, log all output to std::cerr.
std::cerr << stream_.str();
#endif // ANDROID
LogToSinks(severity_);
WaitForSinks();
// Android logging at level FATAL does not terminate execution, so abort()
// is still required to stop the program.
if (severity_ == FATAL) {
abort();
}
}
// Return the stream associated with the logger object.
std::stringstream &stream() { return stream_; }
private:
void LogToSinks(int severity) {
time_t rawtime;
struct tm* timeinfo;
time (&rawtime);
timeinfo = localtime(&rawtime);
std::set<google::LogSink*>::iterator iter;
// Send the log message to all sinks.
for (iter = google::log_sinks_global.begin();
iter != google::log_sinks_global.end(); ++iter) {
(*iter)->send(severity, file_.c_str(), filename_only_.c_str(), line_,
timeinfo, stream_.str().c_str(), stream_.str().size());
}
}
void WaitForSinks() {
// TODO(settinger): Add locks for thread safety.
std::set<google::LogSink *>::iterator iter;
// Call WaitTillSent() for all sinks.
for (iter = google::log_sinks_global.begin();
iter != google::log_sinks_global.end(); ++iter) {
(*iter)->WaitTillSent();
}
}
void StripBasename(const std::string &full_path, std::string *filename) {
// TODO(settinger): Add support for OSs with different path separators.
// const char kSeparator = '/';
size_t pos = full_path.rfind(MYNTEYE_OS_SEP);
if (pos != std::string::npos) {
*filename = full_path.substr(pos + 1, std::string::npos);
} else {
*filename = full_path;
}
}
char SeverityLabel() {
switch (severity_) {
case INFO:
return 'I';
case WARNING:
return 'W';
case ERROR:
return 'E';
case FATAL:
return 'F';
default:
return 'V';
}
}
std::string file_;
std::string filename_only_;
int line_;
std::string tag_;
std::stringstream stream_;
int severity_;
};
// ---------------------- Logging Macro definitions --------------------------
// This class is used to explicitly ignore values in the conditional
// logging macros. This avoids compiler warnings like "value computed
// is not used" and "statement has no effect".
class MYNTEYE_API LoggerVoidify {
public:
LoggerVoidify() { }
// This has to be an operator with a precedence lower than << but
// higher than ?:
void operator&(const std::ostream &/*s*/) { }
};
// Log only if condition is met. Otherwise evaluates to void.
#define LOG_IF(severity, condition) \
(static_cast<int>(severity) > google::log_severity_global || !(condition)) ? \
(void) 0 : LoggerVoidify() & \
MessageLogger((char *)__FILE__, __LINE__, "native", severity).stream()
// Log only if condition is NOT met. Otherwise evaluates to void.
#define LOG_IF_FALSE(severity, condition) LOG_IF(severity, !(condition))
// LG is a convenient shortcut for LOG(INFO). Its use is in new
// google3 code is discouraged and the following shortcut exists for
// backward compatibility with existing code.
#ifdef MYNTEYE_MAX_LOG_LEVEL
# define LOG(n) LOG_IF(n, (n <= MYNTEYE_MAX_LOG_LEVEL))
# define VLOG(n) LOG_IF(n, (n <= MYNTEYE_MAX_LOG_LEVEL))
# define LG LOG_IF(INFO, (INFO <= MYNTEYE_MAX_LOG_LEVEL))
# define VLOG_IF(n, condition) \
LOG_IF(n, (n <= MYNTEYE_MAX_LOG_LEVEL) && condition)
#else
# define LOG(n) LOG_IF(n, true)
# define VLOG(n) LOG_IF(n, true)
# define LG LOG_IF(INFO, true)
# define VLOG_IF(n, condition) LOG_IF(n, condition)
#endif
// Currently, VLOG is always on for levels below MYNTEYE_MAX_LOG_LEVEL.
#ifndef MYNTEYE_MAX_LOG_LEVEL
# define VLOG_IS_ON(x) (1)
#else
# define VLOG_IS_ON(x) (x <= MYNTEYE_MAX_LOG_LEVEL)
#endif
#ifdef MYNTEYE_OS_WIN // INFO is 2, change VLOG(2) to VLOG(4)
#undef VLOG
#undef VLOG_IF
#undef VLOG_IS_ON
#ifdef MYNTEYE_MAX_LOG_LEVEL
# define VLOG(n) LOG_IF(n+2, (n+2 <= MYNTEYE_MAX_LOG_LEVEL))
# define VLOG_IF(n, condition) \
LOG_IF(n+2, (n+2 <= MYNTEYE_MAX_LOG_LEVEL) && condition)
#else
# define VLOG(n) LOG_IF(n+2, true)
# define VLOG_IF(n, condition) LOG_IF(n+2, condition)
#endif
#ifndef MYNTEYE_MAX_LOG_LEVEL
# define VLOG_IS_ON(x) (1+2)
#else
# define VLOG_IS_ON(x) (x+2 <= MYNTEYE_MAX_LOG_LEVEL)
#endif
#endif
#ifndef NDEBUG
# define DLOG LOG
#else
# define DLOG(severity) true ? (void) 0 : LoggerVoidify() & \
MessageLogger((char *)__FILE__, __LINE__, "native", severity).stream()
#endif
// Log a message and terminate.
template<class T>
void LogMessageFatal(const char *file, int line, const T &message) {
MessageLogger(file, line, "native", FATAL).stream() << message;
}
// ---------------------------- CHECK macros ---------------------------------
// Check for a given boolean condition.
#define CHECK(condition) LOG_IF_FALSE(FATAL, condition) \
<< "Check failed: " #condition " "
#ifndef NDEBUG
// Debug only version of CHECK
# define DCHECK(condition) LOG_IF_FALSE(FATAL, condition) \
<< "Check failed: " #condition " "
#else
// Optimized version - generates no code.
# define DCHECK(condition) if (false) LOG_IF_FALSE(FATAL, condition) \
<< "Check failed: " #condition " "
#endif // NDEBUG
// ------------------------- CHECK_OP macros ---------------------------------
// Generic binary operator check macro. This should not be directly invoked,
// instead use the binary comparison macros defined below.
#define CHECK_OP(val1, val2, op) LOG_IF_FALSE(FATAL, (val1 op val2)) \
<< "Check failed: " #val1 " " #op " " #val2 " "
// Check_op macro definitions
#define CHECK_EQ(val1, val2) CHECK_OP(val1, val2, ==)
#define CHECK_NE(val1, val2) CHECK_OP(val1, val2, !=)
#define CHECK_LE(val1, val2) CHECK_OP(val1, val2, <=)
#define CHECK_LT(val1, val2) CHECK_OP(val1, val2, <)
#define CHECK_GE(val1, val2) CHECK_OP(val1, val2, >=)
#define CHECK_GT(val1, val2) CHECK_OP(val1, val2, >)
#ifndef NDEBUG
// Debug only versions of CHECK_OP macros.
# define DCHECK_EQ(val1, val2) CHECK_OP(val1, val2, ==)
# define DCHECK_NE(val1, val2) CHECK_OP(val1, val2, !=)
# define DCHECK_LE(val1, val2) CHECK_OP(val1, val2, <=)
# define DCHECK_LT(val1, val2) CHECK_OP(val1, val2, <)
# define DCHECK_GE(val1, val2) CHECK_OP(val1, val2, >=)
# define DCHECK_GT(val1, val2) CHECK_OP(val1, val2, >)
#else
// These versions generate no code in optimized mode.
# define DCHECK_EQ(val1, val2) if (false) CHECK_OP(val1, val2, ==)
# define DCHECK_NE(val1, val2) if (false) CHECK_OP(val1, val2, !=)
# define DCHECK_LE(val1, val2) if (false) CHECK_OP(val1, val2, <=)
# define DCHECK_LT(val1, val2) if (false) CHECK_OP(val1, val2, <)
# define DCHECK_GE(val1, val2) if (false) CHECK_OP(val1, val2, >=)
# define DCHECK_GT(val1, val2) if (false) CHECK_OP(val1, val2, >)
#endif // NDEBUG
// ---------------------------CHECK_NOTNULL macros ---------------------------
// Helpers for CHECK_NOTNULL(). Two are necessary to support both raw pointers
// and smart pointers.
template <typename T>
T& CheckNotNullCommon(const char *file, int line, const char *names, T& t) {
if (t == NULL) {
LogMessageFatal(file, line, std::string(names));
}
return t;
}
template <typename T>
T* CheckNotNull(const char *file, int line, const char *names, T* t) {
return CheckNotNullCommon(file, line, names, t);
}
template <typename T>
T& CheckNotNull(const char *file, int line, const char *names, T& t) {
return CheckNotNullCommon(file, line, names, t);
}
// Check that a pointer is not null.
#define CHECK_NOTNULL(val) \
CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val))
#ifndef NDEBUG
// Debug only version of CHECK_NOTNULL
#define DCHECK_NOTNULL(val) \
CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val))
#else
// Optimized version - generates no code.
#define DCHECK_NOTNULL(val) if (false)\
CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val))
#endif // NDEBUG
#endif // MYNTEYE_MINIGLOG_H_

View File

@@ -1,3 +1,16 @@
// 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_MYNTEYE_H_
#define MYNTEYE_MYNTEYE_H_
#pragma once
@@ -8,9 +21,9 @@
# define MYNTEYE_API
#else
# ifdef MYNTEYE_EXPORTS
# define MYNTEYE_API DECL_EXPORT
# define MYNTEYE_API MYNTEYE_DECL_EXPORT
# else
# define MYNTEYE_API DECL_IMPORT
# define MYNTEYE_API MYNTEYE_DECL_IMPORT
# endif
#endif
@@ -32,7 +45,7 @@ MYNTEYE_API_VERSION_CHECK( \
((major<<16)|(minor<<8)|(patch)) // NOLINT
/* MYNTEYE_API_VERSION in "X.Y.Z" format */
#define MYNTEYE_API_VERSION_STR (STRINGIFY(MYNTEYE_API_VERSION_MAJOR.MYNTEYE_API_VERSION_MINOR.MYNTEYE_API_VERSION_PATCH)) // NOLINT
#define MYNTEYE_API_VERSION_STR (MYNTEYE_STRINGIFY(MYNTEYE_API_VERSION_MAJOR.MYNTEYE_API_VERSION_MINOR.MYNTEYE_API_VERSION_PATCH)) // NOLINT
#cmakedefine MYNTEYE_NAMESPACE @MYNTEYE_NAMESPACE@
#if defined(MYNTEYE_NAMESPACE)
@@ -45,4 +58,14 @@ MYNTEYE_API_VERSION_CHECK( \
# define MYNTEYE_USE_NAMESPACE
#endif
const char MYNTEYE_SDK_ROOT_DIR[] = "@MYNTEYE_SDK_ROOT_DIR@";
const char MYNTEYE_SDK_INSTALL_DIR[] = "@MYNTEYE_SDK_INSTALL_DIR@";
MYNTEYE_BEGIN_NAMESPACE
template <typename... T>
void UNUSED(T &&...) {}
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_MYNTEYE_H_

View File

@@ -1,4 +1,17 @@
#ifndef MYNTEYE_TYPES_H_ // NOLINT
// 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_TYPES_H_
#define MYNTEYE_TYPES_H_
#pragma once
@@ -59,21 +72,21 @@ enum class Stream : std::uint8_t {
* might provide.
*/
enum class Capabilities : std::uint8_t {
/** Provices stereo stream */
/** Provides stereo stream */
STEREO,
/** Provices color stream */
/** Provides color stream */
COLOR,
/** Provices depth stream */
/** Provides depth stream */
DEPTH,
/** Provices point cloud stream */
/** Provides point cloud stream */
POINTS,
/** Provices fisheye stream */
/** Provides fisheye stream */
FISHEYE,
/** Provices infrared stream */
/** Provides infrared stream */
INFRARED,
/** Provices second infrared stream */
/** Provides second infrared stream */
INFRARED2,
/** Provices IMU (accelerometer, gyroscope) data */
/** Provides IMU (accelerometer, gyroscope) data */
IMU,
/** Last guard */
LAST
@@ -110,15 +123,35 @@ enum class Info : std::uint8_t {
* @brief Camera control options define general configuration controls.
*/
enum class Option : std::uint8_t {
/** Image gain, setting it if manual-exposure */
/**
* Image gain, valid if manual-exposure
*
* range: [0,48], default: 24
*/
GAIN,
/** Image brightness, setting it if manual-exposure */
/**
* Image brightness, valid if manual-exposure
*
* range: [0,240], default: 120
*/
BRIGHTNESS,
/** Image contrast */
/**
* Image contrast, valid if manual-exposure
*
* range: [0,255], default: 127
*/
CONTRAST,
/** Image frame rate, must set IMU_FREQUENCY together */
/**
* Image frame rate, must set IMU_FREQUENCY together
*
* values: {10,15,20,25,30,35,40,45,50,55,60}, default: 25
*/
FRAME_RATE,
/** IMU frequency, must set FRAME_RATE together */
/**
* IMU frequency, must set FRAME_RATE together
*
* values: {100,200,250,333,500}, default: 200
*/
IMU_FREQUENCY,
/**
* Exposure mode
@@ -127,13 +160,29 @@ enum class Option : std::uint8_t {
* 1: disable auto-exposure (manual-exposure)
*/
EXPOSURE_MODE,
/** Max gain, setting it if auto-exposure */
/**
* Max gain, valid if auto-exposure
*
* range: [0,48], default: 48
*/
MAX_GAIN,
/** Max exposure time, setting it if auto-exposure */
/**
* Max exposure time, valid if auto-exposure
*
* range: [0,240], default: 240
*/
MAX_EXPOSURE_TIME,
/** Desired brightness */
/**
* Desired brightness, valid if auto-exposure
*
* range: [0,255], default: 192
*/
DESIRED_BRIGHTNESS,
/** IR control */
/**
* IR control
*
* range: [0,160], default: 0
*/
IR_CONTROL,
/**
* HDR mode
@@ -146,6 +195,18 @@ enum class Option : std::uint8_t {
ZERO_DRIFT_CALIBRATION,
/** Erase chip */
ERASE_CHIP,
/**
* The range of accelerometer
*
* values: {4,8,16,32}, default: 8
*/
ACCELEROMETER_RANGE,
/**
* The range of gyroscope
*
* values: {500,1000,2000,4000}, default: 1000
*/
GYROSCOPE_RANGE,
/** Last guard */
LAST
};
@@ -165,8 +226,21 @@ enum class Source : std::uint8_t {
LAST
};
/**
* @ingroup enumerations
* @brief Add-Ons are peripheral modules of our hardware.
*/
enum class AddOns : std::uint8_t {
/** Infrared */
INFRARED,
/** Second infrared */
INFRARED2,
/** Last guard */
LAST
};
#define MYNTEYE_ENUM_HELPERS(TYPE) \
const char *to_string(const TYPE &value); \
MYNTEYE_API const char *to_string(const TYPE &value); \
inline bool is_valid(const TYPE &value) { \
using utype = std::underlying_type<TYPE>::type; \
utype val = static_cast<utype>(value); \
@@ -187,6 +261,7 @@ MYNTEYE_ENUM_HELPERS(Capabilities)
MYNTEYE_ENUM_HELPERS(Info)
MYNTEYE_ENUM_HELPERS(Option)
MYNTEYE_ENUM_HELPERS(Source)
MYNTEYE_ENUM_HELPERS(AddOns)
#undef MYNTEYE_ENUM_HELPERS
@@ -209,25 +284,25 @@ enum class Format : std::uint32_t {
#undef MYNTEYE_FOURCC
const char *to_string(const Format &value);
MYNTEYE_API const char *to_string(const Format &value);
inline std::ostream &operator<<(std::ostream &os, const Format &value) {
return os << to_string(value);
}
std::size_t bytes_per_pixel(const Format &value);
MYNTEYE_API std::size_t bytes_per_pixel(const Format &value);
/**
* Stream request.
*/
struct MYNTEYE_API StreamRequest {
/** width in pixels */
/** Stream width in pixels */
std::uint16_t width;
/** height in pixels */
/** Stream height in pixels */
std::uint16_t height;
/** stream pixel format */
/** Stream pixel format */
Format format;
/** frames per second (unused) */
/** Stream frames per second (unused) */
std::uint16_t fps;
bool operator==(const StreamRequest &other) const {
@@ -239,6 +314,7 @@ struct MYNTEYE_API StreamRequest {
}
};
MYNTEYE_API
std::ostream &operator<<(std::ostream &os, const StreamRequest &request);
/**
@@ -251,24 +327,25 @@ std::ostream &operator<<(std::ostream &os, const StreamRequest &request);
* Stream intrinsics,
*/
struct MYNTEYE_API Intrinsics {
/** width of the image in pixels */
/** The width of the image in pixels */
std::uint16_t width;
/** height of the image in pixels */
/** The height of the image in pixels */
std::uint16_t height;
/** focal length of the image plane, as a multiple of pixel width */
/** The focal length of the image plane, as a multiple of pixel width */
double fx;
/** focal length of the image plane, as a multiple of pixel height */
/** The focal length of the image plane, as a multiple of pixel height */
double fy;
/** horizontal coordinate of the principal point of the image */
/** The horizontal coordinate of the principal point of the image */
double cx;
/** vertical coordinate of the principal point of the image */
/** The vertical coordinate of the principal point of the image */
double cy;
/** distortion model of the image */
/** The distortion model of the image */
std::uint8_t model;
/** distortion coefficients: k1,k2,p1,p2,k3 */
/** The distortion coefficients: k1,k2,p1,p2,k3 */
double coeffs[5];
};
MYNTEYE_API
std::ostream &operator<<(std::ostream &os, const Intrinsics &in);
/**
@@ -277,9 +354,12 @@ std::ostream &operator<<(std::ostream &os, const Intrinsics &in);
*/
struct MYNTEYE_API ImuIntrinsics {
/**
* Scale matrix.
* \code
* Scale X cross axis cross axis
* cross axis Scale Y cross axis
* cross axis cross axis Scale Z
* \endcode
*/
double scale[3][3];
/* Zero-drift: X, Y, Z */
@@ -291,6 +371,7 @@ struct MYNTEYE_API ImuIntrinsics {
double bias[3];
};
MYNTEYE_API
std::ostream &operator<<(std::ostream &os, const ImuIntrinsics &in);
/**
@@ -298,10 +379,11 @@ std::ostream &operator<<(std::ostream &os, const ImuIntrinsics &in);
* Motion intrinsics, including accelerometer and gyroscope.
*/
struct MYNTEYE_API MotionIntrinsics {
ImuIntrinsics accel;
ImuIntrinsics gyro;
ImuIntrinsics accel; /**< Accelerometer intrinsics */
ImuIntrinsics gyro; /**< Gyroscope intrinsics */
};
MYNTEYE_API
std::ostream &operator<<(std::ostream &os, const MotionIntrinsics &in);
/**
@@ -309,10 +391,22 @@ std::ostream &operator<<(std::ostream &os, const MotionIntrinsics &in);
* Extrinsics, represent how the different datas are connected.
*/
struct MYNTEYE_API Extrinsics {
double rotation[3][3]; /**< rotation matrix */
double translation[3]; /**< translation vector */
double rotation[3][3]; /**< Rotation matrix */
double translation[3]; /**< Translation vector */
/**
* Inverse this extrinsics.
* @return the inversed extrinsics.
*/
Extrinsics Inverse() const {
return {{{rotation[0][0], rotation[1][0], rotation[2][0]},
{rotation[0][1], rotation[1][1], rotation[2][1]},
{rotation[0][2], rotation[1][2], rotation[2][2]}},
{-translation[0], -translation[1], -translation[2]}};
}
};
MYNTEYE_API
std::ostream &operator<<(std::ostream &os, const Extrinsics &ex);
/**
@@ -329,7 +423,7 @@ struct MYNTEYE_API ImgData {
std::uint16_t frame_id;
/** Image timestamp in 0.01ms */
std::uint32_t timestamp;
/** Image exposure time in 0.01ms */
/** Image exposure time, virtual value in [1, 480] */
std::uint16_t exposure_time;
void Reset() {
@@ -388,11 +482,17 @@ struct MYNTEYE_API ImuData {
* Option info.
*/
struct MYNTEYE_API OptionInfo {
/** Minimum value */
std::int32_t min;
/** Maximum value */
std::int32_t max;
/** Default value */
std::int32_t def;
};
MYNTEYE_API
std::ostream &operator<<(std::ostream &os, const OptionInfo &info);
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_TYPES_H_ NOLINT
#endif // MYNTEYE_TYPES_H_

View File

@@ -0,0 +1,32 @@
// 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_UTIL_FILES_H_
#define MYNTEYE_UTIL_FILES_H_
#pragma once
#include <string>
#include "mynteye/mynteye.h"
MYNTEYE_BEGIN_NAMESPACE
namespace files {
MYNTEYE_API bool mkdir(const std::string &path);
} // namespace files
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_UTIL_FILES_H_

View File

@@ -0,0 +1,62 @@
// 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_UTIL_STRINGS_H_
#define MYNTEYE_UTIL_STRINGS_H_
#pragma once
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include "mynteye/mynteye.h"
MYNTEYE_BEGIN_NAMESPACE
/** The strings error */
class MYNTEYE_API strings_error : public std::runtime_error {
public:
explicit strings_error(const std::string &what_arg) noexcept
: std::runtime_error(std::move(what_arg)) {}
explicit strings_error(const char *what_arg) noexcept
: std::runtime_error(std::move(what_arg)) {}
};
namespace strings {
MYNTEYE_API
int hex2int(const std::string &text);
MYNTEYE_API
bool starts_with(const std::string &text, const std::string &prefix);
MYNTEYE_API
bool ends_with(const std::string &text, const std::string &suffix);
MYNTEYE_API
std::vector<std::string> split(
const std::string &text, const std::string &delimiters);
MYNTEYE_API void ltrim(std::string &s); // NOLINT
MYNTEYE_API void rtrim(std::string &s); // NOLINT
MYNTEYE_API void trim(std::string &s); // NOLINT
MYNTEYE_API
std::string trim_copy(const std::string &text);
} // namespace strings
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_UTIL_STRINGS_H_

View File

@@ -1,5 +1,18 @@
#ifndef MYNTEYE_INTERNAL_TIMES_H_ // NOLINT
#define MYNTEYE_INTERNAL_TIMES_H_
// 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_UTIL_TIMES_H_
#define MYNTEYE_UTIL_TIMES_H_
#pragma once
#include <chrono>
@@ -173,7 +186,7 @@ inline std::string to_string(
const system_clock::time_point &t, const std::tm *tm,
const char *fmt = "%F %T", std::int32_t precision = 6) {
std::stringstream ss;
#if defined(OS_ANDROID) || defined(OS_LINUX)
#if defined(MYNTEYE_OS_ANDROID) || defined(MYNTEYE_OS_LINUX)
char foo[20];
strftime(foo, sizeof(foo), fmt, tm);
ss << foo;
@@ -207,4 +220,4 @@ inline std::string to_utc_string(
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_INTERNAL_TIMES_H_ NOLINT
#endif // MYNTEYE_UTIL_TIMES_H_

View File

@@ -1,22 +0,0 @@
#ifndef MYNTEYE_UTILS_H_ // NOLINT
#define MYNTEYE_UTILS_H_
#pragma once
#include <memory>
#include "mynteye/mynteye.h"
MYNTEYE_BEGIN_NAMESPACE
class Device;
namespace device {
/** Detecting MYNT EYE devices and prompt user to select one */
std::shared_ptr<Device> select();
} // namespace device
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_UTILS_H_ NOLINT

View File

@@ -1,3 +1,20 @@
# 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.
@PACKAGE_INIT@
set(mynteye_WITH_API @WITH_API@)
set(mynteye_WITH_GLOG @WITH_GLOG@)
include("${CMAKE_CURRENT_LIST_DIR}/mynteye-targets.cmake")

View File

@@ -0,0 +1,76 @@
# How to use MYNT® EYE S SDK with Visual Studio 2017
This tutorial will create a project with Visual Studio 2017 to start using MYNT® EYE S SDK.
## Preparation
Install the win pack of MYNT® EYE S SDK.
## Create Project
Open Visual Studio 2017, then `File > New > Project`,
![](images/1_new_pro.png)
Select "Windows Console Application", set the project's name and location, click "OK",
![](images/2_new_pro.png)
Finally, you will see the new project like this,
![](images/3_new_pro.png)
## Config Properties
Right click the project, and open its "Properties" window,
![](images/4_config.png)
Change "Configuration" to "All Configurations", then add the following paths to "Additional Include Directories",
```bash
$(MYNTEYES_SDK_ROOT)\include
$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\include
```
![](images/5_config_include.png)
Add the following paths to "Additional Library Directories",
```bash
$(MYNTEYES_SDK_ROOT)\lib
$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\x64\vc15\lib
```
![](images/6_config_lib_dir.png)
Add the following libs to "Additional Dependencies",
```bash
mynteye.lib
opencv_world343.lib
```
![](images/7_config_lib.png)
If you wanna debug, could change "Configuration" to "Debug" and add these debug libs,
```bash
mynteyed.lib
opencv_world343d.lib
```
![](images/8_config_debug_lib.png)
## Start using SDK
Include the headers of SDK and start using its APIs,
![](images/9_run_x64.png)
Select "Release x64" or "Debug x64" to run the project.
<!--
![](images/10_path.png)
-->

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -0,0 +1,4 @@
/.vs/
/x64/
/mynteyes_demo/x64/
/mynteyes_demo/*.user

View File

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2018
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mynteyes_demo", "mynteyes_demo\mynteyes_demo.vcxproj", "{49798F84-3EA3-4CB5-A873-6163DB4B4A43}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{49798F84-3EA3-4CB5-A873-6163DB4B4A43}.Debug|x64.ActiveCfg = Debug|x64
{49798F84-3EA3-4CB5-A873-6163DB4B4A43}.Debug|x64.Build.0 = Debug|x64
{49798F84-3EA3-4CB5-A873-6163DB4B4A43}.Debug|x86.ActiveCfg = Debug|Win32
{49798F84-3EA3-4CB5-A873-6163DB4B4A43}.Debug|x86.Build.0 = Debug|Win32
{49798F84-3EA3-4CB5-A873-6163DB4B4A43}.Release|x64.ActiveCfg = Release|x64
{49798F84-3EA3-4CB5-A873-6163DB4B4A43}.Release|x64.Build.0 = Release|x64
{49798F84-3EA3-4CB5-A873-6163DB4B4A43}.Release|x86.ActiveCfg = Release|Win32
{49798F84-3EA3-4CB5-A873-6163DB4B4A43}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F6C50224-4EC6-46EB-AA63-7E32FC6F0648}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{49798F84-3EA3-4CB5-A873-6163DB4B4A43}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>mynteyesdemo</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\include;$(MYNTEYES_SDK_ROOT)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\x64\vc15\lib;$(MYNTEYES_SDK_ROOT)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>mynteyed.lib;opencv_world343d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\include;$(MYNTEYES_SDK_ROOT)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\x64\vc15\lib;$(MYNTEYES_SDK_ROOT)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>mynteyed.lib;opencv_world343d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\include;$(MYNTEYES_SDK_ROOT)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\x64\vc15\lib;$(MYNTEYES_SDK_ROOT)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>mynteye.lib;opencv_world343.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\include;$(MYNTEYES_SDK_ROOT)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(MYNTEYES_SDK_ROOT)\3rdparty\opencv\build\x64\vc15\lib;$(MYNTEYES_SDK_ROOT)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>mynteye.lib;opencv_world343.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="mynteyes_demo.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="mynteyes_demo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

176
platforms/win/README.txt Normal file
View File

@@ -0,0 +1,176 @@
# MYNT® EYE S SDK
################################################################################
Language: 简体中文
################################################################################
## 如何开始使用 SDK
1) 运行样例程序
安装完 SDK 的 exe 安装包后,桌面会生成 SDK 根目录的快捷方式。
进入 "<SDK_ROOT_DIR>\bin\samples\tutorials" 目录,双击 "get_stereo.exe" 运行,即可看到双目实时画面。
2生成样例工程
首先,安装好 Visual Studio 2017 <https://visualstudio.microsoft.com/> 和 CMake <https://cmake.org/> 。
接着,进入 "<SDK_ROOT_DIR>\samples" 目录, 双击 "generate.bat" 即可生成样例工程。
p.s. 样例教程,可见 https://slightech.github.io/MYNT-EYE-S-SDK/ 主页给出的 Guide 文档。
p.p.s. 运行结果,参考下方英文内容。
3如何于 Visual Studio 2017 下使用 SDK
进入 "<SDK_ROOT_DIR>\projects\vs2017" ,见 "README.md" 说明。
################################################################################
Language: English
################################################################################
## How to start using SDK
1) Run the prebuilt samples, ensure the SDK works well.
After you install the win pack of SDK, there will be a shortcut to the SDK root directory on your desktop.
First, you should plug the MYNT® EYE camera in a USB 3.0 port.
Second, goto the "<SDK_ROOT_DIR>\bin\samples\tutorials" directory and click "get_stereo.exe" to run.
Finally, you will see the window that display the realtime frame of the camera.
2) Generate samples project of Visual Studio 2017.
First, you should install Visual Studio 2017 <https://visualstudio.microsoft.com/> and CMake <https://cmake.org/>.
Second, goto the "<SDK_ROOT_DIR>\samples" directory and click "generate.bat" to run.
Finally, you could click `_build\mynteye_samples.sln` to open the samples project.
p.s. The tutorials of samples are here: https://slightech.github.io/MYNT-EYE-S-SDK-Guide/src/data/contents.html.
p.p.s. The example result of "generate.bat",
```cmd
-- The C compiler identification is MSVC 19.14.26429.4
-- The CXX compiler identification is MSVC 19.14.26429.4
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- HOST_ARCH: x86_64
-- OpenCV ARCH: x64
-- OpenCV RUNTIME: vc15
-- OpenCV STATIC: OFF
-- Found OpenCV: C:/Users/John/AppData/Roaming/Slightech/MYNTEYES/SDK/2.2.1/3rdparty/opencv/build (found version "3.4.3")
-- Found OpenCV 3.4.3 in C:/Users/John/AppData/Roaming/Slightech/MYNTEYES/SDK/2.2.1/3rdparty/opencv/build/x64/vc15/lib
-- You might need to add C:\Users\John\AppData\Roaming\Slightech\MYNTEYES\SDK\2.2.1\3rdparty\opencv\build\x64\vc15\bin to your PATH to be able to run your applications.
-- Found OpenCV: 3.4.3
CMake Warning at C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1542 (_Boost_MISSING_DEPENDENCIES)
C:/Users/John/AppData/Roaming/Slightech/MYNTEYES/SDK/2.2.1/cmake/Option.cmake:47 (find_package)
CMakeLists.txt:26 (include)
-- Could NOT find Boost
--
-- Platform:
-- HOST_OS: Win
-- HOST_NAME: Win
-- HOST_ARCH: x86_64
-- HOST_COMPILER: MSVC
-- COMPILER_VERSION: 19.14.26429.4
-- COMPILER_VERSION_MAJOR: 19
-- COMPILER_VERSION_MINOR: 14
-- COMPILER_VERSION_PATCH: 26429
-- COMPILER_VERSION_TWEAK: 4
-- CUDA_VERSION: 9.2
-- CUDA_VERSION_MAJOR: 9
-- CUDA_VERSION_MINOR: 2
-- CUDA_VERSION_STRING: 9.2
-- OpenCV_VERSION: 3.4.3
-- OpenCV_VERSION_MAJOR: 3
-- OpenCV_VERSION_MINOR: 4
-- OpenCV_VERSION_PATCH: 3
-- OpenCV_VERSION_TWEAK: 0
-- OpenCV_VERSION_STATUS:
-- OpenCV_WITH_WORLD: TRUE
--
-- Options:
-- WITH_API: ON
-- OpenCV: YES
-- OpenCV_VERSION: 3.4.3
-- OpenCV_WORLD: YES
-- WITH_DEVICE_INFO_REQUIRED: ON
-- WITH_BOOST: ON
-- Boost: NO
-- WITH_GLOG: OFF
--
-- Features:
-- Filesystem: native
--
-- Visual Studio >= 2010, MSVC >= 10.0
-- C_FLAGS: /DWIN32 /D_WINDOWS /W3 -Wall -march=native
-- CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR /EHsc -Wall -march=native
-- Found mynteye: 2.2.1
-- Generating camera_a.bat
-- Generating get_depth_with_region.bat
-- Generating camera_d.bat
-- Generating camera_u.bat
CMake Warning at tutorials/CMakeLists.txt:70 (find_package):
By not providing "FindPCL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "PCL", but
CMake did not find one.
Could not find a package configuration file provided by "PCL" with any of
the following names:
PCLConfig.cmake
pcl-config.cmake
Add the installation prefix of "PCL" to CMAKE_PREFIX_PATH or set "PCL_DIR"
to a directory containing one of the above files. If "PCL" provides a
separate development package or SDK, be sure it has been installed.
CMake Warning at tutorials/CMakeLists.txt:86 (message):
PCL not found :(
-- Generating get_device_info.bat
-- Generating get_img_params.bat
-- Generating get_imu_params.bat
-- Generating get_stereo.bat
-- Generating get_stereo_rectified.bat
-- Generating get_disparity.bat
-- Generating get_depth.bat
-- Generating get_imu.bat
-- Generating get_from_callbacks.bat
-- Generating get_with_plugin.bat
-- Generating ctrl_framerate.bat
-- Generating ctrl_auto_exposure.bat
-- Generating ctrl_manual_exposure.bat
-- Generating ctrl_infrared.bat
-- Generating get_all_device_info.bat
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/John/AppData/Roaming/Slightech/MYNTEYES/SDK/2.2.1/samples/_build
Press any key to continue . . .
```
3) Start using MYNT® EYE S SDK with Visual Studio 2017
Goto the "<SDK_ROOT_DIR>\projects\vs2017", see the "README.md".

Some files were not shown because too many files have changed in this diff Show More