2013-04-22 207 views
3

我有一個簡單的插件,它節省了多邊形座標:imageJ如何獲得像素RGB值?

Roi roi = imp.getRoi(); 
Polygon p = roi.getPolygon(); 
for (int i = 1; i <= p.npoints; i++) { 
// létrehozzuk az onvif féle vector-t 
org.onvif.ver10.schema.Vector myVector = new Vector(); 
myVector.setX((float) p.xpoints[i - 1]); 
myVector.setY((float) p.ypoints[i - 1]); 
op.getPoint().add(myVector); 
// IJ.log("Vector X Elements " + i + " :" + MyVector.getX()); 

     } 

,但我想要得到的座標RGB值是這樣的: enter image description here

你能幫助我嗎? 謝謝!

+0

什麼關於CT圖像 – 2014-06-12 08:13:26

回答

2

假設圖像是32位RGB:

ImagePlus im = IJ.getImage(); 
ImageProcessor imp = im.getProcessor(); 

int[] rgb = new int[3]; 
imp.getPixel(X,Y,rgb); 

IJ.log(Arrays.toString(rgb)); 
+0

HU值感謝您的幫助! – David 2013-04-22 15:20:32

0
int[] r; 

     for (int i = 1; i <= p.npoints; i++) { 

      r = imp.getPixel(p.xpoints[i - 1], p.ypoints[i - 1]); 



      ij.IJ.log("Red: "+ r[0]); 
      ij.IJ.log("Green: "+ r[1]); 
      ij.IJ.log("Blue: "+ r[2]); 
      ij.IJ.log("index: "+ r[3]); 

     } 
相關問題