10 #include <vtkSmartPointer.h> 11 #include <vtkPolyData.h> 12 #include <vtkCellArray.h> 13 #include <vtkPolyDataMapper.h> 14 #include <vtkPoints.h> 16 #include <vtkTriangle.h> 17 #include <vtkProperty.h> 18 #include <vtkImageData.h> 19 #include <vtkTexture.h> 20 #include <vtkFloatArray.h> 21 #include <vtkPointData.h> 22 #include <vtkCellData.h> 31 imgpose->
image = image;
35 cv::Mat intrinsics = (cv::Mat_<float>(3,3) << kinfu.
params()->
intr.
fx*2, 0, 1280/2-0.5f + 3,
48 KinFuParams* params = KinFuParams::default_params();
54 if(device.find_first_not_of(
"0123456789") == std::string::npos)
61 std::cout << std::endl <<
"Kinfu does not support pre-Fermi GPU architectures, and is not built for them by default. Exiting..." << std::endl;
77 connect(m_pbStart, SIGNAL(pressed()),
m_timer, SLOT(start()));
79 connect(m_pbStop, SIGNAL(pressed()),
this, SLOT(
finalizeMesh()));
100 this->qvtkWidget->GetRenderWindow()->Render();
101 this->qvtkWidget->update();
165 m_renderer = vtkSmartPointer<vtkRenderer>::New();
166 vtkSmartPointer<vtkRenderWindow> renderWindow = this->qvtkWidget->GetRenderWindow();
178 m_axes = vtkSmartPointer<vtkAxesActor>::New();
180 m_axesWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
181 m_axesWidget->SetOutlineColor( 0.9300, 0.5700, 0.1300 );
194 cv::Mat depth, image, image_copy;
195 static int has_image = 0;
196 static int image_count = 0;
197 static int frame_count = 0;
199 static std::vector<Affine3f> posen;
200 static std::vector<cv::Mat> rvecs;
203 static cv::Mat best_rvec,best_image;
204 static float best_dist=0.0;
209 cv::flip(depth, depth, 1);
210 cv::flip(image, image, 1);
214 std::cout <<
"Can't grab" << std::endl;
225 if(has_image) frame_count++;
229 if (!(
m_kinfu->hasShifted() &&
m_kinfu->isLastScan()) && has_image)
233 double ref_timer = cv::getTickCount();
236 image.copyTo(image_copy);
249 for(
size_t z=0;z<rvecs.size();z++){
250 dist +=
norm(mom_rvec-rvecs[z]);
252 if(dist > best_dist){
256 best_rvec = mom_rvec.clone();
257 best_image = image.clone();
262 if(
true && (frame_count % 7 == 0))
264 cout <<
"STORE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
266 rvecs.push_back(best_rvec);
267 posen.push_back(best_pose);
272 std::cout <<
"image taken "<< image_count++ <<
", time: "<< time << std::endl;
290 m_displayRaycastLabel->setPixmap(
295 QImage::Format_RGB32)));
297 m_displayImageLabel->setPixmap(
299 QImage((
unsigned char*) image.data,
302 QImage::Format_RGB888).rgbSwapped()));
kfusion::KinFu::Ptr m_kinfu
vtkSmartPointer< vtkAxesActor > m_axes
void storePicPose(KinFu &kinfu, Affine3f pose, cv::Mat image)
MeshUpdateThread * m_meshThread
const cuda::CyclicalBuffer & cyclical() const
void updateMesh(vtkActor *)
KF_EXPORTS bool checkIfPreFermiGPU(int device)
void upload(const void *host_ptr, size_t host_step, int rows, int cols)
Uploads data to internal buffer in GPU memory. It calls create() inside to ensure that intenal buffer...
vector< Affine3f > sample_poses_
int rows() const
Returns number of rows.
KF_EXPORTS void printShortCudaDeviceInfo(int device)
Affine3f getCameraPose(int time=-1) const
vtkSmartPointer< vtkOrientationMarkerWidget > m_axesWidget
vtkSmartPointer< vtkRenderer > m_renderer
void addImgPose(ImgPose *imgPose)
__kf_device__ float norm(const float3 &v)
cuda::Depth m_depth_device
OpenNISource * m_openNISource
bool setRegistration(bool value=false)
void download(void *host_ptr, size_t host_step) const
Downloads data from internal buffer to CPU memory. User is resposible for correct host buffer size...
int cols() const
Returns number of elements in each row.
int grab(cv::Mat &depth, cv::Mat &image)
MainWindow(QMainWindow *parent=0)
const KinFuParams & params() const
vtkSmartPointer< vtkRenderWindowInteractor > m_renderWindowInteractor
KF_EXPORTS void setDevice(int device)