Skip to content
This repository has been archived by the owner on Sep 18, 2018. It is now read-only.

Lab 1. Thresholding #1

Closed
rgolovanov opened this issue Sep 11, 2017 · 2 comments
Closed

Lab 1. Thresholding #1

rgolovanov opened this issue Sep 11, 2017 · 2 comments
Labels

Comments

@rgolovanov
Copy link
Contributor

rgolovanov commented Sep 11, 2017

Preparing

  1. Register github account if you haven't it yet.
  2. Meet with git and practice locally.
  3. Create private repository by accepting following link
  4. Configure git locally
  5. Install latest CMake 3.9.2 x64
  6. Download and unpack binaries of OpenCV 3.3 vc14.
  7. Add system environment variables:
    • OPENCV_DIR="C:\Users\roman\Downloads\opencv\build" as an example.
    • append Path with "%OPENCV_DIR%\build\x64\vc14\bin"
  8. Install Visual Studio 2015 or 2017.
  9. Clone your repository: git clone git@github.com:cvlabmiet/your-private-repository.git
    • Add main.cpp with simple content:
#include <iostream>

int main()
{
   std::cout << "Hello World!\n";
   return 0;
}

and CMakeLists.txt file with following content:

cmake_minimum_required(VERSION 3.2)

project(CV17)

add_compile_options(/W4)
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )

add_executable(lab1 main.cpp)
target_link_libraries( lab1 ${OpenCV_LIBS} )
  1. Run cmd.exe staying inside your repository folder:
    mkdir build
    cmake .. -G "Visual Studio 14 2015 Win64"
    

This command shall generate solution and project files.
7. Open generated build\CV17.sln file in Visual Studio
8. Build and Run solution

Task

  1. Create simple cross-platform project based on opencv.
  2. Application should show gray-scale image captured from web camera. Window should two trackbars:
    • Enable threshold segmentation [0, 1] (2 values)
    • Threshold level [0, 1, ..., 255] (256 values)
  3. Trackbar movements shall be dynamycally handled and applied to new images.
  4. Red text with current FPS shall be shown at the bottom of the window and aligned by center:
    "fps: 19.127"

References

@rgolovanov
Copy link
Contributor Author

rgolovanov commented Sep 21, 2017

Enhancements

Please fix issues listed below and existed in your code:

  1. Use Google C++ Style Guide for formatting and commenting your code.
  2. Recreating cv::Mat structures on each step.
  3. Calculate fps for full cycle and not only for thresholding part.
  4. Calculate static values only 1 time, e.g. text position and size.
  5. Output image should be binary (black & white).
  6. Use something like moving average to show averaged and not dancing fps (use 30 latest values).

@rgolovanov
Copy link
Contributor Author

@cvlabmiet/cvstudents17 please check coding style again. You could use cpplint.py tool for that, e.g.:

d:\edu\cv17>cpplint\cpplint.py 1-threshold-segmentation-dvorotnev\main.cpp
1-threshold-segmentation-dvorotnev\main.cpp:0:  No copyright message found.  You should have a line: "Copyright [year] <Copyright Owner>"  [legal/copyright] [5]
1-threshold-segmentation-dvorotnev\main.cpp:2:  Found C++ system header after other header. Should be: main.h, c system, c++ system, other.  [build/include_order] [4]
1-threshold-segmentation-dvorotnev\main.cpp:4:  Do not use namespace using-directives.  Use using-declarations instead.  [build/namespaces] [5]
1-threshold-segmentation-dvorotnev\main.cpp:7:  { should almost always be at the end of the previous line  [whitespace/braces] [4]
1-threshold-segmentation-dvorotnev\main.cpp:22:  { should almost always be at the end of the previous line  [whitespace/braces] [4]
1-threshold-segmentation-dvorotnev\main.cpp:31:  { should almost always be at the end of the previous line  [whitespace/braces] [4]
1-threshold-segmentation-dvorotnev\main.cpp:68:  Missing space after ,  [whitespace/comma] [3]
Done processing 1-threshold-segmentation-dvorotnev\main.cpp
Total errors found: 7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant