Go to Post don't be grumpy. No one is allowed to be grumpy during build. - JaneYoung [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-01-2009, 16:28
ellisk ellisk is offline
Registered User
FRC #1540
 
Join Date: Dec 2008
Location: Vancouver, WA
Posts: 41
ellisk is on a distinguished road
Finding green/pink flags

Hi everyone,

I am trying to use the Axis Camera to locate green and pink flags. However, it fails when actually finding the colors. Here's the relevant portion of my code so far:

Code:
		int i = StartCameraTask();
		StartImageAcquisition();
		
		
		while (IsOperatorControl())
		{
			double timestamp;
			Image *img = frcCreateImage(IMAQ_IMAGE_HSL);
			int getImage = GetImage(img,&timestamp);
			
			TrackingThreshold tdata = GetTrackingData(GREEN, PASSIVE_LIGHT);
			ParticleAnalysisReport par;
			
			int findcolor = FindColor(IMAQ_HSL, &tdata.hue, &tdata.saturation,&tdata.luminance, &par);
			
		}
		
		StopImageAcquisition();
		StopCameraTask();
I find the values of par, tdata, getImage, and findcolor using the debugger. It succeeds up to the call to FindColor. I am using the stock green flag. I've tried positioning it differently in front of the camera, but it still doesn't recognize it!

I've tried it with PINK as well with the pink flag, and I've tried changing PASSIVE_LIGHT to FLORESCENT (neither work).

Has anyone had any success with getting the camera to recognize the flags/know what I'm doing wrong?

Thanks,
Kevin
Reply With Quote
  #2   Spotlight this post!  
Unread 04-01-2009, 21:22
nickmagus's Avatar
nickmagus nickmagus is offline
Registered User
AKA: Nick Clayton
FRC #0008 (Paly Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Palo Alto, Califorinia
Posts: 56
nickmagus is an unknown quantity at this point
Send a message via AIM to nickmagus
Re: Finding green/pink flags

I have had the same problem. I also tried.
Code:
if (StartCameraTask(10, 0, k160x120, ROT_0) == -1){
	printf("Failed to spawn camera task: %s\n",GetVisionErrorText(GetLastVisionError()));
}

// Set up camera tracking parameters.
tdata = GetTrackingData(GREEN, PASSIVE_LIGHT);
tdata.hue.minValue = 67;
tdata.hue.maxValue = 114;
tdata.saturation.minValue = 161;
tdata.saturation.maxValue = 255;
tdata.luminance.minValue = 24;
tdata.luminance.maxValue = 101;
in the init with
Code:
ParticleAnalysisReport par;
if (FindColor(IMAQ_HSL, &tdata.hue, &tdata.saturation, &tdata.luminance, &par)
		&& par.particleToImagePercent < MAX_PARTICLE_TO_IMAGE_PERCENT
		&& par.particleToImagePercent > MIN_PARTICLE_TO_IMAGE_PERCENT) {
	int lightX = (int)(par.center_mass_x_normalized * 1000.0);
	int lightY = (int)(par.center_mass_y_normalized * 1000.0);
	printf("Light found: x: %i y: %i\n", lightX, lightY);
} else {
	if (err)
		printf("Failed to spawn camera task: %s\n", GetVisionErrorText(GetLastVisionError()));
	else
		printf("light not found\n");
}
in the main loop but that didn't work either

Last edited by nickmagus : 04-01-2009 at 21:26.
Reply With Quote
  #3   Spotlight this post!  
Unread 04-01-2009, 21:25
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Finding green/pink flags

Try this,
1. Log into the camera
2. Goto Advanced Settings and set White Balance to Hold
3. Goto Settings and turn down the brightness 20% of what it's set too
4. Goto Live video settings and take a screen shot (Alt + Print Screen)
5. Open MSPaint and Paste in the Picture, save as a JPG
6. Open Labview Vision Assistant, Open the file, and
7. Select Color, then Color Threshold, and then Color Model:HSL
8. Play with the Hue, Sat, Lum levels until most of the target is high lighted red
9. Set the new levels by updating tdata parameters, here is the list, these worked for me. You only need to set the values you changed in Vision Assistant.
//tdata.hue.minValue = 60;
//tdata.hue.maxValue = 80;
//tdata.saturation.minValue = 34;
//tdata.saturation.maxValue = 200;
//tdata.luminance.minValue = 128;
//tdata.luminance.maxValue = 240;


Edit: Also, it's a really good idea to start with the simple tracker demo 100% unmodified. Then you can tell if it's you or the camera values.
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni

Last edited by Kingofl337 : 04-01-2009 at 21:32.
Reply With Quote
  #4   Spotlight this post!  
Unread 05-01-2009, 11:45
fordchrist675's Avatar
fordchrist675 fordchrist675 is offline
"Wilfordito"
AKA: Wilford Jay Harris III
FRC #0675 (Technology High School Robotics)
Team Role: Mentor
 
Join Date: Jun 2007
Rookie Year: 2006
Location: Rohnert Park, California
Posts: 298
fordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to all
Send a message via AIM to fordchrist675 Send a message via MSN to fordchrist675 Send a message via Yahoo to fordchrist675
Re: Finding green/pink flags

My friends and I are trying to get the Axis Camera to find the green/pink flags, but we are having a problem getting the camera to recognize anything and it didn't say it failed to recognize the camera, so what could help make it work?

The camera is just not working all together, but it is connected and on so we are in a jam. any Ideas?
__________________
It's not by how much you win, it's how you win. Respect your enemies, otherwise your no better than them which if you think about it that's true because we are striving for the same thing. To be FIRST

2010 SVR Creativity Award
2010 SVR Regional Finalists
2010 SAC Innovation in Control Award
Reply With Quote
  #5   Spotlight this post!  
Unread 05-01-2009, 12:46
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Finding green/pink flags

Did you run the Camera Configuration Utility? Are you using the orange CAT-5 cable? Are you using the example? Does it work connected to your PC?
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
Reply With Quote
  #6   Spotlight this post!  
Unread 05-01-2009, 14:37
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Finding green/pink flags

There will be example code posted soon that will do the detection of the two color targets. The code will be able to differentiate between the red and blue alliances.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #7   Spotlight this post!  
Unread 05-01-2009, 17:22
fordchrist675's Avatar
fordchrist675 fordchrist675 is offline
"Wilfordito"
AKA: Wilford Jay Harris III
FRC #0675 (Technology High School Robotics)
Team Role: Mentor
 
Join Date: Jun 2007
Rookie Year: 2006
Location: Rohnert Park, California
Posts: 298
fordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to all
Send a message via AIM to fordchrist675 Send a message via MSN to fordchrist675 Send a message via Yahoo to fordchrist675
Re: Finding green/pink flags

Alright thanks very much for the help
__________________
It's not by how much you win, it's how you win. Respect your enemies, otherwise your no better than them which if you think about it that's true because we are striving for the same thing. To be FIRST

2010 SVR Creativity Award
2010 SVR Regional Finalists
2010 SAC Innovation in Control Award
Reply With Quote
  #8   Spotlight this post!  
Unread 05-01-2009, 17:42
fordchrist675's Avatar
fordchrist675 fordchrist675 is offline
"Wilfordito"
AKA: Wilford Jay Harris III
FRC #0675 (Technology High School Robotics)
Team Role: Mentor
 
Join Date: Jun 2007
Rookie Year: 2006
Location: Rohnert Park, California
Posts: 298
fordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to allfordchrist675 is a name known to all
Send a message via AIM to fordchrist675 Send a message via MSN to fordchrist675 Send a message via Yahoo to fordchrist675
Re: Finding green/pink flags

Actually it is still not working we used the CAT-5 and still are getting no feedback.

So the programmer and I are at a loss. also the utility isn't working so any ideas what to do?
__________________
It's not by how much you win, it's how you win. Respect your enemies, otherwise your no better than them which if you think about it that's true because we are striving for the same thing. To be FIRST

2010 SVR Creativity Award
2010 SVR Regional Finalists
2010 SAC Innovation in Control Award
Reply With Quote
  #9   Spotlight this post!  
Unread 05-01-2009, 19:22
DanDon's Avatar
DanDon DanDon is offline
ohhh MY god
AKA: Dan Hoizner
FRC #0375 (The Robotic Plague)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Staten Island, NY
Posts: 1,432
DanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond repute
Send a message via ICQ to DanDon Send a message via AIM to DanDon Send a message via MSN to DanDon
Re: Finding green/pink flags

Hey all-

I'm running WindRiver, and I'm running the SimpleTracker example code. I've used the NI Vision Assistant to get color values for my green vision target, and put those into the WindRiver code.
Code:
        tdata = GetTrackingData(GREEN, FLUORESCENT);
        tdata.luminance.maxValue = 187;
        tdata.luminance.minValue = 103;
        tdata.hue.minValue = 71;
        tdata.hue.maxValue = 98;
        tdata.saturation.minValue = 56;
        tdata.saturation.maxValue = 111;
I'm getting terminal feedback from the CRIO (finally...but that's another story), but the camera is failing to find any blobs matching the numbers that were obtained using the Vision Assistant.

Help, please?
__________________
Reply With Quote
  #10   Spotlight this post!  
Unread 11-01-2009, 16:07
The yellowdart's Avatar
The yellowdart The yellowdart is offline
Registered User
FRC #1506 (Metal Muscle)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Oakland County
Posts: 22
The yellowdart has a little shameless behaviour in the past
Re: Finding green/pink flags

Have you updated all the firmware? Are you using all the most current software?
Reply With Quote
  #11   Spotlight this post!  
Unread 13-01-2009, 16:10
Chris1228 Chris1228 is offline
Registered User
FRC #1228
 
Join Date: Sep 2007
Location: Rahway, NJ
Posts: 22
Chris1228 will become famous soon enough
Re: Finding green/pink flags

can someone help me program the camera to track colors in labview? i can get it to recognize a color but i dont know how to get motors/servos to move when it sees a color
Reply With Quote
  #12   Spotlight this post!  
Unread 05-01-2009, 19:59
nickmagus's Avatar
nickmagus nickmagus is offline
Registered User
AKA: Nick Clayton
FRC #0008 (Paly Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Palo Alto, Califorinia
Posts: 56
nickmagus is an unknown quantity at this point
Send a message via AIM to nickmagus
Re: Finding green/pink flags

the simple tracker demo 100% unmodified did not find anything...
Reply With Quote
  #13   Spotlight this post!  
Unread 05-01-2009, 20:05
David Doerr's Avatar
David Doerr David Doerr is offline
Registered User
FRC #4478 (Materia Oscura)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Milford, Michigan, USA
Posts: 75
David Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud of
Re: Finding green/pink flags

Quote:
Originally Posted by nickmagus View Post
the simple tracker demo 100% unmodified did not find anything...
There are bugs in the current versions of FindColor, GetLargestParticle and InArea. These have been fixed at the beta level and should be published shortly along with the pink-green demo that Brad mentioned above.

Dave D
Reply With Quote
  #14   Spotlight this post!  
Unread 06-01-2009, 11:05
nickmagus's Avatar
nickmagus nickmagus is offline
Registered User
AKA: Nick Clayton
FRC #0008 (Paly Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Palo Alto, Califorinia
Posts: 56
nickmagus is an unknown quantity at this point
Send a message via AIM to nickmagus
Re: Finding green/pink flags

Oh ok that's good to know. Thanks. Any ideas as to when the code with those functions fixed will be posted. I looked through the functions but couldn't find the error (though I didn't spend that much time since you said its already fixed). The sooner its up the better. On that note I just wanna thank all the people who wrote and are writing this library (it makes all our lives much easier).
Reply With Quote
  #15   Spotlight this post!  
Unread 10-01-2009, 12:58
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: Finding green/pink flags

Quote:
Originally Posted by DaveD View Post
There are bugs in the current versions of FindColor, GetLargestParticle and InArea. These have been fixed at the beta level and should be published shortly along with the pink-green demo that Brad mentioned above.

Dave D
(not directly to dave D)
If you're a team that simply can't wait, you can look at GetLargestParticle and FindColor in TrackApi.cpp. Notice that GetLargestParticle never actually returns the largest particle index to the 2nd parameter. The code to return isn't there, and in the 2nd line of the function it actually blows away the pointer value so it becomes impossible to return the largest particle index. Since it's probably not a good idea to go fiddling with the supplied code unless you know what you're doing, I'll leave it as an exercise to the reader to figure out what to do.

Further, in the full-size version of FindColor, its check for success is incorrect. Rather than "if(largestParticleIndex == 0), it seems that it should be if(largestParticleIndex >= 0) in case the largest particle is not the first one.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flags???? cprogrammer Programming 4 25-07-2005 20:21
Flags trdragons204 General Forum 2 23-03-2005 10:29
Concerns regarding the green paneling/green shirts Petey General Forum 127 15-01-2005 10:35
6 Flags Raven_Writer Chit-Chat 12 30-07-2004 23:01
Six Flags? Hermione692 Championship Event 29 29-04-2003 21:12


All times are GMT -5. The time now is 02:41.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi