how to project image into (x,y) coordinates graph

조회 수: 20 (최근 30일)
SHOBA MOHAN
SHOBA MOHAN 2018년 1월 2일
댓글: Walter Roberson 2018년 1월 3일
I have an image and wish to project the pixel details into graphical form in which x,y coordinates are pixel position and pixel number and vice versa. Can anyone help me
  댓글 수: 3
Guillaume
Guillaume 2018년 1월 2일
You use some odd terms in your question which makes it difficult to understand. What do you mean by project? What is pixel number? And what do you mean by vice versa?
It sounds like you simply want to display your image which you'd do with
imshow(yourimagearray)
If you wanted to see the axis, you'd do
axis on
afterward. But I've no idea if that's what you're asking.
SHOBA MOHAN
SHOBA MOHAN 2018년 1월 3일
Kindly apologize for typo errors. I wish to plot x_width and y_height of image. In x_width plot, x and y axis are pixel position and pixel number whereas in y_height plot, the x and y axis are vice versa. Suggest me to do this

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

답변 (2개)

Walter Roberson
Walter Roberson 2018년 1월 2일
YourImage = imread('shadow_remove.
jpg') ;
GreyImage = rgb2gray(YourImage) ; %jpeg are rarely rarely greyscale files even if they look to be
plot(GreyImage(:))
  댓글 수: 2
SHOBA MOHAN
SHOBA MOHAN 2018년 1월 3일
Thanks Walter. I attached the expected output format for your reference. Can you please refer the attachment and guide me to get the output in the expected form.
Walter Roberson
Walter Roberson 2018년 1월 3일
The horizontal and vertical projection are max(GreyImage,[],1) and max(GreyImage,[],2) which you could then plot() or bar() to display.

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


Guillaume
Guillaume 2018년 1월 3일
If I understood correctly you have a binary image and you want the pixel count (which you call the pixel number) along each column and along each row:
%binaryimage: a binary image
xwidth = 1:size(binaryimage, 2);
xcount = sum(binaryimage, 1);
yheight = 1:size(binaryimage, 1);
ycount = sum(binaryimage, 2);
You can plot that any number of ways, e.g.:
figure;
subplot(1, 2, 1);
bar(xwidth, xcount);
xlabel('pixel position along x');
ylabel('pixel count');
title('horizontal histogram');
subplot(1, 2, 2);
barh(yheight, ycount);
xlabel('pixel count');
ylabel('pixel position along y');
title('vertical histogram');

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by