Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Convex Hull Produces Black Image (http://www.chiefdelphi.com/forums/showthread.php?t=102494)

ben_benavides 10-02-2012 21:51

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.

WizenedEE 11-02-2012 00:29

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.

Greg McKaskle 11-02-2012 09:01

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

simpsonboy77 11-02-2012 15:25

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.

bob.wolff68 11-02-2012 16:57

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

ben_benavides 11-02-2012 18:20

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.

GrimmReaper 12-02-2012 12:08

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


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

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