Go to Post Remember to have fun! That's what the FIRST experience should be for you- a lot of fun while doing a lot of learning. - smurfgirl [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 25-01-2009, 15:28
NinJA999's Avatar
NinJA999 NinJA999 is offline
Chipmunk NinJA
AKA: Nick Aldwin
FRC #0811 (Team 811)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Windham, NH
Posts: 45
NinJA999 will become famous soon enough
Send a message via AIM to NinJA999
Camera Tracking not working?

Hi,

We've been working on getting our camera to work for tracking the colored fabrics. We have tried code from several different threads, the manual, and the two color tracking demo. Our current Autonomous code is this:
Code:
void Autonomous(void)
	{
		Dashboard &dashboard = m_ds->GetDashboardPacker();

		Wait(2.0);
		PCVideoServer pc;
		while(IsAutonomous())
		{
			TrackingThreshold tdata;
			tdata.hue.minValue=220;//229
			tdata.hue.maxValue=255;
			tdata.saturation.minValue=75;//121
			tdata.saturation.maxValue=255;//182
			tdata.luminance.minValue=85;//95
			tdata.luminance.maxValue=255;//141
			ParticleAnalysisReport par;
			
			if(FindColor(IMAQ_HSL, &tdata.hue, &tdata.saturation, &tdata.luminance, &par))
			{
				dashboard.Printf("color found at x=%i, y=%i\n", par.center_mass_x_normalized, par.center_mass_y_normalized);
				dashboard.Printf("color as percent of image: %f\n", par.particleToImagePercent);
			}
			else
			{
				dashboard.Printf("No color found :(\n");
			}
			UpdateDashboard();
		}
	}
Currently, we are attempting to find pink. Do you think it is a problem with our values for HSL, or is it our code itself?

[EDIT]
We figured it out. Apparently, we had two problems in our code:
1. The code was running too fast for the image processor. We added a Wait(1.0/60); to the end of the loop, so it runs at a max rate of 60 executions per second (twice our fps). That allowed us to see that we were finding the color, but it always said it was x=0, y=0. That's when we found out that...
2. There was an error in the C/C++ Programming Guide that we took some of our code from. par.center_mass_x_normalized and par.center_mass_x_normalized are doubles. "%d" is for integers. We changed the printf to say "%f" and it works perfectly.
[/EDIT]
__________________
Team 811 (Nashua, NH) - Mentor

Previously Team Lead & Programming Lead

Last edited by NinJA999 : 25-01-2009 at 17:06.
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
Camera tracking but not moving penguain NI LabVIEW 9 30-01-2009 10:10
Camera not working LinuxMercedes Programming 10 13-01-2009 10:18
Camera locked in "tracking", but not tracking geeknerd99 Programming 1 18-02-2007 22:47
Camera not working st1nkm4n Programming 7 02-02-2006 08:22
Camera not working st1nkm4n Programming 0 31-01-2006 19:23


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

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