Not getting 360 values from Histogram

1 次查看(过去 30 天)
I should get 360 values of histogram of distances from centroid (signature of object) as mentioned here : http://www.2shared.com/photo/baX-TtQ6/follow.html
But I am getting only ten values from histogram.
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
MATLAB Code :
clear all; close all; imtool close all; clc;
image = imread('C:\Users\Explorer\Desktop\aa_contour.jpg');
BW = im2bw(image);
stats = regionprops(BW, 'Centroid') ;
c = stats.Centroid ;
boundary = bwboundaries(BW);
thisBoundary = boundary{1}; % Or whatever blob you want.
x = thisBoundary(:,1);
y = thisBoundary(:,2);
distances = sqrt((x - c(1)).^2 + (y - c(2)).^2) ;
[nelements, centers] = hist(distances)
bar(centers, nelements);
grid on;
------------------------------------------------------------------------------------
Output
nelements = 178 80 66 60 56 52 52 50 48 49
centers =
Columns 1 through 3
183.161086305936 204.483258917807 225.805431529678
Columns 4 through 6
247.12760414155 268.449776753421 289.771949365293
Columns 7 through 9
311.094121977164 332.416294589035 353.738467200907
Column 10
375.060639812778
-----------------------------------------------------------------------------------

采纳的回答

Image Analyst
Image Analyst 2014-2-11
hist() by default makes 10 bins. Specify 360 in the arg list if you want 360 bins.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by