Streaming faster


I thought of adding a new “mode” that allows me to stream the image and tracking information at a speed that make sense. For this I need to bring the frame-rate somewhere at least 4 FPS when streaming QVGA data.

First, I “trimmed” the frame to fit in 256 x 240 instead of 320 x 240 which brought down the size of the image to 60 Kbytes from 75 Kbytes (about 20% cut). Also, I was streaming 2 bytes per pixels (RGB444) which means about 150 Kbytes and now I changed this to 4 bytes per pixels, somewhere around 30 Kbytes. decided also to skip every other pixel, so now I should be able to stream all in only 15 Kbytes, about 10 times less data while still keeping the resolution @ 256 x 240 pixels.

 I am able now to stream @ 4 FPS @ 256 x 240 and @ 10 FPS @ 128 x 120 over serial port from LPC1769Xpresso using Processing.

void draw() {	
  myPort.write("Bw");
  while (myPort.available() > 0){
    byte[] inBuffer = new byte[H*(W/4+1)+2];
    myPort.readBytes(inBuffer);
    if ((inBuffer != null) && (inBuffer[1] == 0)){
      for (y=0;y<H;y++){
        for (x=0;x<(W/4);x++){
          noStroke();
          pixel1= inBuffer[y*(W/4)+x+3];

          fill(pixel1 & 0xF0);
          rect((x*4)*m, y*m, m*2, m);
          fill((pixel1 & 0x0F)<<4);          
          rect((x*4+2)*m, y*m, m*2, m);
        }
      }
    }
    myPort.clear();
  }
}

On a side note, 256 is only 1 byte length, so using numbers bellow 256 will allow me to save memory and data sent over serial port. Will still handle 320 x 240 resolutions, but will have another “mode” that create a “windowed” image of only 256 x 240 pixels for practical purposes.

Advertisements

6 thoughts on “Streaming faster

  1. i have a board,and When i turn on it ,LCD’s of board shows camera data and frames,that board include lcd , ethernet port,and rs232 , peroccesor = arm
    i programmed arm to send camera data to rs232 and pc’s com.i wana to shows camera data to my application in pc.
    sorry,i can’t writing english well.

    • Unfortunately not sure how I can help, anyway, I take it that your board is streaming the data out and you just want to be able to display the images on your PC, right?
      First you need to know how to communicate with the board and the format of the data sent out from your board, something you need to check with who made the board.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s