Hello,
I'm trying to do some analysis on a movie using openCV. I'm using opencv.absDiff() to generate an image that contains differences from a reference frame, and I want to sum the differences (ie, all the pixels that are not black) and tally them frame by frame to measure the change over time (if that makes sense!).
I'm struggling to find the correct syntax to actually get a hold of the pixels in the difference image. Here's an edit of what I'm trying:
Quote: opencv.image().loadPixels();
for (int i = 0; i < numPixels; i++) { // For each pixel in the video frame...
color currColor = opencv.image().pixels[i];
// Extract the red, green, and blue components from current pixel
int currR = (currColor >> 16) & 0xFF; // Like red(), but faster
int currG = (currColor >> 8) & 0xFF;
int currB = currColor & 0xFF;
}
The bit that seems to not work properly is the
Quote: color currColor = opencv.image().pixels[i];
although, to be fair, it does seem to work but it's astonishingly slow. I know there is an opencv.pixels() function, but I don't know how to use it. Can anyone help me with this?
Thanks in advance for any advice.