How to jump to next sub-block in image
1 view (last 30 days)
Show older comments
Hi all. I want ask how to embed and retrieve data from block to block? Because I can get the data at the entire block only. Thanks for your help.
5 Comments
Accepted Answer
Image Analyst
on 26 Jan 2013
I'm not sure I understand why you can't just have two for loops where you move the window along:
for row = 1 : windowSize : rows-windowSize
for col = 1 : windowSize : columns-windowSize
% Get rectangular block.
thisBlock = yourImage(row:row+windowSize-1, column:column+windowSize-1);
% Now process this block somehow...
end
end
It's the brute force, intuitive, totally obvious approach that I'm sure you've considered already, but what's wrong with it?
6 Comments
More Answers (2)
Matt J
on 27 Jan 2013
I only vaguely understand what you're doing, but nowhere in your code do you show where "block" originally comes from or how you update it. Maybe the problem is that you are not updating it.
Below might be something like what you're looking for for the 'embed' part. The 'extract' would probably be very similar. I'm using MAT2TILES which is available here
C=mat2tiles(YourImage,[2,2]);
W=C;
for i=1:numel(C);
block=C{i};
n=1;
for r=1:2
for c=1:2
block(r,c)=bitset(block(r,c),1,embed(n));
n=n+1;
block(r,c)=bitset(block(r,c),2,embed(n));
n=n+1;
end
end
W{i}=block;
end
watermarked_image=cell2mat(W);
5 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!