Figure 창에 출력되는 이미지 크기 조절 방법

59 visualizzazioni (ultimi 30 giorni)
성완
성완 il 21 Ott 2025 alle 15:29
Commentato: 성완 il 22 Ott 2025 alle 6:40
안녕하세요.
Figure 창에 출력되는 결과가 전체의 부분만 나타납니다. 처리하는 이미지 크기가 커서 그런것 같아서 이미지 크기를 줄여도 동일한 형태인데. Figure에 출력되는 이미지가 계속 부분만 보이는 이유가 무엇인지 조언 부탁 드립니다.
scale_factor = 0.5;
radius_range_orig = [15 60];
img1_rgb_orig = imread('SIFT_1.png');
Error using imread>get_full_filename (line 635)
Unable to find file "SIFT_1.png".

Error in imread (line 395)
fullname = get_full_filename(filename);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
img1_rgb = imresize(img1_rgb_orig, scale_factor);
img1_gray = im2gray(img1_rgb);
img2_rgb_orig = imread('SIFT_2.png');
img2_rgb = imresize(img2_rgb_orig, scale_factor);
img2_gray = im2gray(img2_rgb);
points1_all = detectSIFTFeatures(img1_gray);
points2_all = detectSIFTFeatures(img2_gray);
scaled_radius_range = round(radius_range_orig * scale_factor);
[centers1, radii1] = imfindcircles(img1_gray, scaled_radius_range, 'Sensitivity', 0.92, 'ObjectPolarity', 'bright');
if isempty(centers1)
disp('SIFT_1.png (축소됨)에서 공을 찾지 못했습니다. 반경/민감도를 조절하세요.');
return;
end
center1 = centers1(1,:);
radius1 = radii1(1);
roi1 = [center1(1)-radius1, center1(2)-radius1, 2*radius1, 2*radius1];
[centers2, radii2] = imfindcircles(img2_gray, scaled_radius_range, 'Sensitivity', 0.92, 'ObjectPolarity', 'bright');
if isempty(centers2)
disp('SIFT_2.png (축소됨)에서 공을 찾지 못했습니다. 반경/민감도를 조절하세요.');
return;
end
center2 = centers2(1,:);
radius2 = radii2(1);
roi2 = [center2(1)-radius2, center2(2)-radius2, 2*radius2, 2*radius2];
locations1 = points1_all.Location;
x_min1 = roi1(1); y_min1 = roi1(2);
x_max1 = roi1(1) + roi1(3); y_max1 = roi1(2) + roi1(4);
inside_indices1 = (locations1(:, 1) >= x_min1 & locations1(:, 1) <= x_max1 & ...
locations1(:, 2) >= y_min1 & locations1(:, 2) <= y_max1);
points_in_roi1 = points1_all(inside_indices1);
locations2 = points2_all.Location;
x_min2 = roi2(1); y_min2 = roi2(2);
x_max2 = roi2(1) + roi2(3); y_max2 = roi2(2) + roi2(4);
inside_indices2 = (locations2(:, 1) >= x_min2 & locations2(:, 1) <= x_max2 & ...
locations2(:, 2) >= y_min2 & locations2(:, 2) <= y_max2);
points_in_roi2 = points2_all(inside_indices2);
[features1, valid_points1] = extractFeatures(img1_gray, points_in_roi1);
[features2, valid_points2] = extractFeatures(img2_gray, points_in_roi2);
indexPairs = matchFeatures(features1, features2, 'MaxRatio', 0.6);
matchedPoints1 = valid_points1(indexPairs(:, 1), :);
matchedPoints2 = valid_points2(indexPairs(:, 2), :);
figure('WindowState', 'maximized');
showMatchedFeatures(img1_rgb, img2_rgb, matchedPoints1, matchedPoints2, 'montage');
title('Matched SIFT Features (Resized Image)');
  6 Commenti
DGM
DGM il 22 Ott 2025 alle 0:09
The figure is normal on the forum (not saying the feature matching is working).
Could this be some sort of thing either to do with Mac and/or a new version?
Unless there is other stuff going on during figure manipulation/setup, I don't see how someone could just casually get the axes position offset like that.
I don't know how the windowstate option behaves in newer versions, but I don't believe it's being applied when used on the forum, so that may be another thing we're not actually testing.
% the same code as before (no sense repeating it)
% ...
get(gcf,'windowstate') % it's not actually applied here
ans = 'normal'
성완
성완 il 22 Ott 2025 alle 6:40
Hi
I'm running the script with MacBook Pro 16inch model. Anyhow, I just run same script on my extend monitor(32inch), and I can check normal figure image. Let me update Matlab as new version and try it later.
Appreciate all of your help!

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by