I am just starting out with OpenIMAJ (1.3.5) and am trying out the tutorial problem 3.1.2. Exercise 2: A real segmentation algorithm which suggests using the FelzenszwalbHuttenlocherSegmenter. (And this is one of the segmenters that will probably prove relevant to the real problems I am attempting to solve).
I first tried this with a few of my own images, both as color and grayscale, and in each case the segmenter reported 1 connected component.
I then tested against the sample images and parameters on Felzenszwalb's home page and these also returned only 1 connected component.
Please provide some guidance on the proper use of this segmenter if I am doing something incorrectly.
Thank you,
David
Code below:
publicstaticvoidmain(String[]args)throwsIOException{URLsampleImageUrl1=newURL("http://cs.brown.edu/~pff/segment/beach.gif"); URL sampleImageUrl2 = new URL("http://cs.brown.edu/~pff/segment/grain.gif"); processDefaultFelzenszwalbImage(sampleImageUrl1, 0.5f, 500f, 50); processDefaultFelzenszwalbImage(sampleImageUrl2, 0.5f, 1000f, 100); } public static void processDefaultFelzenszwalbImage(URL url, float sigma, float k, int minSize) throws IOException { MBFImage input = ImageUtilities.readMBF(url); FelzenszwalbHuttenlocherSegmenter<MBFImage> segmenter = new FelzenszwalbHuttenlocherSegmenter<MBFImage>(sigma, k, minSize); List<ConnectedComponent> components = segmenter.segment(input); int componentsCount = components.size(); System.out.println("Componentcount"+componentsCount);}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the problem is with your setting of the k parameter - OpenIMAJ's internal image representation (MBFImage) uses pixel values between 0 and 1, whereas Felzenszwalb's code has images where the pixels are 0-255. If you divide your k value by 255 it should work I believe.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
I am just starting out with OpenIMAJ (1.3.5) and am trying out the tutorial problem 3.1.2. Exercise 2: A real segmentation algorithm which suggests using the FelzenszwalbHuttenlocherSegmenter. (And this is one of the segmenters that will probably prove relevant to the real problems I am attempting to solve).
I first tried this with a few of my own images, both as color and grayscale, and in each case the segmenter reported 1 connected component.
I then tested against the sample images and parameters on Felzenszwalb's home page and these also returned only 1 connected component.
Please provide some guidance on the proper use of this segmenter if I am doing something incorrectly.
Thank you,
David
Code below:
I think the problem is with your setting of the k parameter - OpenIMAJ's internal image representation (MBFImage) uses pixel values between 0 and 1, whereas Felzenszwalb's code has images where the pixels are 0-255. If you divide your k value by 255 it should work I believe.
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Changing the k value as you suggest resolves the issue. Thank you for the quick and helpful response.