-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathread_image.cpp
More file actions
32 lines (24 loc) · 791 Bytes
/
read_image.cpp
File metadata and controls
32 lines (24 loc) · 791 Bytes
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
//
// Created by dinhnambkhn on 21. 11. 28..
//
#include <iostream>
#include "open3d/Open3D.h"
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/core.hpp>
int main() {
//read image file
open3d::geometry::Image image;
open3d::io::ReadImage("/home/dinhnambkhn/Open3D/examples/test_data/lena_color.jpg", image);
//check image is empty or not
if (image.IsEmpty()) {
std::cout << "Image is empty" << std::endl;
} else {
std::cout << "Image is not empty" << std::endl;
}
//create a share d pointer of image
std::shared_ptr<open3d::geometry::Image> image_ptr = std::make_shared<open3d::geometry::Image>(image);
//draw the image_ptr
open3d::visualization::DrawGeometries({image_ptr});
return 0;
}