Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

sum(sum) of matrix, index exceeds matrix dimention

1 visualización (últimos 30 días)
Rana Sobhy
Rana Sobhy el 1 de Nov. de 2017
Cerrada: Stephen23 el 1 de Nov. de 2017
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 comentario
Stephen23
Stephen23 el 1 de Nov. de 2017
duplicate:
https://www.mathworks.com/matlabcentral/answers/364456-summation-of-image-exceeds-matrix-dimention

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by