Skip to content

Instantly share code, notes, and snippets.

@onauparc
onauparc / C++ Predict with caffe
Created June 17, 2014 13:36
sample code for caffe C++ prediction
#include <cuda_runtime.h>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <string>
#include <iostream>
#include <stdio.h>
#include "caffe/caffe.hpp"
//in opencv/modules/viz/include/opencv2/viz/types.hpp
static Mesh load(InputArray pointCloud);
//in opencv/modules/viz/src/types.cpp
cv::viz::Mesh cv::viz::Mesh::load((InputArray pointCloud){
vtkSmartPointer<vtkCloudMatSource> cloud_source = vtkSmartPointer<vtkCloudMatSource>::New();
cloud_source->SetCloud(pointCloud);
cloud_source->Update();
vtkSmartPointer<vtkPolyData> polydata = cloud_source->GetOutput();