Main Content

pctransform

3차원 포인트 클라우드 변환

설명

예제

ptCloudOut = pctransform(ptCloudIn,tform)은 지정된 3차원 아핀 변환 tform을 포인트 클라우드 ptCloudIn에 적용합니다. 변환은 강체 변환, 유사 변환 또는 아핀 변환일 수 있습니다.

예제

ptCloudOut = pctransform(ptCloudIn,D)는 변위 필드 D를 포인트 클라우드에 적용합니다. 변위 필드를 사용하는 포인트 클라우드 변환은 포인트 클라우드의 각 점을 기준으로 한 평행 이동을 정의합니다.

예제

모두 축소

포인트 클라우드를 읽어 들입니다.

ptCloud = pcread('teapot.ply');

포인트 클라우드를 플로팅합니다.

figure
pcshow(ptCloud)
xlabel('X')
ylabel('Y')
zlabel('Z')

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains an object of type scatter.

z축을 따라 45도 회전하는 변환 객체를 만듭니다.

rotationAngles = [0 0 45];
translation = [0 0 0];
tform = rigidtform3d(rotationAngles,translation);

포인트 클라우드를 변환합니다.

ptCloudOut = pctransform(ptCloud,tform);

변환된 포인트 클라우드를 플로팅합니다.

figure
pcshow(ptCloudOut)
xlabel('X')
ylabel('Y')
zlabel('Z')

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains an object of type scatter.

이 예제에서는 3차원 포인트 클라우드에 강체 변환(회전)과 비강체 변환(전단)을 적용합니다.

포인트 클라우드를 작업 공간으로 읽어 들입니다.

ptCloud = pcread('teapot.ply');

원래의 3차원 포인트 클라우드를 플로팅합니다.

figure1 = figure;
axes1 = axes(Parent=figure1);
pcshow(ptCloud,Parent=axes1,AxesVisibility='on'); 
xlabel('X');
ylabel('Y');
zlabel('Z');
title('3-D Point Cloud',FontSize=14)

Figure contains an axes object. The axes object with title 3-D Point Cloud, xlabel X, ylabel Y contains an object of type scatter.

3차원 포인트 클라우드의 회전

z축 상에서 45도 회전을 정의하는 강체 변환 객체를 만듭니다.

rotationAngles = [0 0 45];
translation = [0 0 0];
tform = rigidtform3d(rotationAngles,translation);

포인트 클라우드를 변환합니다.

ptCloudOut1 = pctransform(ptCloud,tform);

회전된 포인트 클라우드를 플로팅합니다.

figure2 = figure;
axes2 = axes(Parent=figure2);
pcshow(ptCloudOut1,Parent=axes2,AxesVisibility='on');
xlabel('X');
ylabel('Y');
zlabel('Z');
title({'Rotation of 3-D Point Cloud'},FontSize=14)

Figure contains an axes object. The axes object with title Rotation of 3-D Point Cloud, xlabel X, ylabel Y contains an object of type scatter.

3차원 포인트 클라우드 전단

x축 상의 전단을 정의하는 아핀 변환 객체를 만듭니다.

A = [1 0.75 0.75 0; ...
     0   1    0  0; ...
     0   0    1  0; ...
     0   0    0  1];
tform = affinetform3d(A);

포인트 클라우드를 변환합니다.

ptCloudOut2 = pctransform(ptCloud,tform);

변환된 포인트 클라우드를 플로팅합니다.

figure3 = figure;
axes3 = axes(Parent=figure3);
pcshow(ptCloudOut2,Parent=axes3,AxesVisibility='on');
xlabel('X');
ylabel('Y');
zlabel('Z');
title({'Shearing of 3-D Point Cloud'},FontSize=14)

Figure contains an axes object. The axes object with title Shearing of 3-D Point Cloud, xlabel X, ylabel Y contains an object of type scatter.

포인트 클라우드를 작업 공간으로 읽어 들입니다.

ptCloud = pcread('teapot.ply');

포인트 클라우드와 같은 크기의 변위 필드 D를 만듭니다.

D = zeros(size(ptCloud.Location));

점의 첫 번째 절반에 대해 x축 상의 변위 필드 값을 7로 설정합니다.

pthalf = ptCloud.Count/2;
D(1:pthalf,1) = 7;

pointCloud 방법 findNeighborsInRadius를 사용하여 관심 영역(ROI) 내 점들의 인덱스를 추출합니다. ROI 내 점들에 대해 x, y, z축 상의 변위 필드 값을 각각 4, 4, -2로 설정합니다.

indices = findNeighborsInRadius(ptCloud,[0 0 3.1],1.5);
D(indices,1:2) = 4;
D(indices,3) = -2;

변위 필드를 사용하여 포인트 클라우드를 변환합니다.

ptCloudOut = pctransform(ptCloud,D);

원래 포인트 클라우드와 변환된 포인트 클라우드를 표시합니다.

figure
pcshow(ptCloud)
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Original 3-D Point Cloud')

Figure contains an axes object. The axes object with title Original 3-D Point Cloud, xlabel X, ylabel Y contains an object of type scatter.

figure
pcshow(ptCloudOut)
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Transformed 3-D Point Cloud Using Displacement Field')

Figure contains an axes object. The axes object with title Transformed 3-D Point Cloud Using Displacement Field, xlabel X, ylabel Y contains an object of type scatter.

입력 인수

모두 축소

포인트 클라우드로, pointCloud 객체로 지정됩니다.

3차원 기하 변환으로, rigidtform3d, simtform3d 또는 affinetform3d 객체로 지정됩니다. 아핀 3차원 tform 입력값을 설정하는 방법에 대한 자세한 내용은 변환 행렬 지정하기 항목을 참조하십시오.

변위 필드로, M×3 또는 M×N×3 배열로 지정됩니다. 변위 필드는 포인트 클라우드의 각 점에 대해 평행 이동의 크기와 방향을 지정하는 변위 벡터 세트입니다. 변위 필드의 크기는 pointCloud 객체의 Location 속성 크기와 같아야 합니다.

데이터형: single | double

출력 인수

모두 축소

변환된 포인트 클라우드로, pointCloud 객체로 반환됩니다. 변환은 점의 좌표와 법선 벡터에 적용됩니다.

확장 기능

C/C++ 코드 생성
MATLAB® Coder™를 사용하여 C 코드나 C++ 코드를 생성할 수 있습니다.

GPU 코드 생성
GPU Coder™를 사용하여 NVIDIA® GPU용 CUDA® 코드를 생성할 수 있습니다.

버전 내역

R2015a에 개발됨

모두 확장