Effacer les filtres
Effacer les filtres

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

3 vues (au cours des 30 derniers jours)
mike
mike le 8 Déc 2020
Commenté : mike le 9 Déc 2020
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 commentaires
Holmbrero
Holmbrero le 8 Déc 2020
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 le 8 Déc 2020
You can adjust the axis by using axis, xlim, ylim.

Connectez-vous pour commenter.

Réponses (1)

mike
mike le 8 Déc 2020
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 commentaires
Holmbrero
Holmbrero le 9 Déc 2020
Modifié(e) : Holmbrero le 9 Déc 2020
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 le 9 Déc 2020
Anders-cheers matey

Connectez-vous pour commenter.

Catégories

En savoir plus sur Visual Exploration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by