필터 지우기
필터 지우기

how to collect the each row of a matrix after operation

조회 수: 2 (최근 30일)
sachit
sachit 2014년 12월 23일
댓글: Image Analyst 2014년 12월 23일
v=hsv(:,:,3);
p=1:256;
x=v(1:256, p);
h=imhist(v);
a=sum(x.*h);
b=sum(h);
M=a/b
the problem is that x should be of 256*1, and i want the vale of 'M' to be 256*256. which loop should i start so that p uses all value from 1 to 256 and automatically it should have its value in a form of a matrix of 256*256

채택된 답변

Image Analyst
Image Analyst 2014년 12월 23일
What are you doing? It makes little sense to me. You're multiplying the histogram counts by the upper left 256x256 portion of the value channel image. Then you're summing the histogram to get b, which is simply the number of pixels in the image. Then you're dividing the "a" by "b". So essentially it looks like you're just computing the mean of the value channel, which can be done more simply as
M = mean2(v);
  댓글 수: 2
sachit
sachit 2014년 12월 23일
편집: sachit 2014년 12월 23일
no sir actually here 'h' is the histogram value. and x is the pixel value belongs to v and in our command and my operation the value are different. after applying this operation i get value of M 256 times i just want these values in the matrix form
Image Analyst
Image Analyst 2014년 12월 23일
I know h is the "histogram value". I called it the "histogram counts" because it's the count of pixels with each gray level. We're both talking about the same thing. And I realize x is the upper left 256x256 portion of the v (value) channel, which may be the entire v image since I don't know the size of v, but if it was the whole image you would not even use 1:256 at all.
So, what is x.*h? It's a 2D image multiplied by a vector. Doesn't make sense. Unfortunately I don't really know enough of what you're trying to accomplish to suggest a solution.

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

추가 답변 (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