Topic: OpenCV on Chumby - cannot open image files

Hi,

With great difficulty I managed to cross-compile OpenCV 2.2.0 for my Chumby. I couldn't get Python support to work and couldn't completely disable it for the newest release, so I had to go with 2.2.0.

Anyway, after tweaking the source code at a couple of places and applying other tricks, I managed to compile and install OpenCV 2.2.0. My joy was preliminary, because I cannot seem to get it to open jpg or png image files.

I have a simple test program for which I pass the file to open as a command line parameter and try to open it with cvLoadImage():

  img=cvLoadImage(argv[1]);
  if(!img){
    printf("Could not load image file: %s\n",argv[1]);
    return -1;
  }

No matter what I do, img is always null. I know that I'm using the correct path etc. Same thing with jpg and png image files. I've tried with multiple files.

Anyone have experience with OpenCV on a Chumby? Ever encountered something similar? Or would someone happen to have pre-built binaries that work?

Re: OpenCV on Chumby - cannot open image files

You might want to try contacting this guy.

Re: OpenCV on Chumby - cannot open image files

Duane wrote:

You might want to try contacting this guy.

You know, I had came across his article myself, but didn't see the attached files he mentioned in his post.

Turns out the attachments and comments are only visible for registered users. I had actually registered earlier today, but didn't get my confirmation e-mail for a couple of hours. Now I got it, could sign in and download the OpenCV binaries.

I haven't yet tested it, but I have high hopes. Thanks for your reply!

Re: OpenCV on Chumby - cannot open image files

Good luck - please let us know how it goes!

Re: OpenCV on Chumby - cannot open image files

Unfortunately the precompiled binaries I got from http://myrobotlab.org/node/97 didn't help much. Apparently support for JPG and PNG images has been explicitly removed from the configuration in that build - I at least tried to include them. I have built and installed the required jpeg and png libraries.

Moreover, capturing directly from my webcam doesn't work either, like it didn't with the version I compiled myself. It isn't my webcam, as both Fswebcam and mjpg_streamer do work with it on the Chumby.

There is some hope, though, as reading and writing BMP images does seem to work. PBM, PGM and PPM should work too. They would probably have worked with my own binaries as well. Now I just need to figure out how to convert images captured by my webcam into one of those formats. As far as I know, Fswebcam doesn't support them directly.

6 (edited by Dr. Fastolfe 2011-08-22 12:26:31)

Re: OpenCV on Chumby - cannot open image files

I found satisfactory solutions to my problems.

I'm still not able to read JPG or PNG files directly using OpenCV's functions, but now I know how to decompress JPGs manually using libjpeg and convert them into OpenCV's IplImages.

I compiled a version of OpenCV that supports FFmpeg in the hope that this would enable OpenCV to decode the live webcam stream generated by mjpg_streamer, but this didn't help. FFmpeg failed to decode my stream. However, I found a way to do the decoding manually using some sample code I found on the web.

So, now I'm able to use both single JPEG images and frames  captured from a motion JPEG stream from by webcam in my Chumby OpenCV-based programs.

There are too many details to explain here, but they are included in two of my latest blog entries:

Working on getting things to work on the Chumby
OpenCV and a webcam stream: a fail and a win

Actually the key to reading both single JPEG images and a motion JPEG streams is in the sample code mentioned in the last paragraph of the second post. The rest is just background information.