필터 지우기
필터 지우기

Map a downsampled image to original resolution

조회 수: 3 (최근 30일)
Alex G
Alex G 2018년 8월 6일
편집: Walter Roberson 2018년 8월 7일
I have a small 3D image (500x1000x100) and would like to downsample to 1% of the pixels. I would then like to map this back to a binary (true/false, 1/0) of the same original dimensions, where the relative positions of the downsampled pixels are 1 and everything else is 0.
So maybe like:
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
Or this, but it only works if dims are div by 100 and I don't think it works in general:
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;
Think of a 100x100 image. downsample by 99% to 10x10. Take every pixel in that downsample and map it back to the original dimensions and let them be TRUE in a binary tensor of the same dimensions.
I'm trying to recreate a microscope "observing" these pixels in the original sample space, if you were wondering what this is for.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 8월 6일
편집: Walter Roberson 2018년 8월 7일
You can only do this if you used method 'nearest' for the imresize. In all other cases, the value of any output pixels are determined by considering multiple source pixels.
In the case of nearest, you can use linear calculations and floor() to calculate the location of the source pixels.
  댓글 수: 1
Alex G
Alex G 2018년 8월 6일
편집: Alex G 2018년 8월 6일
Thanks Walter, do you know of any posts that help with the second part. That's what I don't get.
Doing imresize(im, 0.01, 'nearest') is what I'm at since I don't think masking is appropriate for this

댓글을 달려면 로그인하십시오.

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by