Shop OBEX P1 Docs P2 Docs Learn Events
PropCam and uOLED 128 G2: How to display gray-scale image? — Parallax Forums

PropCam and uOLED 128 G2: How to display gray-scale image?

The autumn darkness has finally dragged me into my hobby corner... and here I find an old friend PropCam and a new friend uOLED 128 G2...

Both of them are working independently with a Propeller Activity Board, I was even able to save a BMP-file from the PropCam to a SD-card.

Has anyone tried to capture an image with PropCam and show it on the uOLED?
I've tried to understand how to format the gray-scale image data to show it on the display, but so far been unsuccessful.

I SPIN a bit and C even better :smile:

Comments

  • banjobanjo Posts: 447
    edited 2015-11-12 20:04
    At least now one person has done this (= me), i.e. capturing an image with PropCam and showing it on the uOLED.
    The frame rate is...well...not so impressive, roughly 10-15 seconds per image. The main reason is that I'm drawing pixel by pixel with the uOLED's putPixel-method. I've also tried with the image-method where the frame rate is much better, but I've not been successful in getting the colors correct.

    When drawing pixel by pixel I'm using below Spin-code...
      repeat i from 4 to 6147
          HIby := (vBMP_image[i] >>4) * f                         ' where HIby means the 4 high bits from the PropCam picture and f=512
          LED.putPixel(x,y, LED.RGB(HIby, HIby, HIby))
          LED.putPixel(x+1,y, LED.RGB(HIby, HIby, HIby))
          x:=x+2
          if x>127
            x:=0
            y:=y+1
    
    ...and when using the image-method I've tried below code that changes the colors of every pixel similarly as in the above code
       repeat i from 4 to 6147
          HIby := (vBMP_image[i] >>4) * f
          vBMP_image[i] := LED.RGB(HIby, HIby, HIby)  
          LED.image(0,0,96,64,0,@vBMP_image)                ''Display captured image
    
    I expected that the end result would be similar with both methods, but as said the colors are distorted with the image-method. I get the impression (perhaps incorrect so) that the color mapping is different between putPixel and image methods. I'll try to post a picture later to show what I mean.
    I'm only using the 4 high bits from the PropCam picture, by using the 4 low bits I only got confused as the 2-color picture captured by PropCam turned into a too colorful picture.

    Would appreciate any input or thoughts on the two above issues.
    3264 x 2448 - 563K
  • Attached a picture from the distorted picture where the above mentioned image-method was used
    1632 x 1224 - 333K
  • Ok, FWIW I was able to modify the uOLED-driver made by Beau Schwabe so the image-method accepts a 4-bit BMP image. Learned a lot of how to handle bits with Spin at the same time.
    In addition I'm transferring the PropCam image between two ActivityBoards through XBee HP.
    After cleaning up and optimizing the code, I'll try to increase from the default 9600 baud so I could get improve the FPS.
    Last time I changed the baud-settings from 9600 baud, I was able to get the two XBee HP-adapters to connect to each other, but transferring 7Kb of data did not succeed for whatever reasons even if the distance was a mere 2 meters.
    I probably need to put in some error checking method one way or another, seems there are more things to learn.

    I'm not asking for any help right now as I've achieved the minimum goal (transfer a PropCam-image between two Propellers through XBee), but ideas and comments are of course appreciated
Sign In or Register to comment.