Ask Your Question
0

C++ read rgb+depth images sequentially

asked 2018-05-03 02:50:40 -0500

updated 2018-05-08 08:08:11 -0500

Hi, i have a dataset that contains 250 rgb and depth images. Every rgb image has a depth image, like this: img_1.png, img_1_depth.png, img_2.png, img_2_depth.png ... and so on.

I would read rgb image + depth image and save the associated point cloud on pcd file. I read like this:

cv::Mat input_rgb = cv::imread("src/dataset-path/img_1.png", cv::IMREAD_COLOR);
cv::Mat input_depth = cv::imread("src/dataset-path/image_1_depth.png", cv::IMREAD_ANYDEPTH);

but i can't read, with for loop , every images sequentially.

How can i do?

Thanks!

edit retag flag offensive close merge delete

Comments

Excuse me! How can you have depth images? Which camera do you use? Thank

hoang anh tuan gravatar imagehoang anh tuan ( 2018-05-09 03:24:15 -0500 )edit

Hi, i used a dataset that you download from http://rgbd-dataset.cs.washington.edu... Otherwise you can use Microsoft Kinect but i don't know how to retrieve depth from it.

pipeline0 gravatar imagepipeline0 ( 2018-05-10 14:35:21 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
4

answered 2018-05-03 03:00:45 -0500

berak gravatar image

cv::imread(cv::format("src/dataset-path/img_%d.png", index), cv::IMREAD_COLOR);

edit flag offensive delete link more

Comments

Thank you, it works for me.

pipeline0 gravatar imagepipeline0 ( 2018-05-07 08:41:35 -0500 )edit
1

answered 2018-05-03 02:58:04 -0500

LBerger gravatar image

You can use :

  1. glob to get all file names in a folder
  2. videocpature to read a sequence of ordered file like a video see example
edit flag offensive delete link more

Comments

Thanks for suggests!

pipeline0 gravatar imagepipeline0 ( 2018-05-07 08:42:13 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-05-03 02:50:40 -0500

Seen: 161 times

Last updated: May 08