Not getting 360 values from Histogram

2 views (last 30 days)
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
-----------------------------------------------------------------------------------

Accepted Answer

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

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!