我有一张图像,我正在尝试根据图像的红色、蓝色或绿色程度来提取特定 channel 。
例如,如果我的图像主要是红色,我想提取红色 channel 。我已经有了可以为我提取 channel 的代码:
private ImageProcessor getRedChannel(ImageProcessor ip) {
RGBStackSplitterSean splitter=new RGBStackSplitterSean();
splitter.split(new ImagePlus("tempImage",ip));
ImagePlus red=new ImagePlus("tempImage",splitter.red);
return red.getProcessor();
}
如何确定哪个 channel 最强?
谢谢!
编辑:
我最终按照 @mmgp 提到的那样做了。总结每个 channel 的所有强度并选择最大的使用:
private int getSumPixels(ImageProcessor ip){
int sum = 0;
for(int i=0; i<ip.getWidth(); i++){
for(int k=0; k<ip.getHeight(); k++){
sum = sum + ip.getPixel(i, k);
}
}
return sum;
}
最佳答案
将每个 channel 的所有强度相加,并选择总和最大的一个。
关于java - 提取哪个 channel - ImageJ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14551437/