how to make figure perfectly squared?

조회 수: 243 (최근 30일)
MP
MP 2022년 8월 24일
댓글: Walter Roberson 2022년 8월 24일
I would like to make a perfect squared figure. When I use axis equal I still find that y-axis is stretched more than x-axis and does not make a perfect square. It appears like a rectangle elongated in y-direction. I do not want to change x and y limits.
I understand that my PC screen does not have 1:1 ratio, but how to get figure in 1:1 ratio??
Can anyone please help me making figure perfectly squared?
Here is the tentative code:
clear; close all; clc;
subplot(131)
plot((1:20),(5:5:100))
xlim([1,20]); ylim([5,100]);
axis normal;
axis square;
subplot(132)
plot((1:20),(5:5:100))
xlim([1,20]); ylim([5,100]);
axis normal;
axis square;
subplot(133)
plot((1:20),(5:5:100))
xlim([1,20]); ylim([5,100]);
axis normal;
axis square;
I want a figure like this . Square.
Any help will be greatly appriciated.
Thank you very much in advance!

채택된 답변

Walter Roberson
Walter Roberson 2022년 8월 24일
편집: Walter Roberson 2022년 8월 24일
You will need to create a calibration pattern and record it with some external camera, and create an undistortion matrix. You would draw into an array instead of on to the display, and then you would apply the undistortion matrix to it to arrive at the final image to display. The image would then pass through the distortion of your pc display and the distortion and undistortion would cancel out.
The computer vision toolbox contains tools for analyzing camera distortion that could be applied in reverse.
If this sounds as if I am blaming your pc display or your graphics hardware for not displaying correctly, then you have understood correctly.
  댓글 수: 2
Image Analyst
Image Analyst 2022년 8월 24일
@MP Walter's answer doesn't sound "very rude" to me. He's saying that the distortion might be caused by your video adapter settings. Are they set to the "recommended" screen resolution settings? As far as I know the recommended settings are always for square pixels. If your recommended settings are 1980x1080 and you have it set for 1440x1080 then it may stretch the image so that something that would appear square with square pixel resolution setting will not appear square.
Walter Roberson
Walter Roberson 2022년 8월 24일
There are several different standard types of distortion for CRT displays, including pincushioning and bowing.
LCD and OLED and QLED displays are considerably less prone to some kinds of distortions, but they are not free of distortion, especially if viewed at angles.
Those are distortion at the physical display level. There is also potential distortion if the graphics card is sending incorrect or less-than-optimal information, due to settings or problems with the graphics driver or problems with the graphics card.
In the past I have used axis square on my iMac and measured the size of a data rectangle with digital calipers. On my system, the lengths of the two sides was equal to within round-off error.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by