interpmask - interpolate (tween) logical masks

버전 1.0.0.0 (3.66 KB) 작성자: Sven
interpmask interpolates (or tweens) masks to transition smoothly between shapes in masks
다운로드 수: 532
업데이트 날짜: 2014/5/1

라이선스 보기

INTERPMASK performs mask interpolation (tweening) via distance maps. Inbetweening or tweening is the process of generating intermediate frames between two images to give the appearance that the first image evolves smoothly into the second image

BWq = INTERPMASK(X,BW,Xq) interpolates masks in the logical matrix BW
at query points Xq. The elements of X corresponds to the successive
masks along the last dimension of BW. The output BWq is a logical
matrix of equal size to BW except for the last dimension which is equal
to the number of query points in Xq.

BWq = INTERPMASK(...,'interpDim',D) specifies D as the dimension of BW
to interpolate along. By default, D is simply the last dimension of BW.

BWq = INTERPMASK(BW,Xq) assumes X = 1:N, where N is SIZE(BW,INTERPDIM).

Interpolation between masks is done via the distance matrix of each
mask in BW (calculated by BWDIST from the IP toolbox) using INTERP1.
Extra arguments ('linear', 'pchip', 'extrapval', etc) will be passed to
INTERP1 and can be used to control the interpolation method. To provide
an 'extrapval' to the output BWq mask, pass an 'extrapval' of 1 (TRUE)
or -1 (FALSE) to INTERPMASK as follows:

BWq = INTERPMASK(...,'pchip','extrapval',-1) % Extrap pixels set FALSE

For example, to interpolate smoothly from a small circle to a large
square to a large circle, consider the following:
% Make two circles and a rectangle
[x,y] = meshgrid(-51:51,-51:51);
circMat = sqrt(x.^2 + y.^2);
smallCirc = circMat<10;
largeCirc = circMat<30;
largeRect = false(size(x));
largeRect(2:100,2:100) = true;
% Stack them as masks 1, 2, and 3
BW = cat(3,smallCirc,largeRect,largeCirc);
% Interpolate smoothly between masks
BWout1 = interpmask(1:3, BW, linspace(1,3,200),'linear');
BWout2 = interpmask(1:3, BW, linspace(1,3,200),'pchip');
figure, subplot(1,2,1)
patch(isosurface(BWout1,0.5),'FaceColor','g','EdgeColor','none')
camlight, view(3), camlight, axis image
subplot(1,2,2)
patch(isosurface(BWout2,0.5),'FaceColor','g','EdgeColor','none')
camlight, view(3), camlight, axis image

See also INTERP1.

인용 양식

Sven (2024). interpmask - interpolate (tween) logical masks (https://www.mathworks.com/matlabcentral/fileexchange/46429-interpmask-interpolate-tween-logical-masks), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2014a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 3-D Volumetric Image Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0