Take a dirty picture for me
Posted 27 July 2012 - 11:47 AM
Posted 28 July 2012 - 01:48 PM
sorry, the topic is not going to be that interesting.
I've got my NP hooked up to a serial camera and i want to take a pic and then push it on a webserver.
By the looks of it im getting a outofmemory exception. Is there any efficient way of do this with out using lots of memory?
Is the camera data compressed into JPEG or is it full-frame RGB/YUV pixel data? Either way, image resolution of most cameras these days will exceed the runtime RAM of the Netduino. To test the full functionality of your project(i.e. take pic, get data from camera, post to webserver), try and set the camera to its lowest resolution if possible.
If you don't have those kind of configuration options for your camera, you'll have to go the whole-hog from the beggining. Adopt a block-data processing model. Take the picture and read small amounts of data from the camera at a time. You'll have to send or store(SD card) that data then leave it for the GC to pick up or force the GC to free the memory. Read the next block of data, rinse and repeat.
Are you using a POST method to a web URL? If so, you can define the Content-Length HTTP header property before you stream the data to the webserver(only if you know the datasize of the image before-hand). This will allow you to block process the data, as long as you don't exceed the webserver's timeout. If you can't determine the size of the pic data before you read it from the camera, stream it to a file on an SD card in the Netduino and then read the file-size.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users