Info
この質問は閉じられています。 編集または回答するには再度開いてください。
sum(sum) of matrix, index exceeds matrix dimention
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Stephen23
2017 年 11 月 1 日
duplicate:
https://www.mathworks.com/matlabcentral/answers/364456-summation-of-image-exceeds-matrix-dimention
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!