Open Computer Vision

May 25, 2009

Project Suggestions

Filed under: OpenCV — Abhijeet @ 4:56 am

This site has moved to



  1. nice article. keep it up 🙂

    Comment by jeyram — May 25, 2009 @ 5:12 am | Reply

  2. Hi, I would want to suggest a explanation of how to get a mean and a median of various images or frames of a video and maybe a post of how to access the pixels of the image. It would be a great post of image processing and a great help!


    Comment by Enric — June 2, 2009 @ 2:06 pm | Reply

    • Dear friend,

      I have been explaining this topic from some time now..Accessing the pixels in OpenCV is just a breeze after one learns to browse my site.There are various posts which explain how to access a pixel.Please take your time and browse and after you get to know how to access a pixel to find the mean and the median would be a cake walk….

      Comment by colouredpages — June 4, 2009 @ 4:22 pm | Reply

    • you may please mail me the same..I am so sorry for the late reply…I would place your name as a contributor…
      It would be of a great help to many people…..

      Comment by colouredpages — June 13, 2009 @ 7:10 am | Reply

  3. This blog is a great resource for beginners as I am.
    I suggest tutorials for understand other color spaces useful in
    color-based segmentation , for example LAB space.

    best regards

    Comment by yo — July 17, 2009 @ 8:39 am | Reply

    • Other color spaces are nothing but once again array of numbers or numbers to be short…the difference lies only in the way they are interpreted or used…..that’s is all….Thank you for all the compliments…

      Comment by colouredpages — July 20, 2009 @ 7:02 pm | Reply

  4. I’m trying to do simple object detection with histogram matching… the book learning open cv is not that easy for beginners, could you explain histogram matching methods in a post or give me some giudelines?

    thank you very much

    Comment by yo — July 21, 2009 @ 1:31 pm | Reply

    • “”Simple” Object detection” could you please describe that with a snapshot or something…what is the scene in which you have to detect the object..? it all depends…there are various methods available to detect the objects…

      Comment by colouredpages — July 22, 2009 @ 12:22 pm | Reply

      • I would like to build an histogram of a sub region of an image (parking places), to recognize if there is or not a car in a parking space. The aim is to distinguish between ground (gray) and car.
        My images are similar to this one

        thanks for reply

        Comment by yo — July 24, 2009 @ 10:02 am

  5. what you can do is “make an xml file” with the help of haar training and then you would be able to detect cars …if a car is there in a frame it would for sure be detected ..Now whereever you have those white lines make sure that your car’s coords do not fall on st line between the two lines or to keep it simple if you have the center of the car(you would easily get that with haar training) just find out if that pixel is in middle of any 2 white lines…

    Comment by colouredpages — July 24, 2009 @ 5:50 pm | Reply

    • Please tell me…no matter whatever you think….!

      Comment by colouredpages — July 28, 2009 @ 12:49 pm | Reply

      • ok … sorry for late reply

        following you suggestion I read this document
        but I’m a beginner and I don’t know where to start from.

        I have three little questions:

        Can Haar training be a good solution for detection of cars
        oriented in different sides (as in the figure above)?

        How fast will be the detection of 50 cars (for example) after training?

        you think histogram approach can be useful or not? if yes could you give me some giudelines
        on how to deal with histogram matching?

        thank for reply, best regards

        Comment by yo — August 4, 2009 @ 1:06 pm

      • Basicaally..Let me tel you everything….Just follow the document you would find about the haartraining in your installation folder…that is the best guide and that is why i did not put a tutorial on it…I have seen people spending weeks on this…you need to collect many positive and negative images first(you would understand what is this after you read that document)…after you start the making of the xml file i have seen people’s computers “on” for many weeks to get that xml file donw and if you are lucky enough you would get it in a week…but according to me you would need to collect many images….and you would be able to detect cars…

        But i am thinking about a fairly simple approach…If the camera is not going to move then compare the places where car should be there with the ground …if there is ground then there is no car…and if there is no ground then there is a car…SO identify the pixel locations where you are expecting a car and comparre with the real ground ..if you have a ground fine else you have a car..!!…but make sure that there are no false alarms…which means even if a person walks which comes in thosse pixel locations it would say that there is a acr(There is no grounnd)….

        Comment by colouredpages — August 5, 2009 @ 9:53 pm

  6. Good job buddy.Keep up the good work

    Comment by Appurv — July 31, 2009 @ 5:23 pm | Reply

  7. Hi,
    I want know how one can move a mouse pointer using color marker detection using OpenCV. Also would like to extend this to click on the screen using some color coding.
    Thank you in advance…

    Comment by Onkar — August 14, 2009 @ 11:19 am | Reply

    • Sorry for being late: cvSetMouseCallback is the answer for your question..well you need to prepare a function and assign a callback …

      you would get the documentation in the highgui in the help file which we get with the Opencv.. acc to me once you get the coordinates of the mouse pointer on the screen ..then drawing the line would be just assigning that coordinates pixels to a fixed RGB predecided number…when yo get the coordinated just change the RGB pixel values …would look like a curve then…!!

      Comment by colouredpages — August 19, 2009 @ 1:45 am | Reply

  8. dear colouredpages,
    now you are teling me to compare the car with the ground.. but this was the approach that I had the intention to use (in my post of 24 july) before you told me about ‘make an xml file’ (in your reply).

    probably I don’t explained clearly the problem.

    You think build an histogram of a sub region of an image (parking places), to recognize if there is or not a car in a parking space, is better than compare just pixel values?
    I read that histograms can be used also to recognize patterns.

    where have I to start from?
    thank you very much

    Comment by yo — August 18, 2009 @ 3:36 pm | Reply

    • Hello ,

      Even i was pondering about the same for some time …but i got the idea when you said that the camera is not going to change its position….

      Let me tell you that histograms are also nothing but just show how many pixel values have a certain range of numbers or a particular number..but if you feel comfortable thinking this way…yes you are right….

      The reason i suggested you use haartraining is that you would be able to detect cars with a high degree of surity…so when you detect a car you can exactly tell that at this point there is a car…but when your computer would take some a week or probably more to make an xml file and then you would require many sample images…

      I remember dave grossman telling me that haartrainnig is a great tool and morover it would detet the cars even if the camera is moved…Sooo it is your choice…

      according to me you can also do template matching….the place where a car should be is your sample so if you have the car at that place the template would not match…!!

      you can do the pattern matching also yes…!

      You do not have an exact solution for anything..we can just make sure that it matches the maximum..!!

      Comment by colouredpages — August 19, 2009 @ 1:54 am | Reply

  9. I want to build project that can detect a car and determine its speed.can i?

    I can get time by getting video no. of frames.

    How can i get distance?

    Comment by Tarek — December 3, 2009 @ 7:56 pm | Reply

    • Could you please tel me the scene where you are going to make the program on….there is a video on which makes use of moving pixels and keeps it the same …meaning if the pixel is moving then it is kept in the resulting frame else it is zeroed out….. hence you can find out if the car is moving at what speed…but this is not applicable if your camera is also moving…because the environment is also changing….depending upon the frame rate and depending upon subsequent the number of frames you are comparing you can decide which speed to take account of .

      but i would still ask you to mention which environment do you need to make the application…!!!

      Comment by colouredpages — December 5, 2009 @ 5:46 pm | Reply

  10. hi..
    can anyone teach how do i shift a image pixel to left side? i know how to access the image pixel by this code. For every pixel to either shift left or right, i’ve wrote e formular. its just that the shifting isnt working…=(
    for( int y=0; yheight; y++ )
    uchar* ptr = (uchar*) (image->imageData + y * image->widthStep);
    uchar* ptr2 = (uchar*) (image_shift->imageData + y * image_shift->widthStep);

    for( int x=0; xwidth; x++)

    i have a formular for e amount of shift also -> z= maxShift * depthValue/255.0;

    Does anyone knows how to solve this?
    many thanks..

    Comment by dception — December 8, 2009 @ 7:45 am | Reply

    • Dude whatever operation you do on the image pixels ,….make sure that you store the values in a new image…i mean new iplimage…ok…? and by the way…what are you trying to implement…..?

      Comment by colouredpages — December 8, 2009 @ 11:50 pm | Reply

  11. hi..

    thanks for replying..
    I’m very new to opencv. I’ve stored the values in a new iplimage, i’m trying to shift every image pixel to right or left side by implementing the formular. For example if my Maxshift=4 n depthvalue of the pic is 128 den the shift will be 2. i’m trying to create a right shift image. Photoshop call it displacement. I’m sure opencv can just that i do not know the command line for every pixel to shift right by 1/ any value given..

    Comment by dception — December 9, 2009 @ 12:58 am | Reply

  12. Hi,

    I read your article on “Color Detection by using Color space basics”. It was very useful and thank you for posting this.

    As you know in colour tracking environment plays an important part. We set upper and lower boundaries for a particular colour but we might still fail to detect the colour under certain conditions.

    It would be great if you have any suggestions on how to change the colour thresholds in real time. (or maybe for the user of the tracking system to visually pick the colour values before running the tracker?) I’ve been trying to search if anybody has done this kind of thing on the internet but failed to find anything so far.

    Comment by h — December 12, 2009 @ 10:47 pm | Reply

    • Hello,

      You have come to a very good conclusion…Well i have progressed in this front but just academically, not pragmatically. I have thought of detecting blobs and maintain a count of number of hits in that blob pertaining to the detection but I have not come up with a program. The number of hits should be the highest in that blob and should also not be false. I am thinking of combining template detection and color detection to achieve better results. I am hoping that i come upwith some programs in the month of feb. Till then I am real busy…but you may implement the same.I wil help you.

      Thanks, Abhijeet.

      Comment by colouredpages — December 14, 2009 @ 5:18 am | Reply

  13. hi,
    well let me thank you for the great site, it’s really helpful buddy.

    I’m a beginner of openCV, and I’m trying to build a robot which can detect and follow a black line in white background. in some cases there will be colored lines too (Red or Green or Blue). and in some other cases i should be able to detect objects like Fire. So i’m going to use a simple camera on my robot.

    well, i just started learning some Functions (e.g : cvCanny for edge detection)
    but don’t know whether i’m going through a right path or not! CONFUSED! HELP ME PLZ!

    thanks in advance…

    Comment by zaeemi — July 26, 2010 @ 7:55 pm | Reply

    • Dear,
      I do not think that there is much to do about edge detection here….you said about a white line in a dark background…see white line always has R,G,B all of them in almost equal strength like 250,249,252….so try to use the conversion which is present on my website and then you will have a white line… you can detect red from one of the programs on my website….try to do the green and yellow yourself….please attach a sample picture..!

      Comment by colouredpages — July 27, 2010 @ 4:10 am | Reply

  14. i need to detect the direction of motion. i.e. in a one way road if a vehicle is coming from opposite direction i need to check that.. can u please help me?? am completely new to opencv.

    thanx in advance

    Comment by ambalika saha — October 23, 2011 @ 7:55 am | Reply

  15. can you please write a opencv code for recognizing a pen drive.???i am having problem in doin it..

    Comment by PUNITH SHETTY — March 4, 2012 @ 4:48 am | Reply

  16. Hi ur blog is pretty informative
    I am trying to develop a 3*3 rubiks cube solver using opencv.In each face there will be nine facelets
    The steps are
    Step1:Take image of each face(thats easy)
    Step2:Locating the cube face on image taken
    Step3:Using Hough transform for fixing the image and accessing each shell.Ya ,this is the step I am stucked in..after dividing the area of intrest into nine shells I want to perform some lopping and find colour of each shell and store the information into some array.Can u plz help me to detect colour of each shell.
    I will highly appreciate ur help and thanks in advance

    Comment by govinda — October 7, 2012 @ 6:14 pm | Reply

    • I have left this feild for some time now sorry for the inconvinience

      Comment by colouredpages — October 10, 2012 @ 8:50 am | Reply

  17. hi ,
    pls suggest me some function in opencv for detecting a human/vehicle based on edge in traffic video

    Comment by menaka — October 11, 2012 @ 10:34 am | Reply

    • As far as i know after leaving the field its been three years now.OpenCV is a platform for you to make some thing. you will not get direct detection. However you might want to check HAARTRAINING. I think this is what you are looking for..! Best of Luck.

      Comment by Abhijeet — December 17, 2013 @ 11:09 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

Blog at

%d bloggers like this: