1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Merge pull request #27573 from asmorkalov:as/bool_mask_part1

CV_Bool support for masks in 3d module.
This commit is contained in:
Alexander Smorkalov
2025-07-28 18:42:48 +03:00
committed by GitHub
10 changed files with 12 additions and 11 deletions
+2 -1
View File
@@ -2127,7 +2127,8 @@ CV_EXPORTS_W int decomposeHomographyMat(InputArray H,
@param beforePoints Vector of (rectified) visible reference points before the homography is applied
@param afterPoints Vector of (rectified) visible reference points after the homography is applied
@param possibleSolutions Vector of int indices representing the viable solution set after filtering
@param pointsMask optional Mat/Vector of 8u type representing the mask for the inliers as given by the #findHomography function
@param pointsMask optional Mat/Vector of CV_8U, CV_8S or CV_Bool type representing the mask for the inliers
as given by the #findHomography function
This function is intended to filter the output of the #decomposeHomographyMat based on additional
information as described in @cite Malis2007 . The summary of the method: the #decomposeHomographyMat function
+1 -1
View File
@@ -132,7 +132,7 @@ CV_EXPORTS_W void rescaleDepth(InputArray in, int type, OutputArray out, double
* This function can be used to visualize the results of the Odometry algorithm.
* @param depth Depth data, should be 1-channel CV_16U, CV_16S, CV_32F or CV_64F
* @param image RGB image (optional), should be 1-, 3- or 4-channel CV_8U
* @param mask Mask of used pixels (optional), should be CV_8UC1
* @param mask Mask of used pixels (optional), should be CV_8UC1, CV_8SC1 or CV_BoolC1
* @param Rt Rotation+translation matrix (3x4 or 4x4) to be applied to depth points
* @param cameraMatrix Camera intrinsics matrix (3x3)
* @param warpedDepth The warped depth data (optional)
+1 -1
View File
@@ -506,7 +506,7 @@ void filterHomographyDecompByVisibleRefpoints(InputArrayOfArrays _rotations,
InputArray _pointsMask)
{
CV_Assert(_beforeRectifiedPoints.type() == CV_32FC2 && _afterRectifiedPoints.type() == CV_32FC2);
CV_Assert(_pointsMask.empty() || _pointsMask.type() == CV_8U);
CV_Assert(_pointsMask.empty() || _pointsMask.type() == CV_8U || _pointsMask.type() == CV_8S || _pointsMask.type() == CV_Bool);
Mat beforeRectifiedPoints = _beforeRectifiedPoints.getMat();
Mat afterRectifiedPoints = _afterRectifiedPoints.getMat();
+1 -1
View File
@@ -466,7 +466,7 @@ struct LevMarqDenseLinearBackend : public detail::LevMarqBackend
if (!mask_.empty())
{
CV_Assert(mask_.depth() == CV_8U);
CV_Assert(mask_.depth() == CV_8U || mask_.depth() == CV_8S || mask_.depth() == CV_Bool);
CV_Assert(mask_.size() == currentX_.size());
int maskSize = mask_.size().area();
this->mask.create(maskSize, 1);
+1 -1
View File
@@ -86,7 +86,7 @@ public:
cb->computeError( m1, m2, model, err );
mask.create(err.size(), CV_8U);
CV_Assert( err.isContinuous() && err.type() == CV_32F && mask.isContinuous() && mask.type() == CV_8U);
CV_Assert( err.isContinuous() && err.type() == CV_32F && mask.isContinuous() && (mask.type() == CV_8S || mask.type() == CV_8U || mask.type() == CV_Bool));
const float* errptr = err.ptr<float>();
uchar* maskptr = mask.ptr<uchar>();
float t = (float)(thresh*thresh);
+1 -1
View File
@@ -118,7 +118,7 @@ static void drawTriangle(Vec4f verts[3], Vec3f colors[3], Mat& depthBuf, Mat& co
static void linearizeDepth(const Mat& inbuf, const Mat& validMask, Mat outbuf, double zFar, double zNear)
{
CV_Assert(inbuf.type() == CV_32FC1);
CV_Assert(validMask.type() == CV_8UC1);
CV_Assert(validMask.type() == CV_8UC1 || validMask.type() == CV_8SC1 || validMask.type() == CV_BoolC1);
CV_Assert(outbuf.type() == CV_32FC1);
CV_Assert(outbuf.size() == inbuf.size());
+1 -1
View File
@@ -52,7 +52,7 @@ size_t convertDepthToFloat(const cv::Mat& depth, const cv::Mat& mask, float scal
cv::Mat_<uchar> uchar_mask = mask;
if (mask.depth() != CV_8U)
if ((mask.depth() != CV_8S) && (mask.depth() != CV_8U) && (mask.depth() != CV_Bool))
mask.convertTo(uchar_mask, CV_8U);
u_mat = cv::Mat_<float>(depth_size.area(), 1);
+1 -1
View File
@@ -358,7 +358,7 @@ void warpFrame(InputArray depth, InputArray image, InputArray mask,
Mat_<uchar> maskMat;
if (!mask.empty())
{
CV_Assert(mask.type() == CV_8UC1);
CV_Assert(mask.type() == CV_8UC1 || mask.type() == CV_8SC1 || mask.type() == CV_BoolC1);
CV_Assert(mask.size() == sz);
maskMat = mask.getMat();
}
+2 -2
View File
@@ -273,7 +273,7 @@ static void prepareRGBFrameBase(OdometryFrame& frame, OdometrySettings settings)
}
else
{
CV_Assert(mask.type() == CV_8UC1);
CV_Assert(mask.type() == CV_8UC1 || mask.type() == CV_8SC1 || mask.type() == CV_BoolC1);
CV_Assert(mask.size() == grayImage.size());
cv::bitwise_and(mask, depthMask, frame.impl->mask);
}
@@ -358,7 +358,7 @@ static void prepareICPFrameBase(OdometryFrame& frame, OdometrySettings settings)
}
else
{
CV_Assert(mask.type() == CV_8UC1);
CV_Assert(mask.type() == CV_8UC1 || mask.type() == CV_8SC1 || mask.type() == CV_BoolC1);
CV_Assert(mask.size() == scaledDepth.size());
cv::bitwise_and(mask, depthMask, frame.impl->mask);
}
@@ -556,7 +556,7 @@ private:
_rotations.swap(rotations);
_normals.swap(normals);
_mask = Mat(514, 1, CV_8U, maskArray).clone();
_mask = Mat(514, 1, CV_8S, maskArray).clone();
}
bool isValidResult(const vector<int>& solutions)