您好,我需要访问 ImagePlus 的每个像素以进行图像分析。
由于要处理大量图像,我想知道是否有特殊的有效方法/方法可以访问和/或修改 imagePlus 中的每个像素?我自然得出的唯一想法是通过图像矩阵进行双 for 循环,这需要我几十秒才能在 1000x1000 图像上实现。这是我的代码:
ImagePlus Iorg = IJ.openImage("Demo1.png");
int[] pix = Iorg.getPixel(5, 5);
if(Iorg.getSlice() != 1) {
System.exit(0);
}
for(int w=0; w< Iorg.getDimensions()[0]; w++) {
for(int h=0; h<Iorg.getDimensions()[1]; h++) {
System.out.println(w + " x " + h);
// DO what needs to be done
}
}
任何想法?