We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › OpenGL and OpenCV.. conflict ?
Page Index Toggle Pages: 1
OpenGL and OpenCV.. conflict ?? (Read 968 times)
OpenGL and OpenCV.. conflict ??
May 8th, 2009, 1:25am
 
Hi

I am trying to use the OpenCV library with a sketch which already uses the OpenGL library.. but it seems as thought that these do not work together..  The introduction of the OpenGL library distorts the redrawing of the image: the example below works fine - if the references to OpenGL are removed.

Does anyone have any suggestions of how to make these two work together without conflict ?

Thanks

A

Code:

import processing.opengl.*;
import hypermedia.video.*;

OpenCV opencv;

void setup() {
   opencv = new OpenCV( this );
   opencv.capture( 640, 480 );
   size( 640, 480, OPENGL);
}

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
   noStroke();
   fill (256, 0, 0);
   for( int i=0; i<blobs.length; i++ ) {
       beginShape();
       for( int j=0; j<blobs[i].points.length; j++ ) {
           vertex( blobs[i].points[j].x, blobs[i].points[j].y );
       }
       endShape(CLOSE);
   }
}


Re: OpenGL and OpenCV.. conflict ??
Reply #1 - May 8th, 2009, 4:27pm
 
works fine just the way you posted it...
Re: OpenGL and OpenCV.. conflict ??
Reply #2 - May 10th, 2009, 1:50pm
 
Thanks for the reply... could this be a platform issue  then? Adding the OPENGL definitely creates odd triangle shapes instead of a smooth fill on my machine.

I on a mac OS 10.4.11.. ??


Page Index Toggle Pages: 1