SMACC2
Loading...
Searching...
No Matches
cp_table_plane.cpp
Go to the documentation of this file.
1// Copyright 2026 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
17
18namespace cl_rgb
19{
20
21CpTablePlane::CpTablePlane(const TableParams & params) : params_(params) {}
22
24
25std::optional<cv::Vec3d> CpTablePlane::pointUnderPixel(
26 const PinholeCamera & camera, double u, double v, double heightAboveTable) const
27{
28 return camera.pixelToPlane(u, v, params_.height + heightAboveTable);
29}
30
31cv::Mat CpTablePlane::regionMask(const PinholeCamera & camera, const cv::Size & size) const
32{
33 return tableRegionMask(camera, size, params_);
34}
35
36bool CpTablePlane::contains(double x, double y, double margin) const
37{
38 return x >= params_.xMin + margin && x <= params_.xMax - margin && y >= params_.yMin + margin &&
39 y <= params_.yMax - margin;
40}
41
42} // namespace cl_rgb
bool contains(double x, double y, double margin=0.0) const
cv::Mat regionMask(const PinholeCamera &camera, const cv::Size &size) const
CpTablePlane(const TableParams &params)
std::optional< cv::Vec3d > pointUnderPixel(const PinholeCamera &camera, double u, double v, double heightAboveTable=0.0) const
cv::Mat tableRegionMask(const PinholeCamera &camera, const cv::Size &size, const TableParams &table)
std::optional< cv::Vec3d > pixelToPlane(double u, double v, double z) const
Definition geometry.cpp:35