Sending a JPEG compressed video frame
charleyshf
Posts: 165
Hello,
I've been working with the prop and a Blackfin Camera module from here: http://www.surveyor.com/blackfin/ for quite some time now and the only thing I am trying to resolve is how to get a compressed jpeg frame from the prop to my pc. The image is 160x120 and I was told that the size would be around ~4kb. From the docs on the Blackfin camera:
'I' = grab JPEG compressed video frame
x = frame size in pixels:
1 = 80x64, 3 = 160x120, 5 = 320x240, 7 = 640x480, 9 = 1280x1024
s0s1s2s3=frame size in bytes (s0 * 256^0 + s1 * 256^1 + s2 * 256^2 + s3 * 256^3)
.... = full JPEG frame
Note that sometimes the 'I' command returns nothing if the robot camera is busy, so the 'I' command should be called as many times as needed until a frame is returned
So I would have to strip off or ignore the first few bytes (the ##IMGxs0s1s2s3), but then I am not sure if it would be more effective to save it to a file on the SD card before it sends it to the pc? I am not looking for speed, rather when I need to debug it would really help if I could see what the camera is seeing on my pc. The prop talks to the Blackfin camera at 38,400 baud and then I have a Lantronix Matchport connected to the prop that sends information wirelessly to my pc at 115,200 baud (on my windows pc I have a program from Lantronix that enables a virtual serial port so that I can receive information from the Matchport)
Am I better off saving the information to a file on an SD card hooked up to the prop or should I be able to do this without using a SD card?
I'd appreciate any input..
I've been working with the prop and a Blackfin Camera module from here: http://www.surveyor.com/blackfin/ for quite some time now and the only thing I am trying to resolve is how to get a compressed jpeg frame from the prop to my pc. The image is 160x120 and I was told that the size would be around ~4kb. From the docs on the Blackfin camera:
'I' = grab JPEG compressed video frame
x = frame size in pixels:
1 = 80x64, 3 = 160x120, 5 = 320x240, 7 = 640x480, 9 = 1280x1024
s0s1s2s3=frame size in bytes (s0 * 256^0 + s1 * 256^1 + s2 * 256^2 + s3 * 256^3)
.... = full JPEG frame
Note that sometimes the 'I' command returns nothing if the robot camera is busy, so the 'I' command should be called as many times as needed until a frame is returned
So I would have to strip off or ignore the first few bytes (the ##IMGxs0s1s2s3), but then I am not sure if it would be more effective to save it to a file on the SD card before it sends it to the pc? I am not looking for speed, rather when I need to debug it would really help if I could see what the camera is seeing on my pc. The prop talks to the Blackfin camera at 38,400 baud and then I have a Lantronix Matchport connected to the prop that sends information wirelessly to my pc at 115,200 baud (on my windows pc I have a program from Lantronix that enables a virtual serial port so that I can receive information from the Matchport)
Am I better off saving the information to a file on an SD card hooked up to the prop or should I be able to do this without using a SD card?
I'd appreciate any input..
Comments
What's the maximum size of the JPEG image? If it's a mostly incompressible image, it could be quite large. With 3 bytes per pixel, you're talking about 60K of raw image data which would be hard to fit in hub memory. That would be very unusual. If you've really got a limit of around 4K, you should be able to just buffer the image and send it to the PC that way without saving it a PC card first.
http://www.sparkfun.com/products/9907