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

1 view (last 30 days)
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 Comments
Image Analyst
Image Analyst on 13 May 2022
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).

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 15 Nov 2015
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.
  1 Comment
Shahad
Shahad on 16 Nov 2015
thank you so much for this helpful tutorial! if i need any more help, i will send you if that's not a bother to you.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!