2015-02-23 50 views
-2

我初學編程-i顯示了這個類如何運行代碼的OpenCV

http://www.magicandlove.com/blog/2014/03/06/people-detection-in-processing-with-opencv/ &我想淨豆運行,但主要方法是錯過&看起來像一些錯誤找不到PImage也,大小,背景 你能幫助我如何運行它&類應該有什麼。

PImage small; 
HOGDescriptor hog; 

byte [] bArray; 
int [] iArray; 
int pixCnt1, pixCnt2; 
int w, h; 
float ratio; 

void setup() { 
    size(640, 480); 
    ratio = 0.5; 
    w = int(width*ratio); 
    h = int(height*ratio); 

    background(0); 
    // Define and initialise the default capture device. 
    cap = new Capture(this, width, height); 
    cap.start(); 

    // Load the OpenCV native library. 
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME); 
    println(Core.VERSION); 


    pixCnt1 = w*h*4; 
    pixCnt2 = w*h; 

    bArray = new byte[pixCnt1]; 
    iArray = new int[pixCnt2]; 

    small = createImage(w, h, ARGB); 
    hog = new HOGDescriptor(); 
    hog.setSVMDetector(HOGDescriptor.getDefaultPeopleDetector()); 
    noFill(); 
    stroke(255, 255, 0); 
} 

void draw() { 
    if (cap.available()) { 
    cap.read(); 
    } 
    else { 
    return; 
    } 
    image(cap, 0, 0); 
+2

「我是編程初學者」 - 也許那麼 - 避免不透明的(和嚴重維護)第三方框架如處理?如果你想在android上使用opencv,那麼堅持使用官方的opencv4android sdk – berak 2015-02-23 19:16:25

回答

0

你需要一切從複製該頁面包括進口,我在想你所想創建對象是從被假設需要進口,這樣可以解決你的問題的事物。