Shop OBEX P1 Docs P2 Docs Learn Events
PropCAM Browser-centric Image-capture Monitor — Parallax Forums

PropCAM Browser-centric Image-capture Monitor

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2014-04-01 13:02 in Propeller 1
In another thread, a question was asked about how to view the captured images of the PropCAM if you don't have an NTSC monitor. That got me thinking about a way to view the images in a web browser, without requiring, say, a Spinneret. The result is the attached server program. It runs under Windows, but I've included the Perl source code for those who might want to modify it for OS/X or Linux. The attached Spin archive includes the monitor object that responds to polling from the PC and transmits pixels over the serial port at 115200 baud. Ideally, this will result in an almost 2fps update rate in the browser window, but the reality is a bit slower than that.

When started, the server program launches a clean browser window and searches for a serial port running the Spin monitor program. When it finds one, it begins accepting requests from the browser, displaying the first image in snapshot mode:

attachment.php?attachmentid=107899&d=1396382233

You can change back and forth between Video mode and Snapshot mode using the onscreen buttons. When finished, the Quit button will stop the server.

You can also save any image by right-clicking on it and doing a "Save image as ..." to your PC in GIF format. The image shown on the screen is 3x actual size (i.e. 384 x 288 pixels). The image saved is actual size (128 x 96 pixels).

The URL used by the server is localhost:3456. The server will not accept connections from other computers on the network. To do so effectively would have required a multi-threaded Perl script, and I wanted to keep things as simple as possible.

The Spin demo is written for the Propeller Backpack, but it is easily modified to accommodate other Propeller modules. Just change the clock mode and pin assignments.

-Phil

Comments

  • Phil,

    I am trying to get the images to be saved on an SD card as a jpg and am having no success. Is there a certain way I need to use the sd card popen and pputs commands and it not be designated as text?

    Thanks,

    HANC
  • Try right-clicking on the image and do a Save As ... (Not sure this will work, since I don't have this program running right now, so please let me know if it helps.)

    -Phil
  • Phil,

    Thanks for the response. I was meaning getting the picture out of the buffer onto the SD card.

    HANC
  • hanchome wrote:
    I was meaning getting the picture out of the buffer onto the SD card.
    Unfortunately, there's nothing built into the monitor program that will do that.

    However, if you're referring to the buffer in the Propeller RAM, I do have an object that will produce a BMP header for it. It's included in the attached program written for the Spinneret to send PropCAM images over the internet. You can replace the srv object with one of your own that writes to the SD card. You will have to remove the part of the BMP header object that prepends the HTTP header, though, but that should be pretty easy.

    This code cannot be used to create a JPG file. That's a lot more complicated and really unnecessary for such small images as the PropCAM produces. BMP files are about the simplest there are.

    Good luck!
    -Phil
Sign In or Register to comment.