diff --git a/README.md b/README.md new file mode 100644 index 0000000..f9db602 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# rscvdnn +A Visual C++ project to test run the *OpenCV DNN object detection* with *RealSense* camera. The GUI utilize a modified version of gorgeous *nanogui* and use *OpenGL shader* to render video streams. + +The *Deep Neural Network* part of codes are derived from [MobileNet Single-Shot Detector](https://github.com/opencv/opencv/blob/master/samples/dnn/ssd_mobilenet_object_detection.cpp) example of *OpenCV*. The trained [Caffe model](https://github.com/chuanqi305/MobileNet-SSD) (included in project [resources](https://github.com/twMr7/rscvdnn/tree/master/resources)) is loaded at the beginning and used to classify 20 object classes from RGB image. Note that only the center square ROI is the hot detecting spot, the unused side bands shall turn gray by design. For each detected object, the distance is estimated from its detected location within corresponding depth frame. + +## Screenshot +![screenshot_eng](./resources/screenshot_eng.png) +![screenshot_zh_TW](./resources/screenshot_cht.png) + +## Build Instruction + +This VC++ project rely on the integration environment of [*vcpkg*](https://github.com/Microsoft/vcpkg) ports. Follow the [instruction](https://github.com/Microsoft/vcpkg/blob/master/README.md) to install vcpkg and run `.\vcpkg integrate install`, then install following dependency ports with `.\vcpkg install :x64-windows`, + +- **opencv** +- **realsense2** +- **poco** +- **eigen3** +- **stb** +- **glfw3** + +where *eigen3*, *glfw3*, and *stb* ports need to setup additional static liked packages for *nanogui* to build. Please create a file `"x64-windows-static-md.cmake"` in `vcpkg/triplets` folder with the following contents, +``` +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) +``` +then install these three ports with `.\vcpkg install :x64-windows-static-md`. \ No newline at end of file diff --git a/resources/screenshot_cht.png b/resources/screenshot_cht.png new file mode 100644 index 0000000..39b51be Binary files /dev/null and b/resources/screenshot_cht.png differ diff --git a/resources/screenshot_eng.png b/resources/screenshot_eng.png new file mode 100644 index 0000000..af9dbff Binary files /dev/null and b/resources/screenshot_eng.png differ diff --git a/rscvdnn.sln b/rscvdnn.sln index 6b5bc73..6ba75ff 100644 --- a/rscvdnn.sln +++ b/rscvdnn.sln @@ -8,6 +8,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{247CF735-1098-44AC-AF58-A1B4C8FB2E83}" ProjectSection(SolutionItems) = preProject CommonSetup.props = CommonSetup.props + README.md = README.md EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nanogui", "nanogui\nanogui.vcxproj", "{6089ABC6-6E53-4D69-8F96-E4BA91EAA18C}" diff --git a/rscvdnn/MainWindow.cpp b/rscvdnn/MainWindow.cpp index 2b4177d..8979cdc 100644 --- a/rscvdnn/MainWindow.cpp +++ b/rscvdnn/MainWindow.cpp @@ -172,12 +172,12 @@ bool MainWindow::keyboardEvent(int key, int scancode, int action, int modifiers) bool MainWindow::resizeEvent(const Eigen::Vector2i & size) { // rescale setting window, the minimum width 150 is expected to be good enough, only height is resized - Vector2i new_setting_size = Vector2i(std::max(150, _settingWindow->size()(0)), size(1) - 2); + Vector2i new_setting_size = Vector2i(std::max(150, _settingWindow->size()(0)), size(1) - 3); _settingWindow->setSize(new_setting_size); // color window take full available space if (_colorWindow != nullptr) - _colorWindow->setSize(Vector2i(size(0) - new_setting_size(0) - 2, size(1) - 2)); + _colorWindow->setSize(Vector2i(size(0) - new_setting_size(0) - 3, size(1) - 15)); if (_depthWindow != nullptr) {