square image size whitout changing in original image shape

3 visualizaciones (últimos 30 días)
hamed
hamed el 21 de Jul. de 2014
Comentada: Image Analyst el 23 de Jul. de 2014
Hi guys . i have an image (size is 256x158) for computing zernike momentum i have to change my image size to N x N for example 256 x 256 . but unfortunately my image shape will be changed . i want to have my original image without changing . could you help me how can i resize my columns and rows without changing in my original image shape ? i have an idea . how can i add white pixels to my image for resizing like that image i attached (center oval for example is my image and white background for resizing in N x N size )

Respuesta aceptada

Joseph Cheng
Joseph Cheng el 21 de Jul. de 2014
Editada: Joseph Cheng el 21 de Jul. de 2014
If you're looking to pad the columns as there are enough rows to get youre 256x256 then.
Oimage = imread(____); %your original image
%ones padded to either side of image, multiply by the white color index.
PadImage = [ones(256,49) Oimage ones(256,49)];
That should get you the 256x256 sized image. If you're trying to resize it so there is a 1.6 times magnification to scale the smaller columns to 256 and trim off the extra rows then imresize() should work out.
  4 comentarios
hamed
hamed el 23 de Jul. de 2014
Editada: hamed el 23 de Jul. de 2014
with im2double solved my problem . my mistake was I = double(image);
Image Analyst
Image Analyst el 23 de Jul. de 2014
Another mistake is using a jpeg image for image analysis. Just look at those horrible compression artifacts.
I don't know what you did with im2double() and double() but it's not necessarily a mistake to use double() - I do it all the time and never use im2double().

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by