how select a frame from video and calculate its RBG value for watermark project

1 次查看(过去 30 天)
Hi everyone, i'm a newbie to Matlab and i'm facing problem with it. I'm working on implementing a watermark algorithm for videos based on compressive sensing domain. i need to calculate the RGB value of each frame being read and then compare it to a pre-defined threshold. if it is greater than or equal to the threshold then i can embed the watermark text in a randomly selected sub-block of the frame. one more question, i run my initial code and i got this error:
Expected outputformat to match one of these strings:
'native', 'default'
The input did not match any of the valid strings.
the line which caused this error is:
for k =1:1: nFrames
mov(1).cdata =readFrame(v,k);
im = mov(1).cdata;
[r ,c, d ] = size (im);
if (1==1)
im (r, c, d ) = length (a);
else
try
im (r, c, d) = a(1-1);
end
end
end
any help will be much appreciated!
  2 个评论
Image Analyst
Image Analyst 2022-5-13
He accepted the answer so I guess he looked over my demo and figured out how to do it. Anyway, this was 7 years ago so I'm sure he wouldn't need it solved anymore if he hadn't gotten it solved by now.
If you have a simialr problem, and aren't able to adapt my demo to process your video, then read this first:
and post your m-file in a new question of your own (not here).

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2015-11-15
See my demo where I read in a video and "calculate the RGB value of each frame being read".
Your code is non-functional for several reasons, like the badly-named "a" not being defined, testing for the condition 1==1, using an index of (1-1) on an undefined array, etc. Just scrap that code and try to adapt mine, which is much more robust.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by