cmucam3-hardware (#1) - Store a gray-level pic in ram (#217) - Message List

Store a gray-level pic in ram

Hello,

I'm using the virtual cmucam3 for object detection. For convenience I have developped my program with the virtual cmucam, and it works very good, but if I run it on the real cmucam, it doesn't work: "core dumped"

The problem is that I need to use a pointer on uint8_t aiming to stock a gray-level picture (144*176 pixels) Is there a way to stock each gray pixel (uint8_t) without print a file in MMC or should I compress more my gray-level picture :-\ ?

Thank for your answers

  • Message #541

    Just for debugging, I would try going with a lower resolution image. If you don't care about speed using the MMC card could work, or rewinding the FIFO and processing the image again might be faster.

    • Message #557

      Hello, My problem is solved: I have created a structure "image" containing 4 pointers on integer.

      typedef struct {

      uint8_t * tabImage0; uint8_t * tabImage1; uint8_t * tabImage2; uint8_t * tabImage3;

      } image;

      ...I can now create a "image", without forgetting to malloc the 4 fiels of my splited "image"

      tabImage0=malloc((size_xImage)*(size_yImage)*sizeof(uint8_t)); tabImage1=malloc((size_xImage)*(size_yImage)*sizeof(uint8_t)); tabImage2=malloc((size_xImage)*(size_yImage)*sizeof(uint8_t)); tabImage3=malloc((size_xImage)*(size_yImage)*sizeof(uint8_t));

      Finally, I create readPixel and writePixel fonctions...

      uint8_t readPix (uint16_t x, uint16_t y,image img);

      void writePix (uint16_t x, uint16_t y, uint8_t value,image img);

      And voila: I have a low-res image fully stored in RAM, ready for image processing...

      But...I dont' understand why must I split the image in 4 fields? (I've tried with one pointer but it doesn't work). And I'm sure that there is a cleaner (and faster) way to do the same thing...(Store a full pic in the Cmu ram)