How to generate a HS histogram?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
My task is to acquire the frequency values of the H and S values of an image. Therefore, I'm trying to generate a HS histogram of an image. However, I looked up numerous sources and they all create the H and S histograms separately. To state my problem more clearly, how do I know the number of time the H and S values occur together as a pair? Can anyone point me to the right direction?
Thanks!
채택된 답변
Image Analyst
2014년 8월 7일
0 개 추천
See my demo, attached.
댓글 수: 9
Joshua Jorel Lee
2014년 8월 7일
Thanks! But I have a question. Are you specifically referring to the "Histogram of All Bands" portion of your code? From what I can tell, it's still getting the histogram of each of the H, S, and V values. What I need is a histogram that relates the H and S values, not their individual histograms.
I'm not sure if I'm making much sense, but what I plan to do is to characterize the color of an image based on those two values (H and S). So I need what my professor calls a HS histogram.
Image Analyst
2014년 8월 7일
편집: Image Analyst
2014년 8월 12일
You can create a 2D histogram by scanning the images
for col = 1 : columns
for row = 1 : rows
r = scaleFactor1 * h(row, column) + 1; % Arrays start at 1.
c = scaleFactor2 * s(row, column) + 1;
hist_hs(r, c) = hist_hs(r, c) + 1;
end
end
You might also like to look at the color frequency image: http://www.mathworks.com/matlabcentral/fileexchange/28164-color-frequency-image
Joshua Jorel Lee
2014년 8월 8일
편집: Joshua Jorel Lee
2014년 8월 8일
I think that's just what I need. Thanks a lot! I assume that the scaleFactor would assume the maximum value from each of the channels?
Image Analyst
2014년 8월 8일
h and s are continuous. To get into an array, you have to digitize them. For example h and s goes from 0 to 1. If you want your 2D histogram image hist_hs to be 500 in the h direction and 300 in the s direction, you need to have scaleFactor1 be 500 and scaleFactor2 be 300. Of course you also have to preallocate hist_hs to be zeros(500,300) before the loop starts.
Joshua Jorel Lee
2014년 8월 12일
How would you handle those 0 valued h and s values?
Image Analyst
2014년 8월 12일
Just ignore them. What needs to be "handled" about them?
Joshua Jorel Lee
2014년 8월 12일
편집: Joshua Jorel Lee
2014년 8월 12일
Since you're using the h and s values as the locations for the frequency values in the new matrix, if I have a 0 value in my h or s vector, MATLAB won't allow the data to be stored.
Example: h(r,c) = 0 or s(r,c) = 0, then r or c will be 0. If I assign hist_hs(r,c), then MATLAB will throw an error.
Image Analyst
2014년 8월 12일
Adjust the scale factor and add 1. See my edited comment above.
Joshua Jorel Lee
2014년 8월 13일
Thanks! I took the liberty of putting an if statement that would make the 0 values into 1 instead. Then I used a surf plot to see the result.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Histograms에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
