go away spammer

Author Topic: Line Following Using Vision Sensors  (Read 17603 times)

0 Members and 1 Guest are viewing this topic.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Line Following Using Vision Sensors
« Reply #30 on: March 15, 2009, 07:56:08 PM »
I released it early. Code is finally up!

Here it is :
http://www.societyofrobots.com/member_tutorials/node/321
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Line Following Using Vision Sensors
« Reply #31 on: March 16, 2009, 10:59:22 AM »
although i personally thinkcmucam is wate of money but its v gud for the beginners in image processing...basiclly but if u put a little effort u can do more than wat cmucam can do wth opencv and a smal webcam...which is way cheaper but yes alittle diffcult to implement ...

this is my opencv program for red blob colour tracking...it really helpps...instead of moving the servo here i use the parallel port to control some led's which light up when u move the blog to the left and switches off when u move the blob to te right...

Code: [Select]
// cvdemo3.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include"cv.h"
#include"highgui.h"
#include"cvaux.h"
# include"stdlib.h"

short _stdcall Inp32(short PortAddress);
void _stdcall Out32(short PortAddress, short data);


//grey screen+cvLoadImage
int _tmain(int argc, _TCHAR* argv[])
{

/*
const char *c="image001";
IplImage *hw=cvLoadImage( "image001.jpg" );
*/
static CvMemStorage* storage = 0;
//capturing from cam
CvCapture* capture=cvCaptureFromCAM(0);
cvWaitKey(0);
//tsting if frame was captured or not
if(!cvGrabFrame(capture))
{printf("could not capture");
_sleep(2000);
exit(0);
}
printf("captured\n");
storage = cvCreateMemStorage(0);


//cvMoveWindow("Hello World", 186, 56);


while(1)
{
//capturing frame
cvNamedWindow("Hello World",  CV_WINDOW_AUTOSIZE);
    IplImage *hw=0;
    hw=cvQueryFrame(capture);
double y=cvGetCaptureProperty(capture,5);

int height1=hw->height;
int width1=hw->width;
//cvClearMemStorage(storage);
CvScalar s;
for(int i=0;i<height1;i++)
{
for(int j=0;j<width1;j++)
{
s=cvGet2D(hw,i,j);
if(s.val[0]>=140 && s.val[1]>=140 && s.val[2]>=140)
s.val[2]=0;
s.val[0]=0;
s.val[1]=0;
//video loop
if(s.val[2]<120)
s.val[2]=0;
else
s.val[2]=255;
cvSet2D(hw,i,j,s);
}
}
float xcounter,ycounter,xpixel,ypixel;
xpixel=0;
ypixel=0;
    xcounter=0;
ycounter=0;
//finding centre of gravity...
for(float i=0;i<height1;i++)
{
for(float j=0;j<width1;j++)
{
s=cvGet2D(hw,i,j);
if(s.val[2]>120)
{
xcounter++;
ycounter++;
xpixel+=j;
ypixel+=i;
}
}
}

   
printf("height=%d,width=%d centre of gravity x=%f,y=%f,FPS=%e\n,",height1,width1,xpixel/xcounter,ypixel/ycounter,y);

  if(xpixel/xcounter<178)
  {
Out32(0x378,255);
  }
  else
  Out32(0x378,0);
//display the image in the container
   cvCircle(hw, cvPoint(xpixel/xcounter,ypixel/ycounter), 10, cvScalar(0,255,0), 1);

cvShowImage("Hello World", hw);

int c=cvWaitKey(10);
if((char)c==27)
break;
//cvReleaseImage(&hw);
}

cvDestroyWindow("Hello World");
cvReleaseCapture(&capture);

/*//declare for the height and width of the image
int height = 620;int width = 440;
//specify the point to place the text
CvPoint pt = cvPoint( height/4, width/2 );
//Create an 8 bit, 3 plane image
IplImage* hw = cvCreateImage(cvSize(height, width), 8, 3);
//Clearing the Image
cvSet(hw,cvScalar(0,0,0));
//initialize the font
CvFont font;
cvInitFont( &font, CV_FONT_HERSHEY_COMPLEX,1.0, 1.0, 0, 1, CV_AA);
//place the text on the image using the font
cvPutText(hw, "Welcome To OpenCV", pt, &font, CV_RGB(150, 0, 150) );
//create the window container
cvNamedWindow("Hello World", 0);
//display the image in the container
cvShowImage("Hello World", hw);
//hold the output windows
cvWaitKey(0);
return 0;*/


}

JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
    • Current projects
Re: Line Following Using Vision Sensors
« Reply #32 on: March 16, 2009, 01:33:56 PM »
although i personally thinkcmucam is wate of money but its v gud for the beginners in image processing...basiclly but if u put a little effort u can do more than wat cmucam can do wth opencv and a smal webcam...which is way cheaper but yes alittle diffcult to implement ...

With your solution you need a PC to run the OpenCV code. CMUCam is completely independent. If you want an autonomous solution, you will need a powerful processor to process the video, and will end up with something similar to the CMU Cam. And more expensive.

BTW, I find your way of writing quite difficult to understand. Remember that some of us are not native English speakers (like myself). Typos every two words and non existing punctuation makes it really painful to read. Please, make an effort ;)

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Line Following Using Vision Sensors
« Reply #33 on: March 16, 2009, 01:48:14 PM »
sorry for that ....actually i type very fast and my keyboard is little faulty so sum keys have to be pressed hard to register...ill keep that in mind...actually wat u ssaid is right..see..u got to have sum creativity..cmu cam gives images to mcu which processes it...the processing speed will be very low as compared to pc and also the response time will bcome high for more complex functions...


what i do is i do the processing in my pc and send serial commands or parallel commands via wireless to mcu...whose jobis jst to read these commands and control the motors which leads to a much faster processing and response than cmu cam...

in my view i save a lot of money and also can gain a lot of knowledge by using opencv as i implement sum higher and more complex algorithms like fae recognition...blob tracking...etc etc etc which in any mcu will take much much time to process...so i alwayz opt for the pc to process any kinda image processing elements...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
    • Current projects
Re: Line Following Using Vision Sensors
« Reply #34 on: March 16, 2009, 02:18:19 PM »
what i do is i do the processing in my pc and send serial commands or parallel commands via wireless to mcu...whose jobis jst to read these commands and control the motors which leads to a much faster processing and response than cmu cam...

in my view i save a lot of money and also can gain a lot of knowledge by using opencv as i implement sum higher and more complex algorithms like fae recognition...blob tracking...etc etc etc which in any mcu will take much much time to process...so i alwayz opt for the pc to process any kinda image processing elements...

Yep, but sometimes this solution is not possible. For instance I your robot has to be completely autonomous (in a competition this is often the case), your solution is not applicable. Saying that CMUCam is a complete waste of money is unfair in my opinion. And by the way, you can learn a lot by using CMUCam, remember that the embedded processor is programmable.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Line Following Using Vision Sensors
« Reply #35 on: March 16, 2009, 02:29:54 PM »
agreed...but ... processing algos like face detection....motion tracking....is an overkill for any microcontroller...so its better if they are not done in it...

and i guess if u use computers then the robot remains autonomous...coz only the program is running and nothing else and remember the mcu is noting but a processor at heart and our computer is the same too...tll date i havent seen any competitions who have denied that u cant use a computer for image processing on ur robot....unless offcourse started by some dumb ppl...

JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
    • RazorConcepts
Re: Line Following Using Vision Sensors
« Reply #36 on: March 16, 2009, 02:51:36 PM »
But it's hard to build your robot around a laptop.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Line Following Using Vision Sensors
« Reply #37 on: March 16, 2009, 02:56:31 PM »
thats why i said use wireless....and also its not that hard ...jst make a flat base and keep the lappy on it...that it...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
    • Current projects
Re: Line Following Using Vision Sensors
« Reply #38 on: March 16, 2009, 03:18:39 PM »
agreed...but ... processing algos like face detection....motion tracking....is an overkill for any microcontroller...so its better if they are not done in it...

and i guess if u use computers then the robot remains autonomous...coz only the program is running and nothing else and remember the mcu is noting but a processor at heart and our computer is the same too...tll date i havent seen any competitions who have denied that u cant use a computer for image processing on ur robot....unless offcourse started by some dumb ppl...

I am not very familiar with robot competition, but from what I have seen, a lot of them specifically forbid radio communication.

for instance: http://www.eurobot.org/eng/rules.php
http://groups.google.com/group/iaroc/web/rules?hl=en&pli=1

The purpose of any competition like that is to stimulate the creativity and ingenuity of contestants. By imposing certain limitations they force people to find original solutions. I don't see why this is dumb.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Line Following Using Vision Sensors
« Reply #39 on: March 17, 2009, 10:42:41 AM »
lol and wats not original in not using the laptop for doing image processing ...if they ban rf then use bluetooth ..there are no limitations..i still think processing images on the computer is a way better choice than unecessarily wasting money on the cmu cam...but then its still my own perspective..urs will dffer..
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Line Following Using Vision Sensors
« Reply #40 on: March 17, 2009, 10:51:10 AM »
lol and wats not original in not using the laptop for doing image processing ...if they ban rf then use bluetooth ..there are no limitations..i still think processing images on the computer is a way better choice than unecessarily wasting money on the cmu cam...but then its still my own perspective..urs will dffer..
bluetooth is a form RF
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

paulstreats

  • Guest
Re: Line Following Using Vision Sensors
« Reply #41 on: March 17, 2009, 11:04:07 AM »
The compromise would be to use a higher end microcontroller like a fast arm9 with sram extensions. You can use a cmucam with it plus its fast enough to do other image processing. (many of them can run embedded linux distro's too letting you run existing image processing tools over the top).

look at something like this: http://www.tincantools.com/product.php?productid=16133&cat=0&page=1&featured  a 200mhz microcontroller with 16mb memory that fits into a standard 40 pin dip socket. Image processing is perfectly possible on it, maybe not in superhigh resolutions but enough to get by with.

Quote
agreed...but ... processing algos like face detection....motion tracking....is an overkill for any microcontroller...so its better if they are not done in it...

It'll never happen unless somebody tries...

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Line Following Using Vision Sensors
« Reply #42 on: March 17, 2009, 11:38:37 AM »
lets face it...for any normal competition ...there is no need in spending so much money for  a 200mhz mcu...thats what iam exactly saying doing it on a laptop and communication via wireles is a much cheaper and more permanent solutio ...let the algo be anything
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
    • Current projects
Re: Line Following Using Vision Sensors
« Reply #43 on: March 17, 2009, 01:41:09 PM »
lets face it...for any normal competition ...there is no need in spending so much money for  a 200mhz mcu...thats what iam exactly saying doing it on a laptop and communication via wireles is a much cheaper and more permanent solutio ...let the algo be anything

What is a "normal competition"?

Why is it so hard for you to understand that limitations are what makes a competition interesting and fun! Trying to work around the rules to use a laptop for video precessing is not a solution. If you don't like the rules, don't participate in this competition ;) But that doesn't make the competition stupid or you solution better. Most competition impose rules to make the competition interesting. And I'm not only talking about robotic. Take the Formula 1 Championship for instance: they have very strict rules about the weight, the dimension of the car, the engine... even telemetry is regulated. This is to keep the competition balanced and interesting. Same in robotic competition. So YES there is a need for completely embedded image processing solution. Your solution is cheaper, but this is not a universal solution and in some case not practical.

Chelmi

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Line Following Using Vision Sensors
« Reply #44 on: March 17, 2009, 01:53:30 PM »
lol ...not practical...i can gurantee that i can do more things with the laptp and a webcam than any other cmucam or watever cam can do...and wat kinda limitations are u talking abt...i havent seen any competition which puts such a kinda limitation where u cant use any laptops for image processing.....huh...it would be illogical...

even i love challenges...but i need fast processing and instantaneous response...tell  me which mcu can do it better than a processor which runs at 2 ghz with 2gb of ddr3 ram .... look at the possibilities ..i can implement more cmplex algos,more better image processing modules and can still expect to get much faster processing.. these modules are required if u want ur robot to be bang on target...i dont want to sacrifice the accuracy and efficiency of my robot for any kinda self processing camera...


and why the hell are we fighting...i love this way of mage processing and u love urs...its our different perspective...no need to fight over it..
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
    • Current projects
Re: Line Following Using Vision Sensors
« Reply #45 on: March 17, 2009, 02:05:49 PM »
lol ...not practical...i can gurantee that i can do more things with the laptp and a webcam than any other cmucam or watever cam can do...and wat kinda limitations are u talking abt...i havent seen any competition which puts such a kinda limitation where u cant use any laptops for image processing.....huh...it would be illogical...

even i love challenges...but i need fast processing and instantaneous response...tell  me which mcu can do it better than a processor which runs at 2 ghz with 2gb of ddr3 ram .... look at the possibilities ..i can implement more cmplex algos,more better image processing modules and can still expect to get much faster processing.. these modules are required if u want ur robot to be bang on target...i dont want to sacrifice the accuracy and efficiency of my robot for any kinda self processing camera...


and why the hell are we fighting...i love this way of mage processing and u love urs...its our different perspective...no need to fight over it..

ok ok, we not fighting, it's an argument ;) some competitions impose limitation on weight and dimensions. If you're laptop doesn't fit, then it's not a practical solution, period.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Line Following Using Vision Sensors
« Reply #46 on: March 17, 2009, 02:25:33 PM »
but never in imge processing..ppl know all cannot buy the 200$ cmu cam...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Line Following Using Vision Sensors
« Reply #47 on: March 17, 2009, 04:33:26 PM »
People you are hijacking this thread!

My outlook on it
When you want it all embedded you can use a CMUcam
when you have the luxury of having a laptop always near the robot , then use the wireless method
Please make a new thread to continue the conversation . :P
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

paulstreats

  • Guest
Re: Line Following Using Vision Sensors
« Reply #48 on: March 17, 2009, 06:43:41 PM »
Quote
People you are hijacking this thread!

My outlook on it
When you want it all embedded you can use a CMUcam
when you have the luxury of having a laptop always near the robot , then use the wireless method
Please make a new thread to continue the conversation .

Aaaaaw. Just 1 more post pleeeeeez.....

Quote
ok ok, we not fighting, it's an argument

its not even an argument, its a perfectly sound debate where both parties have good points to make.

My personal opinion is we should aim for embedded designs, whats the point of a robot that needs an external laptop (a robot should be able to function without external help in my own opinion. I know its not other peoples but there we go).

Also with the cost. Does a cmucam + 200mhz microcontroller board cost more than a webcam and laptop? you are assuming that we already have a laptop to use, if not then we would have to buy one probably making the overall cost higher than the embedded solution.
Also the part about being bang on target is subject to the resolution of the camera used before you even consider the rest of the hardware. I have plain camera modules, not webcams or cmucams but the plain camera ic's so Im not siding with either the webcam/cmucam.

The 2 subjects of the debate are also beneficial as a whole. The computer assisted side allows better image processing techniques to be developed(creating better image processing) but faces a robot either being encumbered with a full computer or having to stay in range of a wireless link whereas the embedded side is playing catchup, the techniques will always be a few years behind but you have a more agile robot.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Line Following Using Vision Sensors
« Reply #49 on: March 18, 2009, 10:05:29 AM »
see we have to look at all aspects who doesnt have a laptop nowadays...investing on an laptop is much better than investin on cmucam or 200 mhz mcu...i think its a complete waste...

butthen again its my perspective...a laptop is nothing but an mcu with already extra peripherals attached...so no worries...

sorry for that airman...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

 


Get Your Ad Here