Shop OBEX P1 Docs P2 Docs Learn Events
Sending a JPEG compressed video frame — Parallax Forums

Sending a JPEG compressed video frame

charleyshfcharleyshf Posts: 165
edited 2011-12-11 03:06 in Propeller 1
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..

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-12-10 12:44
    I'm still not sure what you're really asking.

    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.
  • MagIO2MagIO2 Posts: 2,243
    edited 2011-12-10 12:50
    What I understand is that there is no need to buffer it at all! The communication between propeller and PC is much faster than the one between propeller and camera. So you only need a ring buffer with a size of 2 bytes and have one COG sending while another one receives.
  • charleyshfcharleyshf Posts: 165
    edited 2011-12-11 03:06
    Thanks guys for the responces. After going through the forums over at surveyor corp it looks like for what I want to do with the prop and the blackfin camera(the image is actually under 4kb), I would either have to use an SD card with fsrw and save the image to the SD card, or come up with some sort of jpeg de-compressor to run on my windows pc and feed the data directly to that. I think the easier way to go here is to use a serial mux/demux and just have the prop switch the camera off to the lantronix matchport and then I just can either use a web browser to view the image from the blackfin camera, or even use other software from surveyor for debugging issues. I think something like this would work out okay:
    http://www.sparkfun.com/products/9907
Sign In or Register to comment.