代码:(代码转载自:http://ubaa.net/shared/processing/opencv/blob.html

[cc lang=”c”]
import hypermedia.video.*;

OpenCV opencv;

void setup() {

size( 640, 480 );

// open video stream
opencv = new OpenCV( this );
opencv.capture( 640, 480 );

}

void draw() {

background(192);

opencv.read(); // grab frame from camera
opencv.threshold(80); // set black & white threshold

// find blobs
Blob[] blobs = opencv.blobs( 10, width*height/2, 100, true, OpenCV.MAX_VERTICES*4 );

// draw blob results
for( int i=0; i

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注