Image Processing

Following are my IP codes written in C++ using OpenCV…for my IP Lab. They are working. some of them may not be as efficient as they should be.
Also we needed to go for the ‘C++’ codes from scratch. So i have not used any OpenCV library functions except for Displaying, Saving & Loading images.

Click here to get the codes.

Exp1. Reading and Display an image
Exp2. Spatial Filters
Exp3. Image Enhancement
Exp4. Image Segmentation
Exp5. Image Transforms -1
Image Transforms(pure DFT) -2
Exp6. Image Rotation (using DFT) //Avoids use of Interpolation
Exp7. Morphological Operations
Exp8. Image Restoration by Inverse filtering
Image Restoration by Iterative Method
Exp9. Image Restoration using Weiner Filter
Exp10. Stereo Imaging – Calculating Depth information from two Stereo images

29 responses to “Image Processing

    • Good rank. In my time admission to VLSI and VIPES in IITKGP was closed around AIR250 for open category. So you can try in other IITs like IIT-R, IIT-G or the newer IITs. You can also look at the top few NITs if you want VLSI only.
      All the best!

  1. hey abhisek……i am final year student , working on project to optimize traffic signal delays using vehicle density…………..can u suggest me steps or code if possible for counting number of vehicles(cars) in an image

    • Hi Nikunj, you need to first work on the basics of image processing and understand existing patter recognition algorithms. Let me tell you there are many and which one will be best suitable in your case is what i also don’t know. After that you’ll have to make the logic for switching signals based on your collected data to optimize the traffic handling all scenarios.

  2. hi i am working on opencv in ubuntu 12.04.
    i am getting an error wen the cpp file is compiled that cv.h is not found.
    i checked the file. it is present in /usr/local/include/opencv.
    but still i am getting an error.
    should i place the files in other location?
    can u please suggest a solution?


    • Hi Shiksha,
      You can check the build log of ur application. It should have one compiler option as “-I/usr/local/include/opencv”. If it is not there, it means u will have to add it in ur compiler options in makefile.

    • thanks for the reply..
      could u please tell me how to access the log file.
      and i am getting another error : cvLoadImage was not declared in this scope..
      could you please help me.
      i am very new to programming…


    • okay.
      when i create a cmake file it works fine but when i try to create an executable i am getting the following error:
      in function ‘int main(int, char**)’:
      error:’CV_WINDOW_AUTOSIZE’ was not declared in this scope
      make[2] error 1

      my program is


      using namespace cv;

      int main(int argc, char** argv)
      Mat image;
      if( argc != 2 || !
      printf(“no image data \n”);

      namedWindow(“Display Image”, CV_WINDOW_AUTOSIZE );
      imshow(“Display Image”, image);


      return 0;


    • hey i got the code compiled..
      no errors..
      but wen i run the file i am getting an error that no image data even though the whole path is specified..
      y is the error occuring?
      how can it b corrected?

    • Check for spaces in path. If u r using Linux, add \ before space. Also use forward slash in path… Parent-folder/child-folder/img.jpg

    • hi,
      the image is being displayed when i placed them in the same directory as the file.
      i was trying to play a video file using opencv program. but i am getting an error wen its executed: Segmentation fault (core dumped).

      the program is :

      using namespace cv;
      using namespace std;

      int main(int argc, char** argv)
      string filename=”cuda-workspace/DisplayVideo/video_1.avi);
      VideoCapture capture(filename);
      Mat frame;

      if( !capture.isopened())
      throw “Error when reading stream.avi”;

      namedWindow( “w” , 1);
      for( ; šŸ˜‰
      capture >>frame;
      imshow( “w”, frame);
      waitKey( 20);

    • is there any error in code?
      please specify if any corrections…
      thanks in advance…


    • Hi Shikha, I have been out of touch with OpenCV since a long time (like almost 2 yrs now). I can’t help you on this issue. May be someone in the post followers can. Sorry.
      Till then you can just google to get a proper working code.

  3. Hey!
    I want to do serial communication between my microcontroller and visual studio.
    Do you have any idea about it?
    I am unable to find any serial header file for the same.

    • Opencv is C++ based library. Hence its execution is very fast as compared to matlab. U can integrate opencv in ur real time embedded systems.
      Matlab is good for quick testing & simulation, not for realtime apps.

  4. Hi Abhishek,
    I saw your image restoration’s code. Procedure seems fine. But output image is looking more blurred than original one. So could you please elaborate on this ? Also for finding DBF you have considered degraded sub-image and estimated sub-image . So if I want to apply this method to any general image then how to get these two sub-images ?

  5. Hi Abhishek,
    I am starting my work on CV soon. Your codes & report are a great starter. Wanna point out though that Morphological Operators folder contains report and presentation on Rotation via DFT. Please take care of that.

  6. I am not able to download the files. Most likely the file hosting service you were using expired the files.
    Can you please re-post them Or e-mail them to me.

What do you think??

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s