eckythump
Posts: 14
Joined: Thu May 16, 2013 2:21 pm

OpenCV with new camera module?

Thu May 16, 2013 5:47 pm

I was just wondering if anybody has got opencv working with the new camera module yet? (Particularly with Python?), any examples, any issues?
thanks.

hayderOICO
Posts: 49
Joined: Thu May 09, 2013 3:40 pm

Re: OpenCV with new camera module?

Thu May 16, 2013 6:59 pm

just received my camera module... would love to know the answer to this one too. I'll give a try tonight, I already have openCV loaded that works (slowly!) with a USB webcam.

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1440
Joined: Sat Sep 10, 2011 11:43 am

Re: OpenCV with new camera module?

Fri May 17, 2013 6:20 am

Not yet, although people have been able to do stuff using files instead

V4L drivers in the pipeline...

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

Quasim0ndo
Posts: 14
Joined: Fri May 17, 2013 1:43 pm

Re: OpenCV with new camera module?

Sat May 18, 2013 11:28 am

Sorry for the stupid question - but does this mean that without those drivers there is no way to use the camera as an input for opencv's CaptureFromCAM and we just have to wait?

Quasim0ndo
Posts: 14
Joined: Fri May 17, 2013 1:43 pm

Re: OpenCV with new camera module?

Sun May 19, 2013 2:14 pm

The way I'm currently handling it is:

Code: Select all

call (["raspistill -t 50 -n -o temp.jpg -w 640 -h 480" ], shell=True )
img = cv.LoadImage("temp.jpg")
Not sure if there is a more elegant or direct way to do it (except for using stdout to skip the temp file)

eckythump
Posts: 14
Joined: Thu May 16, 2013 2:21 pm

Re: OpenCV with new camera module?

Mon May 20, 2013 4:52 pm

Quasim0ndo wrote:The way I'm currently handling it is:

Code: Select all

call (["raspistill -t 50 -n -o temp.jpg -w 640 -h 480" ], shell=True )
img = cv.LoadImage("temp.jpg")
Not sure if there is a more elegant or direct way to do it (except for using stdout to skip the temp file)
looks like a reasonable way, in the absence of capturefromcam.

Code: Select all

from subprocess import call
import time
t = time.time()
call (["raspistill -t 5 -o a.jpg"], shell = True)
tt = time.time() - t
print tt
this gives a time of just over 1 second (for 1 frame). The -n option doesn't seem to work with my system, looks like others are having this problem too judging by the forum. Presumably a lot of this time is 'warmup' to get light balance etc. It takes about 2 seconds if I take another picture within the same script, so it is going through the process again. Is there a way to minimise this 'warmup' time, or get it to just do it once at the start of the script? The applications I want to run eventually need at least 5 fps with processing in OpenCV too between frames.

poing
Posts: 1131
Joined: Thu Mar 08, 2012 3:32 pm

Re: OpenCV with new camera module?

Mon May 20, 2013 5:46 pm

i think you need timelapse for that as this point.

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

Re: OpenCV with new camera module?

Mon May 20, 2013 6:50 pm

eckythump wrote:
Quasim0ndo wrote:The way I'm currently handling it is:

Code: Select all

call (["raspistill -t 50 -n -o temp.jpg -w 640 -h 480" ], shell=True )
img = cv.LoadImage("temp.jpg")
Not sure if there is a more elegant or direct way to do it (except for using stdout to skip the temp file)
looks like a reasonable way, in the absence of capturefromcam.

Code: Select all

from subprocess import call
import time
t = time.time()
call (["raspistill -t 5 -o a.jpg"], shell = True)
tt = time.time() - t
print tt
this gives a time of just over 1 second (for 1 frame). The -n option doesn't seem to work with my system, looks like others are having this problem too judging by the forum. Presumably a lot of this time is 'warmup' to get light balance etc. It takes about 2 seconds if I take another picture within the same script, so it is going through the process again. Is there a way to minimise this 'warmup' time, or get it to just do it once at the start of the script? The applications I want to run eventually need at least 5 fps with processing in OpenCV too between frames.
The apps are really intended as demo code for people to them modify to their own purposes. You could run at a lower res than full and use timelapse mode to get something like your requirements, but you may need to put the effort in and write your own app.

-n should be fixed in the next release, or you can rebuild the code with the fix as provided elsewhere.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Quasim0ndo
Posts: 14
Joined: Fri May 17, 2013 1:43 pm

Re: OpenCV with new camera module?

Mon May 20, 2013 8:28 pm

eckythump wrote: this gives a time of just over 1 second (for 1 frame). The -n option doesn't seem to work with my system, looks like others are having this problem too judging by the forum.
I've replaced my raspistill with the binary offered in this thread and -n works fine for me now:
http://www.raspberrypi.org/phpBB3/viewt ... 43&t=43990

ucola
Posts: 17
Joined: Tue May 22, 2012 7:54 pm

Re: OpenCV with new camera module?

Thu Jun 06, 2013 2:46 pm

hi all

any news about the V4L driver?

regards

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

Re: OpenCV with new camera module?

Thu Jun 06, 2013 3:42 pm

ucola wrote:hi all

any news about the V4L driver?

regards
In progress; it's a big job so I wouldn't be expecting solid anything for a few weeks.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

adayforgotten
Posts: 17
Joined: Wed Aug 01, 2012 5:23 pm

Re: OpenCV with new camera module?

Thu Nov 14, 2013 2:20 pm

Been a few months since the last post here, any update on the status of V4L?

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1440
Joined: Sat Sep 10, 2011 11:43 am

Re: OpenCV with new camera module?

Thu Nov 14, 2013 2:25 pm

Actually we've been working away on a proper V4L2 kernel driver for the Raspberry Pi camera and it's getting very close now... Just had to make some changes because we've moved to the 3.10 kernel but keep an eye out for a release soon...

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

eckythump
Posts: 14
Joined: Thu May 16, 2013 2:21 pm

Re: OpenCV with new camera module?

Mon Nov 18, 2013 10:24 am

sounds very interesting! I will keep my eye out for that.

Am I right in thinking that once the proper V4L driver is ready, the CSI camera will more or less just work in the same way as a webcam currently does on the pi, but will also be getting the maximum hardware speedup via the gpu etc?

Return to “Camera board”