我是一个初学者,想把现有的ImageProcessor图片(RGB)转换成8位的灰度图(在ImageJ中)。
我试过不同的方法,但都没有用:
ImageProcessor binaer = copy.getProcessor().convertToByte(false);
.不管用
..so I希望将处理器类型从ImageProcessor更改为ImagePlus。
ImagePlus imp = copy.getProcessor();
但这也没用。
我在网上发现了这个:
进口ij.ImagePlus;进口ij.process.ImageConverter; // . ImagePlus imp = IJ.getImage(); ImageConverter ic =新的ImageConverter(imp); ic.convertToGray8(); imp.updateAndDraw();
但是我不想使用原始图片,我想使用编辑过的ImageProcessor图片。
有人能帮帮我吗?
发布于 2016-07-07 06:13:21
你确定copy.getProcessor().convertToByte(false);
没有工作吗?因为当我查看ImageProcessor代码时,我发现:
public ImageProcessor convertToByte(boolean doScaling)
{
TypeConverter tc = new TypeConverter(this, doScaling);
return tc.convertToByte();
}
我在电脑上做了测试,效果很好。RGB图像经过8位编码正确转换为灰度级。
你到底想要什么?你想做什么?你想要一张二进制胜的图像吗?
https://stackoverflow.com/questions/38234433
复制相似问题