Resize image ,but xy axis not start with 0.

2 visualizaciones (últimos 30 días)
Bheem Atipanan
Bheem Atipanan el 20 de Abr. de 2021
Comentada: Image Analyst el 20 de Abr. de 2021
I'm trying to resize the image. Now I using this code to resize
img = imread('color3.jpg');
img2=rgb2gray(img)
resizedimage = imresize(img2,[40 60]);
From this I got image, x-axis from 0 to 60 and y-axis 0 to 40.
But I want x-axis from 30 to 60 and y-axis 10 to 40.
How can I do that?

Respuesta aceptada

Image Analyst
Image Analyst el 20 de Abr. de 2021
Not sure what you're talking about. The first row or column of a matrix is 1, not 0. Why/where are you seeing zero?
This works and you can see from the tick marks and counting over from column 10 to the first column that the first column is 1.
img = imread('peppers.png');
img2=rgb2gray(img);
resizedimage = imresize(img2,[40 60]);
imshow(resizedimage, 'InitialMagnification', 1000);
axis('on', 'image');
  4 comentarios
Bheem Atipanan
Bheem Atipanan el 20 de Abr. de 2021
Editada: Bheem Atipanan el 20 de Abr. de 2021
How can I save this imshow into workspace using command?
Image Analyst
Image Analyst el 20 de Abr. de 2021
What does that mean? img is already in the workspace. To save the image to disk you can use imwrite(). To save the axes or figure (with title, tick labels, etc.) use saveas() or exportgraphics (R2020b or later).

Iniciar sesión para comentar.

Más respuestas (1)

Jonas
Jonas el 20 de Abr. de 2021
what about
img2(10:40,30:60)?
  1 comentario
Bheem Atipanan
Bheem Atipanan el 20 de Abr. de 2021
No, it's not working. Also I want to resize, but this command cut some parts out.

Iniciar sesión para comentar.

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by