Log in

View Full Version : Vision Targeting: Dilate


Arhowk
09-03-2014, 15:03
Is there an equivalent of the openCv structure element "dilate" in Java's version of NIVision?

Greg McKaskle
10-03-2014, 21:02
The Dilate is an input to Morphology function.

Specifically, the imaqMorphology function or the imaqGrayMorphology function if the image is still grayscale will take in a method that can be dilate.

I don't know if that is wrapped for Java.

Greg McKaskle

Arhowk
15-03-2014, 13:08
Anyone? We need it to detect hot goals

E/ i found this in NIVision.java


//================================================== ==========================
// Morphology functions
//================================================== ==========================
//IMAQ_FUNC int IMAQ_STDCALL imaqGrayMorphology(Image* dest, Image* source, MorphologyMethod method, const StructuringElement* structuringElement);

E/ can anyone post the list of constants for MorphologyMethod and StructuringElement? if I'm rewrapping the entire NIVision library might as well throw in erode as well


I'm going to see if i can rewrap this

E/ my copy of windriver has no license -_-

E/ found them here http://zone.ni.com/reference/en-XX/help/370281M-01/imaqvision/imaq_graymorphology/

E/ for open sourcing purposes, here is NIVision.dilate(). If anyone knows how to remove the while loop and convert the 0 into a [count][count], LMK. If you want to use this, you have to rebuild the wpi libraries and add this in image/NIVision.java


private static final int FN_DILATE = 2;

private static final BlockingFunction imaqGrayMorphologyFn = NativeLibrary.getDefaultInstance().getBlockingFunc tion("imaqGrayMorphology");
static { imaqGrayMorphologyFn.setTaskExecutor(taskExecutor) ; }

public static void dilate(Pointer dest, Pointer source, int count) throws NIVisionException {
assertCleanStatus(imaqGrayMorphologyFn.call4(dest. address().toUWord().toPrimitive(),
source.address().toUWord().toPrimitive(),
FN_DILATE,
0));
if(--count > 0){
while(count --> 0){
assertCleanStatus(imaqGrayMorphologyFn.call4(dest. address().toUWord().toPrimitive(),
dest.address().toUWord().toPrimitive(),
FN_DILATE,
0));
}
}
}