creating new images using new x,y coordinates from a subplot

조회 수: 3 (최근 30일)
mike
mike 2020년 12월 8일
댓글: mike 2020년 12월 9일
Hi all,
I have created 4 subplots. I am able to manually zoom into each image and find the x,y coordinates using the pop up bar at the top of the image
My issue is this, I want to zoom in to a particular point, and then re-create the 4 subplots at that zoomed in position.
My code so far is-
figure;
subplot(2,2,1); imshow(EdgeS),title('Sobel');
subplot(2,2,2); imshow(EdgeP),title('Prewitt');
subplot(2,2,3); imshow(EdgeR),title('Roberts');
subplot(2,2,4); imshow(EdgeC),title('Canny');
When I click on the image, it gives me [X,Y] [123 456] (obviously not the real coordinates).
Do i need to click in all four courners, or just in one place?
so where would i add my coordinates in my code?
I hope that makes sense!!
cheers
mike
  댓글 수: 2
Holmbrero
Holmbrero 2020년 12월 8일
I think what you are looking for is imcrop:
Icropped = imcrop(I,rect) crops the image I according to the position and dimensions specified in the crop rectangle rect. The cropped image includes all pixels in the input image that are completely or partially enclosed by the rectangle.
The actual size of the output image does not always correspond exactly with the width and height specified by rect. For example, suppose rect is [20 20 40 30], using the default spatial coordinate system. The upper left corner of the specified rectangle is the center of the pixel with spatial (x,y) coordinates (20,20). The lower right corner of the rectangle is the center of the pixel with spatial (x,y) coordinates (60,50). The resulting output image has size 31-by-41 pixels, not 30-by-40 pixels.
KSSV
KSSV 2020년 12월 8일
You can adjust the axis by using axis, xlim, ylim.

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

답변 (1개)

mike
mike 2020년 12월 8일
thanks for the repies
so with the xlim which limit would I choose? I have zoomed into the image (all four at the same time as I have linked the axis) but I can pick any point on the image which gives me the xy value. So how would I then decide what the limits are?
many thanks
mike
  댓글 수: 2
Holmbrero
Holmbrero 2020년 12월 9일
편집: Holmbrero 2020년 12월 9일
xlim(xmin xmax)
ylim(ymin ymax)
So xmin is your starting point on the x-axis and xmax is your end point. The same goes for the y-axis.
/Anders
mike
mike 2020년 12월 9일
Anders-cheers matey

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

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by