I am playing a video file. In the video there are lot's flicker. In first step, I would like to make a detection for flicker frame and later on I would like to remove them as well.
Below is my code snippet. I need a algo for frame with noise detection.
%% Record video - VideoPlayer
clearvars
close all
clc
%%
filename = 'Trim.mp4'; % video to load
wb = waitbar(0,'Loading the file...'); % show progress bar
v = VideoReader(filename); % create VideoReader object
w = v.Width; % get width
h = v.Height; % get height
d = v.Duration; % get duration
s = struct('cdata',zeros(h,w,3,'uint8'),'colormap',[]); % struct to hold frames
k = 1; % initialize counter
NFrames = v.FrameRate*v.Duration % Number of frames
while hasFrame(v) % while object has frame
f = readFrame(v); % read the frame
s(k).cdata = f; % = imrotate(f,90); % rotate frame as needed
k = k + 1; % increment counter
waitbar(v.CurrentTime/d) % update progress bar
end
v.CurrentTime = 13; % set current time
f = readFrame(v); % get the frame
close(wb) % close progress bar
axes % create axes
imshow(f) % show the frame
title('Trim.mp4') % add title
I want to understand the under which condition reported frames and frame rate are different.
How to get the histogram for good vs bad frames.
Any help here ?
Thank you!

 採用された回答

Image Analyst
Image Analyst 2020 年 3 月 11 日

1 投票

In the loop, I'd get the mean into an array. Then I'd use some kind of outlier detection code to find peaks in the mean signal. Not step changes which indicate scene changes, but sharp peaks or valleys.

6 件のコメント

Life is Wonderful
Life is Wonderful 2020 年 3 月 11 日
編集済み: Life is Wonderful 2020 年 3 月 11 日
You mean
  • mean(s(k).cdata)
  • max_pks = find(imregionalmax(mean(s(k).cdata))) % get max-pks in mean signal
  • min_pks = find(imregionalmin(mean(s(k).cdata))) % get min-pks in mean signal
Can you please eloborate further with a sample example code ?
Thanks!
Image Analyst
Image Analyst 2020 年 3 月 11 日
I don't have much time now. See the attached video where I plot the mean as a function of frame number.
Replace the rhinos demo video with your own.
Look at the mean signals and try to identify where there is a spike indicating a flicker, not a step which would indicate a scene change.
Image Analyst
Image Analyst 2020 年 3 月 13 日
That does not look like a filename. It looks like a database query to YouTube - something only YouTube would understand. You send that URL to YouTube and then it serves up the video in a web page with some kind of video player on it. So the URL will give you a bunch of HTML code that tells your browser how to build and display a web page.
I suggest you download the video separately somehow to a file, then use the filename on your own computer.
Life is Wonderful
Life is Wonderful 2020 年 3 月 13 日
編集済み: Life is Wonderful 2020 年 3 月 13 日
It was just an example
Requirement : Analyze an online video . Identify the flicker frames and do a post processing to remove the flicker and construct smooth video.
suggest you download the video separately somehow to a file, then use the filename on your own computer
Downloading the video separately as a file and playing is NOT an option. The idea is to analyze online/live video for flicker frames.
Thank you!
Image Analyst
Image Analyst 2020 年 3 月 13 日
Sorry, I don't know how to get access to the actual video format file inside YouTube's database. Maybe you'll have to play it first and then look in the temporary internet files folder for the most recent video file and then use that.
Life is Wonderful
Life is Wonderful 2020 年 3 月 14 日
編集済み: Life is Wonderful 2020 年 3 月 15 日
Thanks for the help. I'll try it out

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by