본문 바로가기
C++ 200제/코딩 IT 정보

PCL 1.5 설치 (윈도우7 64비트, VisualStudio2008) [PointCloudLibrary]

by vicddory 2017. 8. 17.

PCL 1.5 설치 (윈도우7 64비트, VisualStudio2008) [PointCloudLibrary]


1. 설치 환경


- Windows 7 64bit

- Visual Studio 2008

- PCL 1.5.1 32bit


윈도우 환경에서 PCL을 설치하는 포스트. 우분투에선 설치하는 과정이 너무 쉬워 별도의 포스팅은 남기지 않는다. 이 포스트의 맨 마지막에 짤막하게 적어놓는다.


2. PCL 설치 파일 다운로드



PCL 설치[3D 오픈소스 라이브러리] 3D

맨 좌측의 MSVC(2008) 32비트를 다운로드한다.


어떤 환경에서 구성될지 모르니, 되도록 32비트를 사용하자. 아래의 그림은 PCL에 포함된 3rd party 라이브러리인데 별도로 받을 수도 있다. 위의 설치 파일에 포함된 사항이기에 일반적으론 별도의 파일을 다운 받지 않아도 된다.


PCL 라이브러리[3D 오픈소스 라이브러리] 3D


3. PCL 1.5.1 설치


아래 그림처럼 별도의 조작 없이 "다음" 버튼을 눌러 설치를 진행한다.


PCL 1.5.1

(모든 사용자에게 시스템 경로를 이용할 수 있도록 설정)


PCL 1.5.1 설치

(3rd Party 라이브러리들은 필요하니 모두 설치)


PCL 윈도우 설치

(설치 경로는 각자 알아서)


PCL OpenNI

(설치 경로는 각자 알아서 2)


PCL 1.5.1 AllinOne Win64[C++ 그래픽 라이브러리] Graphic Library

(이 화면이 보인다면 설치가 완료된 것)

4. 샘플 프로젝트 생성


비주얼 스튜디오 2008을 실행시켜 새 프로젝트를 만들어 보자.


PCL 데모[C++ 그래픽 라이브러리] Graphic Library


위의 그림처럼, 새 프로젝트 형식에서 "Win32 콘솔 응용 프로그램"을 선택하고, 이름은 자유롭게 선택한다.


프로젝트 생성 완료 후 "ALT + F7"을 눌러 속성 페이지를 연다.


PCL 비주얼스튜디오[3D 오픈소스 라이브러리] 3D


구성 속성 - C/C++ - 일반 - 추가 포함 디렉터리에 아래 항목을 추가한다.


1
2
3
4
5
6
"C:\Program Files\PCL 1.5.1\include\pcl-1.5";
"C:\Program Files\PCL 1.5.1\3rdParty\Boost\include";
"C:\Program Files\PCL 1.5.1\3rdParty\Eigen\include";
"C:\Program Files\PCL 1.5.1\3rdParty\Flann\include";
"C:\Program Files\PCL 1.5.1\3rdParty\Qhull\include";
"C:\Program Files\PCL 1.5.1\3rdParty\VTK\include"
cs


이어서, 구성 속성 - 링커 - 일반 - 추가 라이브러리 디렉터리에 아래 항목을 추가한다.


PCL 윈도우 샘플[3D 오픈소스 라이브러리] 3D


1
2
3
4
5
"C:\Program Files\PCL 1.5.1\lib";
"C:\Program Files\PCL 1.5.1\3rdParty\Boost\lib";
"C:\Program Files\PCL 1.5.1\3rdParty\Flann\lib";
"C:\Program Files\PCL 1.5.1\3rdParty\Qhull\lib";
"C:\Program Files\PCL 1.5.1\3rdParty\VTK\lib\vtk-5.8"
cs


이제 전역 함수를 추가할 차례다.


전역 함수는 프로젝트 어느 곳에서든 PCL 라이브러리를 사용할 수 있도록 지원한다.


stdafx.h 파일에 아래 항목을 추가한다.


1
2
3
4
5
#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
cs


stdafx.cpp 파일에도 아래 항목을 추가한다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifdef _DEBUG
#pragma comment(lib, "pcl_apps_debug.lib")
#pragma comment(lib, "pcl_common_debug.lib")
#pragma comment(lib, "pcl_features_debug.lib")
#pragma comment(lib, "pcl_filters_debug.lib")
#pragma comment(lib, "pcl_io_debug.lib")
#pragma comment(lib, "pcl_io_ply_debug.lib")
#pragma comment(lib, "pcl_kdtree_debug.lib")
#pragma comment(lib, "pcl_keypoints_debug.lib")
#pragma comment(lib, "pcl_octree_debug.lib")
#pragma comment(lib, "pcl_registration_debug.lib")
#pragma comment(lib, "pcl_sample_consensus_debug.lib")
#pragma comment(lib, "pcl_search_debug.lib")
#pragma comment(lib, "pcl_segmentation_debug.lib")
#pragma comment(lib, "pcl_surface_debug.lib")
#pragma comment(lib, "pcl_tracking_debug.lib")
#pragma comment(lib, "pcl_visualization_debug.lib")
#else
#pragma comment(lib, "pcl_apps_release.lib")
#pragma comment(lib, "pcl_common_release.lib")
#pragma comment(lib, "pcl_features_release.lib")
#pragma comment(lib, "pcl_filters_release.lib")
#pragma comment(lib, "pcl_io_release.lib")
#pragma comment(lib, "pcl_io_ply_release.lib")
#pragma comment(lib, "pcl_kdtree_release.lib")
#pragma comment(lib, "pcl_keypoints_release.lib")
#pragma comment(lib, "pcl_octree_release.lib")
#pragma comment(lib, "pcl_registration_release.lib")
#pragma comment(lib, "pcl_sample_consensus_release.lib")
#pragma comment(lib, "pcl_search_release.lib")
#pragma comment(lib, "pcl_segmentation_release.lib")
#pragma comment(lib, "pcl_surface_release.lib")
#pragma comment(lib, "pcl_tracking_release.lib")
#pragma comment(lib, "pcl_visualization_release.lib")
#endif
cs


복사하기 귀찮은 분들은 아래 파일을 다운 받으시라. 위의 내용을 담은 txt 파일이다.



이제, 예제 소스 코드를 넣어서 PCL의 기능을 확인할 차례다.


메인 cpp 파일에 아래 항목을 추가한다. 아래 코드는 어느 감사한 분이 만들어 놓으셨다.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "stdafx.h"
 
using namespace std;
using namespace pcl;
using namespace io;
 
int _tmain(int argc, _TCHAR* argv[])
{
    PointCloud<PointXYZ> cloud;
 
    // 10000x1 짜리 xyz point cloud data buffer를 할당한다.
    cloud.width    = 10000;
    cloud.height   = 1;
    cloud.is_dense = false;
    cloud.points.resize (cloud.width * cloud.height);
 
    //랜덤 값을 넣어준다.
    for (size_t i = 0; i < cloud.points.size (); ++i) {
        cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
        cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
        cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
    }
 
    //  값을 저장한다.
    savePCDFileASCII ("test_pcd.pcd", cloud);
    cerr << "Hello World" << endl;
    cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << endl;
 
    pcl::visualization::CloudViewer viewer("PCL Viewer"); 
    viewer.showCloud(cloud.makeShared()); 
 
    while (!viewer.wasStopped());
 
    return 0;
}
cs

5. 샘플 프로젝트 구동


프로그램을 실행하면 아래와 같은 두 개의 화면이 보인다.

랜덤으로 생성된 좌표와 이 좌표를 3D 공간에 뿌려준 것이다.


PCL 예제[C++ 그래픽 라이브러리] Graphic Library


PCL 예제 결과[3D 오픈소스 라이브러리] 3D


좌표 정보는 PCD(Point Cloud Data) 확장자로 별도 저장이 된다. PCD는 PCL 라이브러리에서 불러와 사용할 수 있다.


PCL PCD 확장자[C++ 그래픽 라이브러리] Graphic Library


6. 프로젝트 에러/경고 사항 해결


1) vtkCommand.h: No such file or directory


PCL 설치 에러[C++ 그래픽 라이브러리] Graphic Library


단순한 에러다.

stdafx.h와 stdafx.cpp 파일을 다시 확인하라. 내 경우엔 헤더와 cpp에 들어갈 내용을 거꾸로 넣었더니 저렇게 되었다.



2) ... ... ... 찾을 수 없거나 마지막 증분 링크에 의해 빌드되지 않았습니다. 

이글루스의 Dreamer님이 해결책을 포스팅하셨다.




3) error C3859: PCH에 대한 가상 메모리 범위를 초과했습니다.

네이버의 찐남자님이 해결책을 포스팅하셨다.



7. 우분투에 설치


우분투에선 별도의 포스팅 남기지 않아도 될 정도로 아주 간단히 설치가 된다.

정말 간단하다.


1
2
3
$ sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
$ sudo apt-get update
$ sudo apt-get install libpcl-all
cs


PCL 1.5 설치 (윈도우7 64비트, VisualStudio2008) [PointCloudLibrary]

댓글