How can i divide green HL2 component into four blocks???
3 次查看(过去 30 天)
显示 更早的评论
My project is on digital color image watermarking!!the size of image that i use as cover image is 512*512. for embedding purposr first i apllly 2 level dwt and the i want to to divide green hl2 component into 4 blocks.the code is here.
this statment is use for calling the thefunction
[ upperHalfA1,lowerHalfA1,upperHalfA2,lowerHalfA2 ] = Dividev2( hl2);
/// where division function Dividev2 code is here. ////
function [ upperHalf1,lowerHalf1,upperHalf2,lowerHalf2 ] = Dividev2( A)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
% obtain size of image.
[rows, columns] = size(A);
middleColumn = int32(columns/2);
middleRow = int32(rows/2);
% Split them up.
% out = mat2cell(image,ones(256/32,1)*32,ones(256/32,1)*32,3);
upperHalf1 = A(1:middleRow, 1:middleColumn);
lowerHalf1=A( middleRow+1:end,1:middleColumn);
% Display them.
% subplot(2, 2, 1);
% imshow(upperHalf1);
% title('Upper Left Half', 'FontSize', 15);
% subplot(2, 2, 3);
% imshow(lowerHalf1);
% title('Lower Left Half', 'FontSize', 15);
upperHalf2 = A(1:middleRow, middleColumn+1:end);
% subplot(2, 2, 2);
% imshow(upperHalf2);
% title('Upper Right Half', 'FontSize', 15);
lowerHalf2=A( middleRow+1:end, middleColumn+1:end);
% subplot(2, 2, 4);
% imshow(lowerHalf2);
% title('Lower Right Half', 'FontSize', 15);
%reB=[upperHalf1,upperHalf2];
%reA=[lowerHalf1,lowerHalf2];
%RECnst=[reB;reA];
%figure
%imshow(RECnst)
end
but this code gives wrong size
please help me how can i divide green HL2 component in four blocks on matlab.
0 个评论
采纳的回答
Walter Roberson
2015-5-6
HL2_11 = HL2(1:end/2,1:end/2);
HL2_21 = HL2(end/2+1:end,1:end/2);
HL2_12 = HL2(1:end/2,end/2+1:end);
HL2_22 = HL2(end/2+1:end, end/2+1:end);
2 个评论
Walter Roberson
2015-5-6
编辑:Walter Roberson
2015-5-6
You accepted this answer based upon your earlier version of the question, and you started a new question with the revised version. I am going to leave this one sit and use the new one instead.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!