| The Following User Says Thank You to qole For This Useful Post: | ||
|
|
2008-04-16
, 03:27
|
|
|
Moderator |
Posts: 7,109 |
Thanked: 8,820 times |
Joined on Oct 2007
@ Vancouver, BC, Canada
|
#32
|
|
|
2008-04-16
, 16:09
|
|
|
Posts: 4,930 |
Thanked: 2,272 times |
Joined on Oct 2007
|
#33
|
Step 2: Use mplayer to extract the pictures you just took to JPEG images.
Code:mplayer /media/mmc1/pics.avi -ov jpeg:quality=100:outdir=/media/mmc1/
mplayer -cache 512 tv:// -tv driver=v4l2:width=640:height=480:noaudio -fps 15 -endpos 0.5 -ov jpeg:quality=100:outdir=/media/mmc1/
|
|
2008-04-16
, 18:26
|
|
|
Moderator |
Posts: 7,109 |
Thanked: 8,820 times |
Joined on Oct 2007
@ Vancouver, BC, Canada
|
#34
|
Dumping them to JPEG is bad; lossy compression before averaging means that during the compression, some information is lost to preserve the most visually significant information; as SNR goes down, you wind up losing more of the signal and keeping more of the noise.
mplayer pics.avi -vo png:z=0
Have you found a way to median-filter the images with imagemagick? I looked a little, and didn't see anything, but I'm sure it's possible.
convert *.png -average -median <radius> final.jpg
Oh, and it occurs to me; can't mplayer directly view the stream? Something like:
I think that should do what you're doing now with steps 1 and 2, and (using pnm instead of jpeg, at least) might be a hair faster/less cpu intensive/less susceptible to trouble from other processes.Code:mplayer -cache 512 tv:// -tv driver=v4l2:width=640:height=480:noaudio -fps 15 -endpos 0.5 -ov jpeg:quality=100:outdir=/media/mmc1/
Why 512kB cache? Can it not keep up at 15 fps with no compression? (I assume 512kB is the amount 0.5s of video takes up, or a bit more?)
Why 15 fps? Is that the maximum you can get from the camera at 640x480? I was hoping to get about 24/30 fps, so that 4 images would be about 1/8 of a second.
And, a suggestion, using -frames 8 instead of -endpos 0.5, you'd remove the framerate dependence, which makes it easier for you or anyone else to fiddle with mplayer and/or mencoder settings without changing other parts of their script.
|
|
2008-04-16
, 18:36
|
|
|
Moderator |
Posts: 7,109 |
Thanked: 8,820 times |
Joined on Oct 2007
@ Vancouver, BC, Canada
|
#35
|
|
|
2008-04-16
, 19:04
|
|
|
Moderator |
Posts: 7,109 |
Thanked: 8,820 times |
Joined on Oct 2007
@ Vancouver, BC, Canada
|
#36
|

|
|
2008-04-16
, 19:21
|
|
Posts: 356 |
Thanked: 231 times |
Joined on Oct 2007
|
#37
|
|
|
2008-04-16
, 19:25
|
|
|
Posts: 4,930 |
Thanked: 2,272 times |
Joined on Oct 2007
|
#38
|

Yes, just use:
EDIT: It looks like that just does a blur on the picture. Not terribly useful. What is "median filter"?Code:convert *.png -average -median <radius> final.jpg
I figured that mencoder's native format is uncompressed AVI, and so it has been optimized for that format. Dumping all the frames into a single uncompressed file strikes me as the most likely way to minimize CPU use. I doubt that writing a separate image file for each frame would be faster. For instance, the mplayer frame extraction command I give above (to png files) is nowhere near real time speed. Please experiment with other techniques.
This number, however, is not arbitrary. I found that 640x480 15fps is pretty much the highest attainable number, and I'm not even sure that it really is hitting that speed. I was able to get better framerates if I used a smaller frame size, but that's not useful in this context. Again, I welcome input here; I want to be proven wrong!
|
|
2008-04-16
, 19:47
|
|
|
Posts: 4,930 |
Thanked: 2,272 times |
Joined on Oct 2007
|
#39
|
Ok, a question for Benson. I found a maemo repository with netpbm libraries available. How would I accomplish the stuff you're talking about with netpbm? Also, is there another, better source for the netpbm binaries?
|
|
2008-04-16
, 19:53
|
|
|
Moderator |
Posts: 7,109 |
Thanked: 8,820 times |
Joined on Oct 2007
@ Vancouver, BC, Canada
|
#40
|
Step 1: Capture the images with mencoder. You should have a moment to position your camera after pressing "enter" on the following command. Then hold your tablet as still as possible for about 30 secs. The more movement, the blurrier your final pic will be.