code for projecting a 3D point cloud to a 2D image using the intrinsic parameters of a camera as well as its extrinsic parameters.
config: Contains yaml fileinclude: Contains yaml parser and projection headeroutput: To store outputresources: Contains example image and pcd filesrc: Implementation and example code.
Latest version should work
OpenCVPCLyaml-cpp
Change config parameter accordingly
-
extrinsicTranslationorTr: 3 x 4 extrinsic camera matrix -
projectionMatrixorP0: 3 x 4 projection matrix
git clone https://github.com/Basavaraj-PN/project-pointcloud-on-image.git
cd project-pointcloud-on-image
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
makeRun pointcloud_to_image in build directory
./pointcloud_to_image ,----------------------------------------.
|Read image, pointcloud and config files |
|----------------------------------------|
`----------------------------------------'
|
,-----------------------------------------.
|Filter pointcloud that are behind camera |
|-----------------------------------------|
`-----------------------------------------'
|
,-----------------------------------------.
|Convert pointcloud to homogeneous matrix |
|-----------------------------------------|
`-----------------------------------------'
|
,----------------------------------------------------------------------.
|Project pointcloud to camera coordinate with camera extrinsic matrix |
|----------------------------------------------------------------------|
`----------------------------------------------------------------------'
|
,----------------------------------.
|Normalize points by dividing depth|
|----------------------------------|
`----------------------------------'
|
,-------------------------------------------------------------.
|Project points on image plane by multiplying intrinsic matrix|
|-------------------------------------------------------------|
`-------------------------------------------------------------'
