Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
sum(sum) of matrix, index exceeds matrix dimention
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to count the number of pixels in certain portions of image so i try the following code which give error at sum(sum ) function . could any one help me ? or is there another solution to get the number of pixels within certain coordinates rather than this code:
clear sum clear all close all image=imread('Headers-29.jpg'); image=im2bw(image,graythresh(image)); %binarization image=imcomplement(image); [m n]=size(image); X_segmented=[]; Y_segmented=[]; Width_segmented=[]; Hight_segmented=[]; cropped_segmented={}; Bounding=regionprops( image, 'BoundingBox'); % Minimum x-y coordinates of a block and its x, y lengths for g=1:length(Bounding)
X_segmented(g,1)=Bounding(g).BoundingBox(1);
Y_segmented(g,1)=Bounding(g).BoundingBox(2);
Width_segmented(g,1)=Bounding(g).BoundingBox(3);
Hight_segmented(g,1)=Bounding(g).BoundingBox(4);
x_Plus(g,1)=X_segmented(g)+Width_segmented(g);
y_plus(g,1)=Y_segmented(g)+Hight_segmented(g);
bvv(g,:)=[X_segmented(g,1) x_Plus(g,1) Y_segmented(g,1) y_plus(g,1)];
end
for g=1:size(bvv,1) sumnn(g,:)=sum(sum( image(bvv(g,1): bvv(g,2) , bvv(g,3):bvv(g,4))));
end
1 Commento
Stephen23
il 1 Nov 2017
duplicate:
https://www.mathworks.com/matlabcentral/answers/364456-summation-of-image-exceeds-matrix-dimention
Risposte (0)
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!