getting resulting image from processing in java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

getting resulting image from processing in java

Tommy Chheng
I'm new to using ImageJ as a Java Library.

Currently, i need to do a simple crop and resize.
This snippet does the job, but i need a slight modification where the input
is a bufferedImage and the output is also a bufferedImage
https://sites.google.com/a/gingercart.com/www/java-snippets/create-image-thumbnail-in-java-using-imagej-api


I changed the parameter correctly:
    val imp = new ImagePlus(null, bufImage)
    val  ip = imp.getProcessor();
    var  sp = new StackProcessor(imp.getStack(), ip);

but I'm unsure how to get the resulting image:

I tried but this returns the original sized image rather than the
cropped/resized one:
    sp = new StackProcessor(imp.getStack(), imp.getProcessor());
    val resizedStack = sp.resize(width, height, true);
    imp.setStack(null, resizedStack);

    imp.getProcessor.getBufferedImage


--
@tommychheng
http://tommy.chheng.com