??? Subscripted assignment dimension mismatch.
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
karthick ganesan
il 13 Giu 2015
Commentato: Walter Roberson
il 15 Giu 2015
I am struck in this error can any one help me i am run this program,i am getting like that
??? Subscripted assignment dimension mismatch.
Error in ==> parallel_function at 479 consume(base, limit, F(base, limit, supply(base, limit)));
Error in ==> rdm at 27 parfor sqr=1:8, squares(:,:,sqr)=imcrop(images(:,:,sqr),rectangle);end
how to clear this error any one know that help me i attached program below
i=imread('onion.png');
i1=(rgb2gray(i));
[row colm]=size(i1);
%imshow(i1);
images=zeros(row,colm,8);
images(:,:,1)=i1;
images(:,:,2)=imrotate(i1,-90*(1/4),'bilinear','crop');
images(:,:,3)=imrotate(i1,-90*(2/4),'bilinear','crop');
images(:,:,4)=imrotate(i1,-90*(3/4),'bilinear','crop');
images(:,:,5)=imrotate(i1,-90,'bilinear','crop');
images(:,:,6)=imrotate(i1,-90*(5/4),'bilinear','crop');
images(:,:,7)=imrotate(i1,-90*(6/4),'bilinear','crop');
images(:,:,8)=imrotate(i1,-90*(7/4),'bilinear','crop');
diameter=row;
midpoint=floor(diameter/2);
side=sqrt(2)*midpoint;
rectangle=[midpoint-floor(side/2+2) midpoint-floor(side/2-2) side-2 side-2];
parfor sqr=1:8, squares(:,:,sqr)=imcrop(images(:,:,sqr),rectangle);end
scaledsquares=zeros(size(squares));
numlev=8;
for sqr=1:8
im=squares(:,:,sqr);
graylevels = [min(im(:)) max(im(:))];
[glcm, scaledsquares(:,:,sqr)]=graycomatrix(im,'numlevels',numlev,'G',graylevels);
end
2 Commenti
Risposta accettata
Walter Roberson
il 14 Giu 2015
I am not sure why you are getting that message.
On the other hand, imcrop() is really just array indexing, so recode as
cropfromx = midpoint-floor(side/2+2);
cropfromy = midpoint-floor(side/2-2);
croptox = cropfromx + side - 2
croptoy = cropfromy + side - 2;
squares = images(cropfromy : croptoy, cropfromx : croptox, : );
All just array indexing...
Note: the size returned might differ slightly from what imcrop() would return, as imcrop() deals with pixel centers rather than pixel edges. You might want to tweak the start or end by 1.
2 Commenti
Walter Roberson
il 15 Giu 2015
I am not sure why you commented out the simple indexing I showed and went for the parfor version instead?
Note that the rectangle() you build is wrong for imcrop(): imcrop() takes a rectangle which is [x y width height] not [firsty lasty firstx lastx]
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Type Identification in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!