Frame Differecning help using matrices and pixels

23 views (last 30 days)
I created a frame differencing script that compares frames, but I need help on printing the frames that my script is finding to be different across frames.
I just want to print the values of those pixels are are effected. Right now I have it set up so those frames that are different, they are colored red, but I am not sure on how to print those values.

Answers (1)

Walter Roberson
Walter Roberson on 15 May 2021
Replace
temp = im2gray(temp);
temp2 = frames(:,:,:,l + 1);
temp2 = im2gray(temp2);
with
temp = double(im2gray(temp));
temp2 = frames(:,:,:,l + 1);
temp2 = double(im2gray(temp2));
Replace
temp3(w, h) = 255; 255;
with
temp3(w, h,:) = [255, 0, 0];
Note: if the difference is less than 30 then the pixel will be left the original color.
  2 Comments
Jair Gonzalez
Jair Gonzalez on 15 May 2021
thanks, I made updates to my file. This made my script to have a weird flickering effect and also I am unable to get a print out of the pixels that are being differentiated
Image Analyst
Image Analyst on 15 May 2021
Attach your new, updated code. Do you still get the flickering if you use the standard rhinos.avi video that ships with MATLAB? If tens of thousands of pixels change from one frame to the next, why do you want to print them all out? And what do you want printed? The row, column, red value, green value, and blue value? So, for 10 thousand changed pixels you'd print out 50 thousand numbers. Are you sure that's what you want? Are you actually going to look at all of them or not?
See my attached demo where I do frame differencing.

Sign in to comment.

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!