Hi,
We copied the sample code into our project and are using the sample images provided. When we run it we get zero particles found. I added some extra code to print a particle report after every image operation and find that there are particles before the final filter is run(see below).
I also had a question about the following lines:
cc = new CriteriaCollection();
cc.addCriteria(MeasurementType.IMAQ_MT_BOUNDING_RECT_WIDTH, 30, 400, false);
cc.addCriteria(MeasurementType.IMAQ_MT_BOUNDING_RECT_HEIGHT, 40, 400, false);
I read through the vision concepts doc and found descriptions of these criteria. But I was not sure if it meant:
a) crop the entire image to the described rectangle and return particles in the cropped area.
b) only return particles that fit in the size of described rectangle, so search entire image for particles that fit.
Here’s the code and output. I am using 10ft2.jpg in this example output. I also tried the other xxft2.jpg images and got the same result, the last filter found zero particles.
BinaryImage bigObjectsImage = thresholdImage.removeSmallObjects(false, 2);
printParticleReports("bigobj", bigObjectsImage);
// fill in occluded rectangles
BinaryImage convexHullImage = bigObjectsImage.convexHull(false);
printParticleReports("convexhull", convexHullImage);
// find filled in rectangles
BinaryImage filteredImage = convexHullImage.particleFilter(cc);
printParticleReports("filtered", filteredImage);
The output is jumbled, see this thread: http://www.chiefdelphi.com/forums/showthread.php?t=101438
[cRIO]
[cRIO] * bigobj*********************************************
[cRIO] 031250000000000444 , 0.0 )
[cRIO] Area : 301746.0
[cRIO] percent : 98.224609375
[cRIO] Bounding Rect : ( 0 , 0 ) 640480
[cRIO] Quality : 98.33023755987878
[cRIO]
[cRIO]
[cRIO] Particle(1/2)
[cRIO] Particle Report:
[cRIO] Image Height : 480
[cRIO] Image Width : 640
[cRIO] Center of mass : ( 319 , 240 )
[cRIO] normalized : ( -0.0Particle(2/2)
[cRIO] Particle Report:
[cRIO] Image Height : 480
[cRIO] Image Width : 640
[cRIO] Center of mass : ( 323 , 31 )
[cRIO] normalized : ( 0.009374999999999911 , -0.8708333333333333 )
[cRIO] Area : 272.0
[cRIO] percent : 0.08854166666666666
[cRIO] Bounding Rect : ( 294 , 29 ) 557
[cRIO] Quality : 95.77464788732394
[cRIO]
[cRIO]
[cRIO] 2 146.245212
[cRIO] **********************************************
[cRIO]
[cRIO] 652 )
[cRIO] Area : 307200.0
[cRIO] percent : 100.0
[cRIO] Bounding Rect : ( 0 , 0 ) 640480
[cRIO] Quality : 100.0
[cRIO]
[cRIO]
[cRIO] Particle(1/1)
[cRIO] Particle Report:
[cRIO] Image Height : 480
[cRIO] Image Width : 640
[cRIO] Center of mass : ( 319 , 239 )
[cRIO] normalized : ( -0.0031250000000000444 , -0.004166666666666vexhull********************************************
[cRIO]
[cRIO] * con1 146.837495
[cRIO] **********************************************
[cRIO]
[cRIO]
[cRIO] * filtered*********************************************
[cRIO] 0 147.054589
[cRIO] **********************************************
[cRIO]