How to compare histogram with threshold?

조회 수: 6 (최근 30일)
pritesh patel
pritesh patel 2015년 3월 4일
답변: intissar khalifa 2018년 1월 28일
Hello, I am new to MATLAB. In my project for key-frame extraction from videos, first I am computing Histogram of consecutive frames. I also compute threshold as threshold=std+mean*4; Now, I have to check whether HistDiff(k)>threshold. But my question is HistDiff(k) is histogram difference i.e. 1D array and threshold is single numeric value. So, How to do it.( I attached a file, if required) I am stuck in this. Please help.

답변 (2개)

Image Analyst
Image Analyst 2015년 3월 4일
편집: Image Analyst 2015년 3월 4일
Try looking at the average difference over all bins
if mean(HistDiff) > threshold
% It's a key frame
else
% It's not a key frame
end
By the way, don't you want
threshold = stdDev*4;
instead of
threshold=std+mean*4
The mean * 4 will get clipped to 255 most likely so you'll never exceed it. Also, be sure not to use mean or std as variable names since they're built-in functions. And you don't want to add the mean because the difference has the mean already subtracted out.
  댓글 수: 2
pritesh patel
pritesh patel 2015년 3월 4일
Ok, but if I have HistDiff(k) is an array and mean too or otherwise. So , how to compare them.
if threshold=mean;
% then how to compute
HistDiff(k)>mean;
end
I am getting problem in this stage:
HistDiff(k)>threshold; %if threshold=mean
Image Analyst
Image Analyst 2015년 3월 4일
I told you exactly how. Why didn't you use my code and instead changed it to something that doesn't work? There are numerous problems with your code like bad syntax, comparing floating point numbers for equality, bad indenting, etc. What is HistDiff exactly? Is it an array that is the histogram of the current image minus the histogram of the last key frame? Or is it the mean difference over all gray level bins and k is the frame number?

댓글을 달려면 로그인하십시오.


intissar khalifa
intissar khalifa 2018년 1월 28일
i have some videos from job iterview and i like to get for each video the key frames for feature extraction can you help me please

Community Treasure Hunt

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

Start Hunting!

Translated by