1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| PlanarImage pi = JAI.create("fileload", "C:\\gris\\G1.jpeg");
System.out.println(pi.getColorModel());
BufferedImage bi = pi.getAsBufferedImage();
ColorProcessor image= new ColorProcessor(bi);
ByteProcessor image2 = (ByteProcessor) image.convertToByte(true);
final Point[][] seeds = {
{new Point(5, 20)}, // Background
{new Point(50, 120)}, // Blob 1
{new Point(100, 70)}, // Blob 2
};
final SRG srg = new SRG();
srg.setImage(image2);
srg.setSeeds(seeds);
srg.setNumberOfAnimationFrames(50);
// Run growing
srg.run();
// Extract results
final ByteProcessor regionMask = srg.getRegionMask();
final ImageStack animationStack = srg.getAnimationStack();
ImagePlus im= new ImagePlus (); |
Partager