opencv library

edited September 2017 in Kinect

THere are different opencv libs than the contributed one for processing. cv2 hypermedia i see in examples for opencv opencv.images() gives error in processing : the function image() does not exist.

I am trying to get mean of images after setting brightness with opencv, but mean always the same. How do i read resulant image from opencv brightness call?

opencv.image.pixels[x] gives error as well!

Do i need to import a different opencv library? cv2 or hypermedia? Is the openCV contributed lib the only one that works with processing ?

Thanks!

import gab.opencv.*;

int x,n; float sum,sampix,mean=0,oldmean=100;

PImage img,resimg; OpenCV opencv;

void setup(){

sampix=640*480; img = loadImage("refimg.png"); size(1080, 720); opencv = new OpenCV(this, img);

}

void draw(){ opencv.loadImage(img); opencv.brightness((int)map(mouseX, 0, width, -255, 255));

imgmean(); fill(250); rect(700,0,100,100); fill(0); text((int)map(mouseX, 0, width, -255, 255),710,20); text("MEAN="+mean,710,50);

image(opencv.getOutput(),0,0); }

/*********************************************************** IMGMEAN *************************************************/ void imgmean() {

x=n=0; sum=0; oldmean=mean; for(x=0;x<sampix;x++) { sum+=green(resimg.pixels[x]); n++; }

mean=sum/n;

}

Tagged:
Sign In or Register to comment.