Loading...
Logo
Processing Forum
Hello,

I'm really new in Processing, and used to work with AS3, but i'm really excited to play with Processing. I have a project for an art installation, that i first code in AS3, and i wanted to made this project in Processing to get better performance.

The first step of my project is just to play in fullscreen what the webcam see.

I tried this with the basic Capture function with the video lib, and i made an other version with openCV. I'm suprised that the performance i really bad : only 15 FPS with this 2 version. I noted, for the openCV version, that just the  opencv.capture (without feedback of the capture in fullscreen) slow down to 15 FPS.

I tried the same thing in AS3 with AIR, and i got 40+ FPS ... So i'm suprised of processing performance ...

Here is the code i used :

Video Lib Version :
Copy code
  1. import processing.video.*;
  2. Capture cam;
  3. void setup() {
  4. size(displayWidth, displayHeight)
  5.     cam = new Capture(this, 640,480);
  6. cam.start();
  7. }
  8. }

  9. void draw() {
  10. if (cam.available() == true) {
  11. cam.read();
  12. }
  13. image(cam, 0, 0, width, height);
  14. text(int(frameRate),200,200)

  15. }

Here is the OpenCV version

 
              
Copy code
  1. import hypermedia.video.*;
  2. OpenCV opencv;
  3. void setup()
  4. {
  5.   size(displayWidth, displayHeight);
  6. opencv = new OpenCV(this);
  7. opencv.capture(640, 480);
  8. }



  9. void draw() {
  10. opencv.read();
  11. image(opencv.image(), 0, 0, width, height);
  12. text(int(frameRate),200,200);
  13. }
I'm on the last beta release of processing 2, m'y resolution is 1280x800, i'm on old macbook (2008) - OSX 10.6, and i use the isight integrated webcam.
Anybody can help me to get better performance ? Or do you think AS3 is much performant than Processing to do that ?

Thanks in advance for your help !

(And sorry for my bad english ... i'm french)

Replies(6)

Hi !

It seems my topic is not really exciting, so i made another test yesterday and i got a better FPS with the video Lib (with P2D render) : near 40 FPS, so it's now a great performance as the AS3 version.

On the other end, i don't succeed to get better on openCV, with or without the P2D render. It's a really bad news for me because for my project i need to setup a face detection. Moreover i don't succeed to export the sketch with openCV : it works great when i launch the sketch in processing, but when i export, the app is launched, but i only see a grey screen ...

If somebody can help me to setup openCV with great performance and a working export, it would be really helpful !

Thanks in advance
Hi,

It's me again, anyone can help me about low performance vs. AS3 performance ? Is Processing better than flash excepted using camera input ?

Thank in advance !
Nobody interested about that topic ?
Hello, the problem with the integration between OpenCV and Processing at this moment is that the original opencv library for Processing doesn't appear to be developed any longer. There is a new OpenCV library, called javacvPro, which uses the latest version of OpenCV, it is currently maintained and I think is faster than the original opencv lib. But it requires compiling OpenCV from source on OSX, and has been giving people a hard time to install correctly. I don't know which one are you using in your tests, but if it is of any help, I managed to put together a package of javacvPro for OSX that includes the OpenCV libraries, meaning that you shouldn't need to do any additional install. I tested it on OSX 10.6 and 10.8 and appears to work fine.
Hello Andres,

And thank you so much for your reply. I tested my application with the old version of openCV, and now i wil try with javacvPro to get better performance.

Thanks again !
keep getting this error "UnsatisfiedLinkError: no jniopencv_core in java.library.path" from
        opencv = new OpenCV(this); // initialise objet OpenCV à partir du parent This