2014-02-19 41 views
1

我將創建一個Android應用程序,該應用程序使用RGB來確定肉的新鮮度。該應用程序的流程是:使用RGB的Android應用程序中的圖像處理

  1. 捕捉圖像
  2. 通過點擊一個按鈕
  3. 顯示從它的RGB根據結果確定新鮮感。

我在RGB部分有問題。希望有人能幫助我處理這件事。

+0

什麼問題?你有關於如何編碼的問題 - 你有沒有試過的代碼? – Phil

+0

我有如何編碼這個問題。我找不到任何與RGB相關的內容 – desperateprogrammer

+0

http://processing.org/reference/red_.html http://processing.org/reference/green_.html http://processing.org/reference/ blue_.html – kevinsa5

回答

0

如果您使用的是Processing,這可能很有用。

使用處理可逐像素掃描圖像,因此可以比較它們以查找圖像中的圖案。

PImage sample; 

void setup() { 
    size(300,300); 
    sample = loadImage("sample.jpg"); 

    sample.loadPixels(); 
    image(sample,0,0,300,300); 
} 

void draw() {  
    //Loop to scan the image pixel by pixel 
    for (int x=0; x < sample.width; x++){ 
    for (int y=0; y < sample.height; y++){ 

     int location = x + (y * sample.width); 
     // Whit the location you can get the current color 
     color currentColor = sample.pixels[loc]; 
     //Do something 

    } 
    } 
} 
相關問題