OpenCV and Processing 12

The example again adopts the CVImage to demonstrate the use of blur filter. It uses the medianBlur() function from the Imgproc module in OpenCV mischpulten. Detailed description can also be found in the OpenCV tutorial here hwmonitor herunterladen.


import processing.video.*;
 
import org.opencv.imgproc.Imgproc;
import org.opencv.core.CvType;
import org.opencv.core.Size;
 
Capture cap;
CVImage img;
PShape shp;
 
void setup() {
  size(640, 480, P3D);
  println(Core.VERSION);
  System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
  cap = new Capture(this, width, height);
  cap.start();
  img = new CVImage(width, height);
  shp = createShape(RECT, 0, 0, width, height);
}
 
void draw() {
  background(0);
  arrayCopy(cap.pixels, img.pixels);
  img.toCV(); // load the pixels to Mat
 
  Mat src = img.getBGR();
  Mat dst = new Mat(src.size(), src.type());
  Imgproc.medianBlur(src, dst, 9);
 
  img.fromCV(dst); // update the img with Mat dst
  shp.setTexture(img);
  shape(shp, 0, 0);
  text("Frame rate: " + nf(round(frameRate), 2), 10, 20);
  src.release();
  dst.release();
}
 
void captureEvent(Capture c) {
  c.read();
  c.loadPixels();
}

 
The major statement is

Imgproc.medianBlur(src, dst, 9);

The number 9 is the aperture linear size to control the amount of ‘blurriness’ xbox one xbox 360 profil herunterladen.