Go to Post Let's sheathe the pitchforks and douse the torches for another two months, shall we? - Taylor [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 10-02-2012, 21:51
ben_benavides ben_benavides is offline
Registered User
FRC #2085
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Vacaville, CA
Posts: 2
ben_benavides is an unknown quantity at this point
Convex Hull Produces Black Image

OK so our team is having some trouble with image tracking. This is our algorithm so far.

Capture Image->Color Plane Extraction->Threshold->Convex Hull.

We are able to to capture the image in code, apply the color plane extraction, and the threshold. We are having trouble with the convex hull. Every time we try to apply a convex hull It gives us a black image. We are retrieving the images by FTP'ing into the cRIO. Any help would be appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2012, 00:29
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Convex Hull Produces Black Image

From my experience, a binary image is stored as a grayscale image with values of 0 and 1. Since grayscale is usually 0 to 255, it's impossible to see what is 0 and what is 1. So I usually put it into mspaint and then use the color fill to get it. Of course, that's harder to do if you have lots of small particles and such.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2012, 09:01
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Convex Hull Produces Black Image

I agree with the other post. Use the particle analysis step to see if there are particles and what measurements you have. Although, debugging vision code without being able to see images is not my favorite pastime.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 11-02-2012, 15:25
simpsonboy77 simpsonboy77 is offline
Registered User
AKA: Garrett Dicken
FRC #0041 (RoboWarriors)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2005
Location: New Jersey
Posts: 87
simpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond reputesimpsonboy77 has a reputation beyond repute
Re: Convex Hull Produces Black Image

If you save them as .png they should open in windows picture viewer. On my computer they show up as red.
__________________
2013 - Present MAR Control System Adviser and FTAA
2009 - Present Programming an Electrical Mentor Team 41
2005 - 2008 Team 41 Programmer
2008 NYC Regional Winner

Last edited by simpsonboy77 : 11-02-2012 at 15:26. Reason: typo
Reply With Quote
  #5   Spotlight this post!  
Unread 11-02-2012, 16:57
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 152
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: Convex Hull Produces Black Image

Yes - when you do the image->Write() function, if you use a .jpg filename, you'll wind up with black images often (or always). If you use .bmp, you'll wind up with usable files/images. And the other person said .png which I haven't personally tried.

.bmp
or
.png

Let us know this solved it.

bob
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote
  #6   Spotlight this post!  
Unread 11-02-2012, 18:20
ben_benavides ben_benavides is offline
Registered User
FRC #2085
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Vacaville, CA
Posts: 2
ben_benavides is an unknown quantity at this point
Smile Re: Convex Hull Produces Black Image

Thanks for the help. We have successfully applied a convex hull and we are on our way to finishing vision tracking.
Reply With Quote
  #7   Spotlight this post!  
Unread 12-02-2012, 12:08
GrimmReaper's Avatar
GrimmReaper GrimmReaper is offline
Registered User
FRC #2046 (Bear Metal)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Maple Valley, WA
Posts: 24
GrimmReaper is on a distinguished road
Re: Convex Hull Produces Black Image

I hadn't tried a BMP or PNG file, but rather just converted the image(changed the contrast and gamma) so that i could see the contrasting pieces and saved that as a JPG, so here's another example for ya, this results in a white on black image:

Code:
		Image* thisImage = myBinaryImage->GetImaqImage();
				
		BCGOptions bcg;
		bcg.brightness = 128.0f;
		bcg.contrast = 89.0f;
		bcg.gamma = 0.1f;
		
		if (imaqBCGTransform(thisImage, thisImage, &bcg, NULL) == 0)
		{
			//error during save
			printf("Error with imaqBCGTransform : %d\n", imaqGetLastError());
			return ERROR;
		}
	
		if (imaqWriteFile(thisImage, "/BinaryImage.jpg", NULL) == 0)
		{
			//error during save
			printf("Error saving image : %d\n", imaqGetLastError());
			return ERROR;
		}
- Jon
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


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

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