I have a live video feed that I would like to convert into raw numbers that could be used for a variety of different things. I would also like to do simple operations on these numbers live with as little latency as possible.
So essentially, I get a Dynamic matrix of numbers that, are in byte form (0 to 255). To make it easier, I greyscaled it, so that there is only one data point per pixel. Assuming the matrix is 360 X 240, whenever I try to
Take from this dynamic matrix, I get an error message.
How do I use specified pieces of the matrix to define some output on this data? In other words, lets say I want to cut the video up into 18X12 blocks so that I can operate on just just that section of the live matrix video feed, how can I use
Take to do this? I assume there is some function that is not
Take for this.
For my specific project, I need to divide each pixel in this raw matrix data by 2 so that the data fits in the parameters 0 to 127 instead of 0 to 255, what is the most efficient way to calculate this live stream so that there is as little latency as possible? Would I use
TrackSymbols? Or is there some other way to operate on a dynamic matrix?
Any help on solutions to these two problems is greatly appreciated. And a warm smile goes to you for helping out a lone wolf amateur programmer like myself.
Sample data can be generated from any webcam with the following code, thanks to help from Andy:
img = Dynamic[ColorConvert[CurrentImage, "Grayscale"]]; rawimg = Dynamic[Flatten[ImageData[img[], "Byte"][[1 ;; 18, 1 ;; 12]]]]
I then want to turn this information into one DYNAMIC digit that is between 0 and 126. by dynamically taking the Mean of all the numbers in the list and dividing this number by two (and using the floor of the answer). So the input is a large matrix and the output is just a single number like "122".