Skip to content

beam_cv

Jake McLaughlin edited this page Aug 19, 2019 · 4 revisions

beam_cv

This module contains commonly used image processing/computer vision operations used throughout beam_robotics

Classes

RayCast.cpp

This file contains the implementation for our ray casting algorithm with a customizable function for the behaviour when a ray hits a point.

Utils.cpp

This file contains commonly used functions including morphological operations, segmentation, histogram equalization etc...

DepthMap.cpp

This class represents a point cloud as a depth image. It contains operations to convert between point clouds and depth images, means of upsampling the depth data, and performing geometric calculations on the depth data.

Example Usage

#include "beam_cv/DepthMap.h"
#include "beam_cv/Utils.h"
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

int main() {
    Mat img = imread(image_location, IMREAD_COLOR);
    shared_ptr<beam_calibration::CameraModel> F1 = beam_calibration::CameraModel::LoadJSON(intrinsics_loc);
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
    pcl::io::loadPCDFile<pcl::PointXYZ>(cur_dir + "test.pcd", *cloud);
    beam_cv::DepthMap dm(F1, cloud);
    dm.ExtractDepthMap(0.001, 3);
    dm.KMeansCompletioN(11, img)
    Mat viz = beam_cv::VisualizeDepthImage(dm.GetDepthImage());
    imshow("Depth Image", viz);
    waitKey(0);
}
Clone this wiki locally