【问题标题】:IMAGEJ: convert an existing ImageProcessor picture (RGB) into an 8-Bit GrayvalueIMAGEJ:将现有的 ImageProcessor 图片 (RGB) 转换为 8 位灰度值
【发布时间】:2016-07-07 14:13:21
【问题描述】:

我是初学者,想将现有的 ImageProcessor 图片 (RGB) 转换为 8 位灰度图片(在 ImageJ 中)。

我尝试了不同的方法,但没有任何效果:

ImageProcessor binaer = copy.getProcessor().convertToByte(false);

...不起作用

..所以我想将处理器类型从 ImageProcessor 更改为 ImagePlus..

ImagePlus imp = copy.getProcessor();

但这也没有用。

我在网上找到了这个:

导入 ij.ImagePlus; 导入 ij.process.ImageConverter;

// ...

ImagePlus imp = IJ.getImage();

ImageConverter ic = new ImageConverter(imp);

ic.convertToGray8();

imp.updateAndDraw();

但我不想使用原始图片,我想使用编辑后的 ​​ImageProcessor 图片。

谁能帮帮我

【问题讨论】:

    标签: java imagej


    【解决方案1】:

    您确定copy.getProcessor().convertToByte(false); 不起作用吗?因为当我查看 ImageProcessor 代码时,我发现了以下内容:

    public ImageProcessor convertToByte(boolean doScaling)
        {
        TypeConverter tc = new TypeConverter(this, doScaling);
        return tc.convertToByte();
        }
    

    我在我的电脑上进行了测试,它运行良好。 RGB 图像已通过 8 位编码正确转换为灰度。

    你到底期待什么?你想做什么?你想要一个二值图像吗?

    【讨论】:

    • 我写了一个插件来检测单元格并将它们标记为黑色。现在我想拍那张照片(在 ImageProcessor original_new 中)。我想将所有其他像素设置为白色并将图片转换为 8 位。我想这样做是因为 ImageJ 有可能填补二进制图片中的漏洞。这就是我想要的
    • 所以您不想将其转换为字节,而是转换为 BinaryProcessor。您当然可以通过阈值处理来做到这一点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-02
    • 1970-01-01
    • 2014-02-26
    • 2014-12-22
    • 2012-03-30
    • 2020-04-29
    相关资源
    最近更新 更多