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

조회 수: 3 (최근 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.
  댓글 수: 1
Shahad
Shahad 2015년 11월 16일
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.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by