# how to plot histogram of hue value in polar ?

조회 수: 6(최근 30일)
SAM 2013년 11월 11일
편집: Abdoo 2015년 6월 18일 Hi
i wants to plot a histogram of hue values in polar . in my 1st image i have plotted histogram of hue values . and now i would like to plot it on polar as shown in figure 2.

댓글을 달려면 로그인하십시오.

### 채택된 답변

Image Analyst 2013년 11월 12일
I just adapted Doug's code to use a sample image and I got this: See code attached below in blue text.
##### 댓글 수: 2표시 이전 댓글 수: 1숨기기 이전 댓글 수: 1
Image Analyst 2013년 11월 12일
And Doug - he did most of the work.

댓글을 달려면 로그인하십시오.

### 추가 답변(2개)

Doug Hull 2013년 11월 11일
편집: Doug Hull 2013년 11월 11일 clear
clc
clf
z = peaks(300);
r = z(:,150);
r = r-min(r);
r = r/max(r);
n = numel(r)
cmap = jet(n)
drawWheel(r*0.8,cmap)
Save this file first though:
function drawWheel(r, cmap)
if (any(r > 1) | any(r < 0))
error('R must be a vector of values between 0 and 1')
end
if numel(r) ~= size(cmap,1)
error('Length of r and cmap must be the same')
end
n = numel(r);
angles = linspace(0,2*pi,n+1);
for i = 1:n;
drawSpoke(newR(i) , innerRadius, angles(i), angles(i+1), cmap(i,:))
end
line(0,0,'marker','o')
axis equal
function h = drawSpoke(ri,ro,thetaStart,thetaEnd,c)
xInnerLeft = cos(thetaStart) * ri;
xInnerRight = cos(thetaEnd) * ri;
xOuterLeft = cos(thetaStart) * ro;
xOuterRight = cos(thetaEnd) * ro;
yInnerLeft = sin(thetaStart) * ri;
yInnerRight = sin(thetaEnd) * ri;
yOuterLeft = sin(thetaStart) * ro;
yOuterRight = sin(thetaEnd) * ro;
X = [xInnerLeft, xInnerRight, xOuterRight xOuterLeft];
Y = [yInnerLeft, yInnerRight, yOuterRight yOuterLeft];
h = patch(X,Y,c);
set(h,'edgeColor', 'none')
##### 댓글 수: 1표시 없음숨기기 없음
SAM 2013년 11월 12일
Dear Doug Hull
thanks for your answer but i want my histogram should come in the circle.
clc
close all
clear all
ima1=rgb2hsv(ima);
ima2=ima1(:,:,1);
imhist(ima2);
polar((imhist(ima2)));
but it not giving me the desired output. i am not bother about that hsv wheel but i want my polar should show the hue value of histogram as show in inside of the wheel.

댓글을 달려면 로그인하십시오.

Abdoo 2015년 6월 18일
편집: Abdoo 2015년 6월 18일
This small example to compere between three plots Hue from images and save the data in excel file. 댓글을 달려면 로그인하십시오.

### 범주

Find more on Histograms in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!