Reputation: 1
I am a beginner and want to convert an existing ImageProcessor picture (RGB) into an 8-Bit Grayvalue Picture (in ImageJ).
I tried different things but nothing worked:
ImageProcessor binaer = copy.getProcessor().convertToByte(false);
...Doesn't work
..so I wanted to Change Processor Type from ImageProcessor to ImagePlus..
ImagePlus imp = copy.getProcessor();
But this also didn't work.
I found this in the WEB:
import ij.ImagePlus; import ij.process.ImageConverter;
// ...
ImagePlus imp = IJ.getImage();
ImageConverter ic = new ImageConverter(imp);
ic.convertToGray8();
imp.updateAndDraw();
But I don't want to work with the original Picture, I want to work with the edited ImageProcessor picture .
Can somebody please help me out
Upvotes: 0
Views: 639
Reputation: 5878
Are you sure that copy.getProcessor().convertToByte(false);
didn't work? Because when I look into the ImageProcessor code, here is what I find:
public ImageProcessor convertToByte(boolean doScaling)
{
TypeConverter tc = new TypeConverter(this, doScaling);
return tc.convertToByte();
}
I did the test on my computer, and it worked fine. The RGB image was properly converted to gray level with 8 bits encoding.
What exactly do you expect? What are you trying to do? Do you want a binary image?
Upvotes: 1