image resampling to modify mesh

5 次查看(过去 30 天)
hello,
I would like some advice on this: I have an image characterized by a rectangular mesh and I would like to convert it to a square mesh by resampling.
Thanks for your suggestions
  2 个评论
DGM
DGM 2022-12-17
编辑:DGM 2022-12-17
That's awfully vague. An example of the expected inputs and outputs would help. Otherwise, all I can suggest is imresize().
% a "rectangular mesh"
sz = [101 301];
A = zeros(sz);
A(:,1:20:sz(2)) = 1;
A(1:10:sz(1),:) = 1;
% show it
% the cells are rectangular, so is the image.
imshow(A)
% resize it
B = imresize(A,sz.*[2 1],'nearest');
% show it
% the cells are square, but the image is rectangular
imshow(B)
% resize it
C = imresize(A,sz(2).*[1 1],'nearest');
% show it
% the image is square, but the cells are rectangular
imshow(C)
Federico Paolucci
Federico Paolucci 2022-12-17
编辑:Federico Paolucci 2022-12-17
ok, in particular I'm going to have as input A{i,1}, in which we have a column and a number i (from 1 to 100) of rows. I will therefore have a 100X1 cell, in which each "box" corresponds to a rectangular image, in fact for example the second corresponds to 206x1280, the second 204x1280 and so on. what I should do is convert from pixel to mm and resample the mesh, which characterizes each image, passing x=0.1, y=0.075 to x=0.1,y=0.1 (the mesh is composed by pixels). for this i think to use "griddata".

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by