ant_thomas
Posts: 115
Joined: Fri May 04, 2012 4:33 pm

GPU assisted image conversion

Sat Jan 26, 2013 1:25 am

With my current setup of an RPi and a Canon compact camera (running CHDK) acting as a high quality webcam the most expensive part of the script I'm running is the image conversion/resizing.

It basically goes.

Capture image
Download image from camera
Convert/resize image
Upload image to web server

After reading a few bits about the upcoming camera module which takes advantage of being directly connected to the GPU and harnesses the power of the GPU for image processing and video encoding, I was wondering if this capability would be available in some way for regular image conversions? Or is it even available in some form already? Or is this wishful thinking?

Currently I'm using "convert" from Imagemagick. Very simple and easy to use for converting a high res JPEG to a lower-res JPEG. I'm doing conversions of 1600x1200 to 1280x960 and 480x360 but I'd rather capture at the full resolution of the camera for archiving purposes but then the conversion takes far too long. The 1600x1200 to 1280x960 conversion takes around 10 seconds to complete.

If anyone has any ideas of how to drop the conversion time significantly, without dropping the JPEG quality, they would be greatly appreciated.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26659
Joined: Sat Jul 30, 2011 7:41 pm

Re: GPU assisted image conversion

Sat Jan 26, 2013 8:51 am

I'd do a search for various programs for do JPG resizing - some will be faster than others.

As for doing it on the GPU - yes, its possible. You'd need to use OpenMAX code to link the read component to the resize component to the write component. Should be pretty quick. We might even have some demo code at work - I'll try and remember to look on Monday.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: GPU assisted image conversion

Sat Jan 26, 2013 9:01 am

• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

ant_thomas
Posts: 115
Joined: Fri May 04, 2012 4:33 pm

Re: GPU assisted image conversion

Mon Jan 28, 2013 10:43 am

Thanks for the replies.

James, if you could look into it that would be great.

I'll look into alternative conversion software and ghans I'll have a look at what has already been done in the area.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: GPU assisted image conversion

Mon Jan 28, 2013 11:34 am

Hmm.
After a second look , that only decodes the image , you
will have to re-encode it yourself after resizing.


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Return to “Graphics, sound and multimedia”