Open GoogleCodeExporter opened 9 years ago
Did some buffer code, but get an error " Huffman table 0x00 was not defined"
Code is:
--
if not buffer:
buffer = self.buffer
if p == 'MJPG':
f = file(filename, 'wb')
f.write(buffer)
f.close()
else:
img = PILImage.frombuffer('RGB',
(self.format.width, self.format.height),
buffer,
'raw',
p,
0,
1)
img.save(filename, 'jpeg', quality = q)
--
Start of the 'JPEG' file looks like:
--
simon@bourne:~/pyv4l/python-video4linux2-local-changes$ hexdump -C
pics/000000000.jpg
| head
00000000 ff d8 ff e0 00 21 41 56 49 31 00 01 01 01 00 78 |.....!AVI1.....x|
00000010 00 78 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |.x..............|
00000020 00 00 00 00 00 ff db 00 43 00 04 02 03 03 03 02 |........C.......|
00000030 04 03 03 03 04 04 04 04 06 0a 06 06 05 05 06 0c |................|
00000040 08 09 07 0a 0e 0c 0f 0f 0e 0c 0e 0f 10 12 17 13 |................|
00000050 10 11 15 11 0d 0e 14 1a 14 15 17 18 19 1a 19 0f |................|
00000060 13 1c 1e 1c 19 1e 17 19 19 18 ff db 00 43 01 04 |.............C..|
00000070 04 04 06 05 06 0b 06 06 0b 18 10 0e 10 18 18 18 |................|
00000080 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 |................|
*
--
Original comment by mungew...@gmail.com
on 2 Feb 2009 at 11:23
it looks like VLC can play these 'jpeg' files!
Confirms that the system is actually capturing the image OK.
Mungewell.
Original comment by mungew...@gmail.com
on 3 Feb 2009 at 12:02
Helpful comments in uvcvideo driver source
--
Please note that the MJPEG data have been stripped from their
Huffman tables (DHT marker), you will need to add it back if your JPEG
codec can't handle MJPEG data.
--
Why strip it in the first place?
Original comment by mungew...@gmail.com
on 4 Feb 2009 at 4:53
Python utils to convert MJPEG -> JPEG:
https://svn.berlios.de/viewvc/linux-uvc/uvc-utils/trunk/mjpeg2jpeg.py?view=marku
p
Is this worth including within pyv4l2.py?
Original comment by mungew...@gmail.com
on 4 Feb 2009 at 5:55
Patch was actually simple to do.
Original comment by mungew...@gmail.com
on 4 Feb 2009 at 6:43
Attachments:
Better patch attached. This allows for the user's app to get at the V4L2
capture as a
PIL image via the 'CaptureImage()' call.
This should make it easier to bring the image into an app without having to
place a
file on to disk.
Original comment by mungew...@gmail.com
on 5 Feb 2009 at 5:15
Attachments:
Original issue reported on code.google.com by
mungew...@gmail.com
on 2 Feb 2009 at 7:10Attachments: