cmucam3-hardware (#1) - Sliding Window (#182) - Message List

Sliding Window

I developed a kind of knew histogram based motion detection algorithm. It is working fine in MATLAB. Now, I want to implement it on the camera. I would like to have a sliding window (let's say 11x11 pixel) sliding over two consecutive frames within the buffer and reading the pixels into the RAM. In particular, it reads 11x11 pixels from the last image of the FIFO and should then jump to the second last image in the FIFO and grab the corresponding 11x11 pixels. After reading these two pixel boxes into the RAM, I calculate some features and go back into the FIFO in order to grab the next 11x11 pixels of the last and second last image stored in the FIFO. This goes on until I processed both images.

Now my questions. How can I read only certain parts (my 11x11 pixels) into the RAM and how can I jump between consecutive frames that are stored in the FIFO.

I would appreciate any kinds of comments and help.

  • Message #495

    I would do this in a scanline fashion. This is how the jpeg example works. It loads 8 full rows and then processes the 8x8 blocks in each row. You can load 11x11 chunks from the FIFO, but there will be a rather large performance penalty since it would constantly rewind and seek through the data. You can fit 11 rows of the image in RAM, so this shouldn't be a problem.

    • Message #499

      I understand the way you are describing. However, I call cc3_pixbuf_load() for the initial image from which I need 11x11 pixels. Then, I call again cc3_pixbuf_load() for the next image where I need the corresponding 11x11 chunks. With these 2 blocks I calculate some similarity features and store basically one similarity value for this block. After this calculation, I need to get back to the first of the two images in order to process the next 11x11 pixel block. Since I already called cc3_pixbuf_load() twice, I am not sure if it is possible to get back to the initial image by simply calling cc3_pixbuf_rewind() twice.

      • Message #500

        You would need to process the entire first frame before loading the second frame. It might be possible to load two low resolution frames into the FIFO, but it would require modifying the cc3 hardware abstraction layer (hal). You would need to ignore the first frame stop and catch the second one. Then you would need to change the pixel accessing code to deal with the offset into the second image. It will likely be quite complicated to get right.