将下采样图像映射到原始分辨率-MATLAB



我有一个小的3D图像(500x1000x100(,希望将采样缩小到1%的像素。然后,我想将其映射回相同原始维度的二进制(真/假,1/0(,其中下采样像素的相对位置为1,其他所有像素均为0。

所以可能像:

small_im = imresize(im,0.01);
%create some sort of mapping
binary_tensor = %true wherever the downsampled image's pixels are present,       
%relatively speaking. But of the same dims as im

编辑:想象一张100x100的图片。将其缩小到10x10。取下采样中的每个像素,将其映射回原始维度,并在相同维度的二元张量中使其为TRUE

如果它可以被100整除(或可以乘以1%(,

small_im=im(1:100:end,1:100:end,1:100:end);
mask=false(size(im));
mask(1:100:end,1:100:end,1:100:end)=true;

最新更新