|
Image Threshold Produces Black Image
We used the NI Vision Assistant to generate code, and the script there works great on all our images, however once we generate code, modify to compile, and deploy to the robot, it doesn't seem to work properly.
I added code to write the image out to the CRIO filesystem as a jpeg before and after the threshold, the image going in looks normal, and can be loaded in vision assistant and results in particles as we expected; and the image saved after the threshold is just black.
We have additional steps doing particle analysis, and some custom code that decomposes the particle analysis results structure (which could be the problem, haven't debugged heavily yet).
Is there a reason this image is all black, I saw several labview topics where it has to do with the color pallete in labview, but is it a similar issue i'm seeing when I ftp to the robot where the squares are just dark-grey (and throwing me a red herring), or is there something different in the threshold function that is a problem.
Here is some psuedo code of what we're doing:
1.get camera image as color image (write it out)
2.run HSV threshold filter,
3.storing the result to binary image (write out binary image, this one looks black),
4.apply other image processing steps, convex hull + particle filter + particle analysis (we pass back the particle analysis by reference)
5.decompose the particle analysis results searching for the result name "Center Of Mass X" (i think) using if(strcmp() == 0)
If anyones got some helpful info or ideas it would be appreciated, once I figure this out I'll post back what went wrong.
tldr; I'm mostly curios if the black image is ok (just a color space issue) or if the threshold operation is failing to find anything.
|