what is the purpose of this line of Kalman filter coding

5 views (last 30 days)
hello
why we need the following line of kalman filter code, could any person provide me with clear Demo
diffimg = (abs(imcurrent(:,:,1 )-imbkg(:,:,1))>th)| (abs(imcurrent(:,:,2)-imbkg(:,:,2))>th)| (abs(imcurrent(:,:,3)-imbkg(:,:,3))>th);

Accepted Answer

Walter Roberson
Walter Roberson on 1 Aug 2015
imcurrent(:,:,1 )-imbkg(:,:,1) calculates the difference in red component (pane #1) values between the current image and the background image. abs() of that gives the absolute difference. So 0 when the pixels are identical and increasing difference as the component values get further apart. Comparing that with "> th" returns a logical array of the locations where the difference is more than the threshold value.
The same comparison is done for the green component (pane #2) and the blue component (pane #3), each time calculating a logical array of the locations where the differences are more than the threshold.
Then all three logical arrays are "or"'d together. The result is true if any of the color components of a particular location differ "enough" between the current and background image.
That's what the code does, figures out where the images are significantly different. Why it does that I do not know as I do not have that toolbox to examine the source.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!