Mzk
Mzk

Reputation: 1120

Processing previous and current frame continuously

Basically,

  1. I have set a reference line at particular place of the image say at height/2
  2. I calculate the total white pixel at that line

The frame keep going continuously. Then, how can I read/get back the value of total white pixel from previous frame and current frame continuously?

Thanks.

Upvotes: 0

Views: 353

Answers (1)

Eran W
Eran W

Reputation: 1776

you need to hold a member with the prev value.
assuming readPixel() function reads the total white value, curr is the current value, and prev is the previous value. this is example pseudo-code:

prev = curr = readPixel; //avoid division by zero
for(;;)
{
    curr = readPixel();
    value = curr / prev;
    prev = curr;
}

Upvotes: 1

Related Questions