Effacer les filtres
Effacer les filtres

Copy pixels from one Matrix to other matrix

2 vues (au cours des 30 derniers jours)
M@lik Ali
M@lik Ali le 26 Juil 2012
Hi all I have an image of size 256x384x3 then i divide the image into 4x4 blocks as
bs=4;
alp=0;
ca = mat2cell(rgbImage,bs*ones(1,size(rgbImage,1)/bs),bs*ones(1,size(rgbImage,2)/bs),3;
plotIndex = 1;
after that i generate a zero matrix of the image size and divide into blocks as
a=zeros(size(rgbImage));
aa = mat2cell(a,bs*ones(1,size(a,1)/bs),bs*ones(1,size(a,2)/bs),3);
plotIndex = 1;
Now What i want is to copy the few block from original image to the block of matrix a
I tried this
aa{37,88}=ca{37,88}
but fail. after copy blocks i want to reconstruct the a matrix. please help me how i can copy the selected block of original image into the block of the new matrix and then reconstruct the a which was my zero matrix
or if there is an other way that how i can copy the block of the original image into zero image.
thanks in Advance.

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 26 Juil 2012
Modifié(e) : Andrei Bobrov le 26 Juil 2012
EDIT (block with size 64x64)
rgbImage = imread('861.jpg');
bs=64;
ca = mat2cell(rgbImage,bs*ones(1,size(rgbImage,1)/bs),bs*ones(1,size(rgbImage,2)/bs),3);
plotIndex = 1;
a=zeros(size(rgbImage),class(rgbImage));
aa = mat2cell(a,bs*ones(1,size(a,1)/bs),bs*ones(1,size(a,2)/bs),3);
aa(2,3)=ca(2,3);
amtx = cell2mat(aa);
imshow(amtx)
  12 commentaires
Andrei Bobrov
Andrei Bobrov le 26 Juil 2012
answer was correct (see EDIT)
M@lik Ali
M@lik Ali le 27 Juil 2012
Thanks its work fine now..

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by