Finding sumpixel value (in graph) for a video which has 514 frames.

1 view (last 30 days)
I have a video for detecting fire which consist of 514 frames. I need to get all frame's sumpixel value in graph. How can i get the sumpixel values of all frame in 1 graph? The picture is the coding that i have but it only gives particular frame.

Answers (1)

Pratyush Roy
Pratyush Roy on 29 Oct 2020
Hi Thakif,
Appending the sumpixel value for every frame in an empty array using for loop and plotting the array outside the loop might be helpful.
The code snippet for obtaining the plot is given below:
clc
clear all;
close all hidden;
arr = [];
for i=1:frameNum % Here frameNum refers to the total number of video frames
Im1 = imread('path-to-ith-frame');
rchannel =Im1(:,:,1);
gchannel =Im1(:,:,2);
bchannel =Im1(:,:,3);
sumpixelg = sum(gchannel);
arr = [arr;sumpixelg];
end
plot(arr');
Hope this helps!
Regards,
Pratyush.

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!