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

2 次查看(过去 30 天)
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.

回答(1 个)

Pratyush Roy
Pratyush Roy 2020-10-29
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.

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by