How to change Y-axis coordinates of meshgrid
조회 수: 17 (최근 30일)
이전 댓글 표시
Hello Everyone, i hope you are doing well. I am creating binary Image in which background is black and forground is white
when i create grid of 1000x1000. The X-axis start from 0 to 1000 but Y axis is upper side 0 to 1000 as you can see in the following image , but i want Y axis to be start from Lower 0 to 1000
How can i do that in MATLAB
imSz = 1000; % assuming images are 1000x1000
imbg = false(imSz); % background "color"
imfg = ~imbg(1,1);
[~,Y] = meshgrid(1:imSz); % make a grid
% black and white image
BW = imbg;
imshow(BW)
axis on;
댓글 수: 0
채택된 답변
Image Analyst
2022년 3월 22일
That's the convention for matrixes and images - the y=1 value is at the top. If you want to reverse it use "axis xy" like
grayImage = imread('cameraman.tif');
[rows, columns, numberOfColorChannels] = size(grayImage);
subplot(2, 1, 1);
imshow(grayImage);
axis('on', 'xy');
subplot(2, 1, 2);
imshow(flipud(grayImage));
axis('on', 'xy');
댓글 수: 0
추가 답변 (2개)
yanqi liu
2022년 3월 21일
imSz = 1000; % assuming images are 1000x1000
imbg = false(imSz); % background "color"
imfg = ~imbg(1,1);
[~,Y] = meshgrid(1:imSz); % make a grid
% black and white image
BW = imbg;
imshow(BW)
axis on;
axis xy
댓글 수: 2
yanqi liu
2022년 3월 22일
yes,sir,use axis xy to make the coordinate as norma xy axis, not use image axis
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!