Image Processing

Image Processing involves getting image input from a camera and applying operations on it to get desired results. Most image processing applications we do involve OpenCV with C++.

Learning OpenCV

One can go about learning opencv from the official tutorials available on their site.

Suggested process of installation for linux is to obtain it from official repositories or If you want to compile the latest version

Run the command corresponding to your OS in the terminal

Suggested Order is :

  1. Followed by all tutorials from Image Processing Module

A good way to test image processing is to apply it to camera output rather than still images. The following snippet gives camera output in a Mat object called img

camera.cpp
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char **argv) {
  VideoCapture cam(0);
  Mat img;
  while(true) {
    cam >> img;
 
    // Do Your Operations Here
 
    imshow("Image",img);
    int c = waitKey(5);
 
    // Quit on pressing q
    if( c == 'q' || c == 'Q')
      break;
  }
  return 0;
}

For Linux Only

And this is the corresponding CMakeLists.txt

CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(image_processing)  # Any Name you wish without spaces
find_package(OpenCV)  # This project requires OpenCV
add_executable(output camera.cpp)  # Where output is the name of the compiled executable
target_link_libraries(output ${OpenCV_LIBS})

Keep the above two files in a single folder and execute the following statements in that folder from a terminal prompt to obtain an executable :

$ mkdir build
$ cd build
$ cmake ..
$ make

Now, an executable will be created in the build folder as per the name set in your CMakeLists.txt