-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(image_projection_based_fusion): add cache for camera projection #9635
Merged
technolojin
merged 20 commits into
autowarefoundation:main
from
a-maumau:mau/perf/image_projection_based_fusion/add_projection_cache
Dec 24, 2024
+522
−167
Merged
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2609e4b
add camera_projection class and projection cache
a-maumau c0bb6b3
style(pre-commit): autofix
pre-commit-ci[bot] b445034
fix FOV filtering
a-maumau b335631
style(pre-commit): autofix
pre-commit-ci[bot] f02e691
remove unused includes
a-maumau acd69a8
update schema
a-maumau c34003b
fix cpplint error
a-maumau e8b5b2f
apply suggestion: more simple and effcient computation
a-maumau bc1e8ed
correct terminology
a-maumau d2056ca
style(pre-commit): autofix
pre-commit-ci[bot] 36dc896
fix comments
a-maumau 82e97ce
fix var name
a-maumau d28ff16
fix variable names
a-maumau a094379
fix variable names
a-maumau ad2a204
fix variable names
a-maumau edce9da
fix variable names
a-maumau 542ed48
fix variable names
a-maumau 94a0d78
fix initialization
a-maumau c3317ac
add verification to point_project_to_unrectified_image when loading
a-maumau 3b0bbd0
chore: add option description to project points to unrectified image
technolojin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...jection_based_fusion/include/autoware/image_projection_based_fusion/camera_projection.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2024 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef AUTOWARE__IMAGE_PROJECTION_BASED_FUSION__CAMERA_PROJECTION_HPP_ | ||
#define AUTOWARE__IMAGE_PROJECTION_BASED_FUSION__CAMERA_PROJECTION_HPP_ | ||
|
||
#define EIGEN_MPL2_ONLY | ||
|
||
#include <Eigen/Core> | ||
#include <opencv2/core/core.hpp> | ||
|
||
#include <sensor_msgs/msg/camera_info.hpp> | ||
|
||
#include <image_geometry/pinhole_camera_model.h> | ||
|
||
#include <memory> | ||
|
||
namespace autoware::image_projection_based_fusion | ||
{ | ||
struct PixelPos | ||
{ | ||
float x; | ||
float y; | ||
}; | ||
|
||
class CameraProjection | ||
{ | ||
public: | ||
explicit CameraProjection( | ||
const sensor_msgs::msg::CameraInfo & camera_info, const float grid_cell_width, | ||
const float grid_cell_height, const bool unrectify, const bool use_approximation); | ||
CameraProjection() : cell_width_(1.0), cell_height_(1.0), unrectify_(false) {} | ||
void initialize(); | ||
std::function<bool(const cv::Point3d &, Eigen::Vector2d &)> calcImageProjectedPoint; | ||
sensor_msgs::msg::CameraInfo getCameraInfo(); | ||
bool isOutsideHorizontalView(const float px, const float pz); | ||
bool isOutsideVerticalView(const float py, const float pz); | ||
bool isOutsideFOV(const float px, const float py, const float pz); | ||
|
||
protected: | ||
bool calcRectifiedImageProjectedPoint( | ||
const cv::Point3d & point3d, Eigen::Vector2d & projected_point); | ||
bool calcRawImageProjectedPoint(const cv::Point3d & point3d, Eigen::Vector2d & projected_point); | ||
bool calcRawImageProjectedPointWithApproximation( | ||
const cv::Point3d & point3d, Eigen::Vector2d & projected_point); | ||
void initializeCache(); | ||
|
||
sensor_msgs::msg::CameraInfo camera_info_; | ||
uint32_t image_height_, image_width_; | ||
double tan_h_x_, tan_h_y_; | ||
double fov_left_, fov_right_, fov_top_, fov_bottom_; | ||
|
||
uint32_t cache_size_; | ||
float cell_width_; | ||
float cell_height_; | ||
float inv_cell_width_; | ||
float inv_cell_height_; | ||
int grid_width_; | ||
int grid_height_; | ||
|
||
bool unrectify_; | ||
bool use_approximation_; | ||
|
||
std::unique_ptr<PixelPos[]> projection_cache_; | ||
image_geometry::PinholeCameraModel camera_model_; | ||
}; | ||
|
||
} // namespace autoware::image_projection_based_fusion | ||
|
||
#endif // AUTOWARE__IMAGE_PROJECTION_BASED_FUSION__CAMERA_PROJECTION_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point_project_to_unrectified_image
parameter was missing from previous PR, could also add it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved 3b0bbd0