BinaryImage constructors protected?

I’ve been writing some target tracking code over the last couple of days, and just hit a bit of a roadblock. It seems to me that the constructors for the BinaryImage class have no modifiers, and default to protected, so they can’t be accessed from the vision part of our Robot code? Am i missing something or is this not working as intended?

I don’t think you use a constructor to create a binary image. I got mine from a colorImage.getThreshold.

hope this helps!

The primary reason that I need to actually CREATE a BinaryImage is that I’m playing with using the LAB (IMAQ_CIE) color space and the ColorImage class doesn’t provide a nice API for that yet. Also, is there any reason that the extract<nth>ColorPanel(…) methods in ColorImage are also protected? I’ve gotten around this for the time being by placing my camera class in WPI’s image package, but thats obviously not the “correct” way to do things in the long run.

You never actually construct binary images yourself; you simply obtain the reference to them from other camera methods. Therefore, the binary image constructors being protected is an issue.

edit: Could you clarify that post? I don’t understand what you’re asking due to the grammar errors.

Wow. I usually proof-read my posts. I guess I’m just super tired. Regardless, the post should be cleared up now. Moving on, there are no “camera methods” for the LAB color space (that I know of). Therefore, I have to create my own BinaryImage and use the threshold method from NIVision to obtain mask that matches my threshold in the LAB color space.

I’m still not sure I understand why you need to create a binary image, though. Binary images are simply the results of filters, not images that filters are run on. Why couldn’t you simply compare, using, say, the NIVision assistant, filters on LAB images compared to filters on your own supplied HSL images?

I’m not quite sure what you mean by the NIVision assistant, but basically, none of this would be needed if there was some method in ColorImage to the effect of


public BinaryImage thresholdLAB(int lightnessLow, int lightnessHigh, int aLow, int aHigh, int bLow, int bHigh)

Because there isn’t such a method, I’ve been trying to add something like it to a custom wrapper class (wraps around ColorImage).

Sort of off-topic but wouldn’t Objective-C Categories come in handy big time right here? Bummer Java doesn’t have something similar.

Also, what did you mean when you talked about comparing filters on LAB images with filters on HSL images? the problem is that I can’t apply a filter in the LAB color space, unless I’m just blind and missing something huge.

What I’m wondering is, why don’t you simply use the HSL colorspace, as opposed to the LAB color space? I’m sure multiple filters on the same image in HSL would achieve the same effect.

The NIVision assistant is installed along with some of the FIRST software, possibly the utilities update or the full LabView software.