2 Analyze images captured by USB camera and then move camera angle by using servo motors.
4 ## HOW TO RUN - First run
7 Tizen 5.0 M2 IoT 부트 이미지 다운로드 [[링크](http://download.tizen.org/releases/milestone/tizen/unified/tizen-unified_20181024.1/images/standard/iot-boot-armv7l-artik533s/)]
9 Tizen 5.0 M2 Iot Headed 이미지 다운로드 [[링크](http://download.tizen.org/releases/milestone/tizen/unified/tizen-unified_20181024.1/images/standard/iot-headed-3parts-armv7l-artik530_710/)]
13 lthor tizen-unified_20181024.1_iot-boot-armv7l-artik533s.tar.gz tizen-unified_20181024.1_iot-headed-3parts-armv7l-artik530_710.tar.gz
16 ### 2. Install plug-in
18 ARTIK 530(5.0) Plugin download from https://developer.samsung.com/tizendevice/firmware
21 ### 3. Install Wifi util (*optional)
22 Tizen 5.0 M2 wifi-manager-tool 다운로드 [[링크](http://download.tizen.org/releases/milestone/tizen/unified/tizen-unified_20181024.1/repos/standard/packages/armv7l/capi-network-wifi-manager-tool-1.0.39-81.5.armv7l.rpm)]
24 sdb root on; sdb shell 'mount -o remount,rw /'
26 sdb push capi-network-wifi-manager-tool-1.0.39-81.5.armv7l.rpm /tmp
28 sdb shell 'rpm -ivh /tmp/capi-network-wifi-manager-tool-1.0.39-81.5.armv7l.rpm'
31 ### 4. Build and install custom version of IoT.js to include WebSocket feature
33 git clone https://github.com/Samsung/iotjs.git
37 sed -i 's/Release: 0/Release: 99/' config/tizen/packaging/iotjs.spec
39 sed -i '/--no-parallel-build/a \ \ --cmake-param=-DENABLE_MODULE_WEBSOCKET=ON \\' config/tizen/packaging/iotjs.spec
41 git diff config/tizen/packaging/iotjs.spec
43 ./config/tizen/gbsbuild.sh --clean
45 sdb push ~/GBS-ROOT/local/repos/tizen_unified_m1/armv7l/RPMS/iotjs-1.0.0-9.0.armv7l.rpm /tmp
47 sdb shell 'cd /tmp; rpm -ivh iotjs-1.0.0-9.0.armv7l.rpm'
49 - https://github.com/Samsung/iotjs/wiki/Build-for-RPi3-Tizen
50 - https://github.com/Samsung/iotjs/blob/master/docs/api/IoT.js-API-WebSocket.md
53 ### 5. Change camera setting
55 sdb shell "cat /etc/multimedia/mmfw_camcorder_camera0.ini | grep 640"
57 sdb shell "sed -i 's/640,480/320,240/g' /etc/multimedia/mmfw_camcorder_camera0.ini"
59 sdb shell "cat /etc/multimedia/mmfw_camcorder_camera0.ini | grep 320"
62 ### 6. Build and install vision app
64 git clone git://git.tizen.org/apps/native/smart-surveillance-camera # This git
66 cd smart-surveillance-camera
68 gbs build -A armv7l --include-all
70 sdb push ~/GBS-ROOT/local/BUILD-ROOTS/scratch.armv7l.0/home/abuild/rpmbuild/RPMS/armv7l/iot-vision-camera-0.0.1-1.armv7l.rpm /tmp
72 sdb shell 'rpm -ivh --force /tmp/iot-vision-camera-0.0.1-1.armv7l.rpm'
74 ### 7. Some more settings
76 sdb shell 'pkg_initdb'
78 ### 8. Launch vision app
80 sdb shell 'app_launcher -s iot-vision-camera'
82 ### 9. Check vision app activity
84 sdb shell 'ls -l /tmp/latest.jpg'
86 ### 10. Install and run monitor server
87 * If you install latest version of "iot-vision-camera" package, the monitor server is automatically launched in booting time
89 * To check status of the monitor server
91 sdb shell 'systemctl status iot-dashboard'
94 * To restart the monitor server
96 sdb shell 'systemctl stop iot-dashboard'
97 sdb shell 'systemctl start iot-dashboard'
98 sdb shell 'systemctl status iot-dashboard' # To check status
101 * To update some files of the monitor server, push the files to dashboard path `/opt/home/dashboard` and restart the monitor server as above
103 sdb shell push {path/yourfile} /opt/home/dashboard/{path}
105 OR! YOU CAN SIMPLY USE THE SCRIPT:
107 ./update-dashboard.sh
111 ## HOW TO RUN - Subsequent Runs
113 sdb root on; sdb shell 'mount -o remount,rw /'
115 sdb shell 'app_launcher -s iot-vision-camera'
117 ./update-dashboard.sh
123 슈퍼슬로우 카메라로 촬영결과 500ms 정도 소요
127 #### Image Encoding (buffer -> jpg file)
128 소요시간 20 ~ 135ms (가끔씩 오래걸림, 장담 못함)
130 #### Vision Survailance (input -> cb event)
136 #### Image Encoding (buffer -> jpg file)
137 소요시간 10 ~ 20ms, 대부분 10ms 초반 안정적
139 #### Vision Survailance (input -> cb event)
142 ## Vision 움직임 정보 형식 (exif)
143 최대 244Byte 크기의 스트링으로 모두 숫자로 이루어져있다.
145 첫 2자리 숫자는 분석결과의 타입으로 TT 의 값을 갖는다.
147 그 다음 2자리 숫자는 포함된 움직임의 갯수 NN 의 값을 갖는다.
149 하나의 움직임은 8개 숫자로 구성되며 xxyywwhh 의 값을 갖는다.
156 각각 0~99까지의 범위를 갖는 4개의 숫자를 이어놓은 것이다.
157 1자리 숫자의 경우 0을 넣어서 전체 길이를 고정한다.
159 TTNNxxyywwhhxxyywwhh....xxyywwhh 의 형태의 스트링이 된다.