Society of Robots - Robot Forum

Software => Software => Topic started by: bootstrap on December 02, 2007, 12:16:56 PM

Title: Image processing in C
Post by: bootstrap on December 02, 2007, 12:16:56 PM
Hello
      I am totally new to image processing.Uptill now I used roborealm software to track the object and move the servo with a red colored object.But roborealm is ready made.I want to develop my own red colored object tracking code in C. I have gone through the Computer vision tutorials in this website.The algorithms were great.Now I want to implement them using the webcam in C and do the red colored object tracking and also send signals to the microcontroller through the serial port.

My problem statement is:

1.How to write the code for capturing images real time and do the image processing real time?
2.And i have learnt the code of sending data through the COM port using C.
    In short I want to develop an equivalent of roborealm's red colored object tracking example  in C because my professor says I have done nothing big ..just used already existing modules and nothing great about it.I felt it was good to give a start and roborealm helped me a lot and it opened the window for bigger things.

I saw your video on Blob and then tracking it.It was great.Please help me and let me know how to do this.If you can also give me a sample example code of the red colored object tracking or some real time image processing code like the mid size object tracking using the webcam it will help me in learning image processing in C....Hoping for a positive response. (And I also want to be a member of the programming team of robo realm from India and give my services)....
Title: Re: Image processing in C (to John Palmisano)
Post by: fr4ncium on December 02, 2007, 07:45:14 PM
Your first step should be getting code that will let you interface with your webcam.  Do some searching for sample code that accesses webcams and outputs the image stream in a window.  I'm doing something similar (but in Java) and just getting the infrastructure for capturing images was a lengthy process, although there is plenty of sample code online about interfacing with webcams.
Title: Re: Image processing in C
Post by: bootstrap on December 02, 2007, 09:38:40 PM
People please help..
Title: Re: Image processing in C
Post by: fr4ncium on December 02, 2007, 11:50:37 PM
google results for "using web cam in java, sample code"
http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=C53&q=using+web+cam+in+java%2C+sample+code&btnG=Search

2nd result is this:
http://forum.java.sun.com/thread.jspa?threadID=570463&messageID=9844808
I started my code based off of the code found in the above link

google results for "using webcam in java, sample code"
http://www.google.com/search?q=using+webcam+in+java%2C+sample+code&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

1st result is this:
http://forum.java.sun.com/thread.jspa?threadID=247253&messageID=1816659


Take a look at those sites, do a topic search at those forums and see what you can rummage up.   :)
Title: Re: Image processing in C
Post by: bootstrap on December 03, 2007, 03:01:00 AM
Sorry I dont deal in Java.I deal in C only plz.
Title: Re: Image processing in C
Post by: dunk on December 03, 2007, 03:32:21 AM
hi infibit,
you need a library that allows you to access pixel information from a webcam image.

http://www.google.com/search?q=c+image+processing (http://www.google.com/search?q=c+image+processing)

i personally am using http://cimg.sourceforge.net/ (http://cimg.sourceforge.net/) but there are a few others suitable.

your actual blob selection should be easy enough once you can identify the colour of each pixel.


dunk.
Title: Re: Image processing in C
Post by: bootstrap on December 03, 2007, 08:01:46 AM
ok altast I found an experienced user doing image processing in C and C++ .Please do stay in touch.I am really having a tough time finding out ways to do the image processing in C.Now how do i access the webcam image in CImg
Title: Re: Image processing in C
Post by: bootstrap on December 03, 2007, 08:17:58 AM
Hi dunk.I am using bloodshed dev c ++ .When i compiled the sample program of modifying lena.jpg as given in the website of CImg i got the following error

   [linker error] undefined reference to `SetDIBitsToDevice@48'
     ld returned 1 exit status
I am new to this.Please tell me how to solve this error
Title: Re: Image processing in C
Post by: dunk on December 03, 2007, 10:15:20 AM
Quote
Now how do i access the webcam image in CImg
you take a .jpg image from the webcam and work on that. look at the example code.
CImg works on static images.

i beleive http://www.intel.com/technology/computing/opencv/overview.htm (http://www.intel.com/technology/computing/opencv/overview.htm) has libaries to capture from a webcam directly but i have never felt the need.

as for your bloodshed error, i have no idea. i do not use windows.

dunk.
Title: Re: Image processing in C
Post by: fr4ncium on December 03, 2007, 04:51:59 PM
oops, sorry about that post.  I got an IM after my initial post asking for more info on the Java program, didn't check the username and assumed you were asking for it.  oh well, still useful for forum searches.

Out of curiousity, what webcam are you using?  How do you like it? 
Title: Re: Image processing in C
Post by: bootstrap on December 05, 2007, 03:19:50 AM
fr4ncium i am zebronic eagle eye webcam.I started using opencv to access cam