Skip to content

Commit

Permalink
feat: changed the way the image is read
Browse files Browse the repository at this point in the history
  • Loading branch information
LevDenisov committed Oct 25, 2023
1 parent 63998cc commit a71553d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
10 changes: 7 additions & 3 deletions benchmark/python-benchmark/benchmark_process_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
config_path = data_dir / Path("config") / Path("TUM_fr3_long_val.ini")
intrinsics_path = data_dir / Path("config") / Path("intrinsics.K")


def benchmarkProcessCloud():
NUMBER_OF_RUNS = 10

Expand All @@ -22,11 +23,13 @@ def benchmarkProcessCloud():

print("Image Height:", image.height, "Image Width:", image.width, '\n')

coarse_algorithm = deplex.PlaneExtractor(image_height=image.height, image_width=image.width, config=config)

for i in range(NUMBER_OF_RUNS):
start_time = timeit.default_timer()

pcd_points = image.transform_to_pcd(camera_intrinsic)
coarse_algorithm = deplex.PlaneExtractor(image_height=image.height, image_width=image.width, config=config)

labels = coarse_algorithm.process(pcd_points)

end_time = timeit.default_timer()
Expand Down Expand Up @@ -56,7 +59,8 @@ def benchmarkProcessCloud():
print('Elapsed time (ms.) (mean):', f"{elapsed_time_mean:.5f}")
print('FPS (max):', f"{1000 / elapsed_time_min:.5f}")
print('FPS (min):', f"{1000 / elapsed_time_max:.5f}")
print('FPS (mean):', f"{1000 /elapsed_time_mean:.5f}")
print('FPS (mean):', f"{1000 / elapsed_time_mean:.5f}")


if __name__ == '__main__':
benchmarkProcessCloud()
benchmarkProcessCloud()
13 changes: 8 additions & 5 deletions benchmark/python-benchmark/benchmark_process_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
config_path = data_dir / Path("config") / Path("TUM_fr3_long_val.ini")
intrinsics_path = data_dir / Path("config") / Path("intrinsics.K")


def benchmarkProcessSequence():
NUMBER_OF_SNAPSHOT = 50
NUMBER_OF_SNAPSHOT = 1

execution_time = []

Expand All @@ -26,12 +27,13 @@ def benchmarkProcessSequence():

print("Image Height:", image.height, "Image Width:", image.width, '\n')

coarse_algorithm = deplex.PlaneExtractor(image_height=image.height, image_width=image.width, config=config)

for i in range(NUMBER_OF_SNAPSHOT):
start_time = timeit.default_timer()

image = DepthImage(str(os.path.join(data_dir / Path("depth"), images[i])))
image.reset(str(os.path.join(data_dir / Path("depth"), images[i])))
pcd_points = image.transform_to_pcd(camera_intrinsic)
coarse_algorithm = deplex.PlaneExtractor(image_height=image.height, image_width=image.width, config=config)
labels = coarse_algorithm.process(pcd_points)

end_time = timeit.default_timer()
Expand Down Expand Up @@ -61,7 +63,8 @@ def benchmarkProcessSequence():
print('Elapsed time (ms.) (mean):', f"{elapsed_time_mean:.5f}")
print('FPS (max):', f"{1000 / elapsed_time_min:.5f}")
print('FPS (min):', f"{1000 / elapsed_time_max:.5f}")
print('FPS (mean):', f"{1000 /elapsed_time_mean:.5f}")
print('FPS (mean):', f"{1000 / elapsed_time_mean:.5f}")


if __name__ == '__main__':
benchmarkProcessSequence()
benchmarkProcessSequence()
3 changes: 2 additions & 1 deletion cpp/pybind/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void pybind_depth_image(py::module& m) {
.def(py::init<std::string>(), py::arg("image_path"))
.def_property_readonly("height", &utils::DepthImage::getHeight)
.def_property_readonly("width", &utils::DepthImage::getWidth)
.def("transform_to_pcd", &utils::DepthImage::toPointCloud, py::arg("intrinsics"));
.def("transform_to_pcd", &utils::DepthImage::toPointCloud, py::arg("intrinsics"))
.def("reset", &utils::DepthImage::reset, py::arg("image_path"));
}
} // namespace deplex

0 comments on commit a71553d

Please sign in to comment.