1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +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
+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);
}