#include <cstdlib> // std::abort
#endif
-#if defined __ANDROID__ || defined __unix__ || defined __FreeBSD__ || defined __OpenBSD__ || defined __HAIKU__
+#if defined __ANDROID__ || defined __unix__ || defined __FreeBSD__ || defined __OpenBSD__ || defined __HAIKU__ || defined __Fuchsia__
# include <unistd.h>
# include <fcntl.h>
- #if defined __QNXNTO__
+ #if defined __QNX__
# include <sys/elf.h>
#else
# include <elf.h>
throw;
}
// in 32 bit case alpha channel is used - so require CV_8UC4 type
- m_type = iscolor ? (m_bpp == 32 ? CV_8UC4 : CV_8UC3 ) : CV_8UC1;
+ m_type = iscolor ? ((m_bpp == 32 && m_rle_code != BMP_RGB) ? CV_8UC4 : CV_8UC3 ) : CV_8UC1;
- m_origin = m_height > 0 ? IPL_ORIGIN_BL : IPL_ORIGIN_TL;
+ m_origin = m_height > 0 ? ORIGIN_BL : ORIGIN_TL;
m_height = std::abs(m_height);
if( !result )
EXPECT_PRED_FORMAT2(cvtest::MatComparator(0, 0), rle, ord);
}
+ TEST(Imgcodecs_Bmp, read_32bit_rgb)
+ {
+ const string root = cvtest::TS::ptr()->get_data_path();
+ const string filenameInput = root + "readwrite/test_32bit_rgb.bmp";
+
+ const Mat img = cv::imread(filenameInput, IMREAD_UNCHANGED);
+ ASSERT_FALSE(img.empty());
+ ASSERT_EQ(CV_8UC3, img.type());
+ }
+
+TEST(Imgcodecs_Bmp, rgba_bit_mask)
+{
+ const string root = cvtest::TS::ptr()->get_data_path();
+ const string filenameInput = root + "readwrite/test_rgba_mask.bmp";
+
+ const Mat img = cv::imread(filenameInput, IMREAD_UNCHANGED);
+ ASSERT_FALSE(img.empty());
+ ASSERT_EQ(CV_8UC4, img.type());
+
+ const uchar* data = img.ptr();
+ ASSERT_EQ(data[3], 255);
+}
+
+TEST(Imgcodecs_Bmp, read_32bit_xrgb)
+{
+ const string root = cvtest::TS::ptr()->get_data_path();
+ const string filenameInput = root + "readwrite/test_32bit_xrgb.bmp";
+
+ const Mat img = cv::imread(filenameInput, IMREAD_UNCHANGED);
+ ASSERT_FALSE(img.empty());
+ ASSERT_EQ(CV_8UC4, img.type());
+
+ const uchar* data = img.ptr();
+ ASSERT_EQ(data[3], 255);
+}
+
++
#ifdef HAVE_IMGCODEC_HDR
TEST(Imgcodecs_Hdr, regression)
{
}
CV_Assert(!_image.empty() && _image.type() == CV_8UC1 && (_image.isMat() || _image.isUMat()));
- CV_Assert(_circles.isMat() || _circles.isVector());
- if( dp <= 0 || minDist <= 0 || param1 <= 0 || param2 <= 0)
- CV_Error( Error::StsOutOfRange, "dp, min_dist, canny_threshold and acc_threshold must be all positive numbers" );
+ if( dp <= 0 || minDist <= 0 || param1 <= 0)
+ CV_Error( Error::StsOutOfRange, "dp, min_dist and canny_threshold must be all positive numbers" );
- int cannyThresh = cvRound(param1), accThresh = cvRound(param2), kernelSize = cvRound(param3);
+ switch( method )
+ {
+ case HOUGH_GRADIENT:
+ {
+ int cannyThresh = cvRound(param1), accThresh = cvRound(param2), kernelSize = cvRound(param3);
+ minRadius = std::max(0, minRadius);
- minRadius = std::max(0, minRadius);
+ if( param2 <= 0 )
+ CV_Error( Error::StsOutOfRange, "acc_threshold must be a positive number" );
- if(maxCircles < 0)
- maxCircles = INT_MAX;
+ if(maxCircles < 0)
+ maxCircles = INT_MAX;
- bool centersOnly = (maxRadius < 0);
+ bool centersOnly = (maxRadius < 0);
- if( maxRadius <= 0 )
- maxRadius = std::max( _image.rows(), _image.cols() );
- else if( maxRadius <= minRadius )
- maxRadius = minRadius + 2;
+ if( maxRadius <= 0 )
+ maxRadius = std::max( _image.rows(), _image.cols() );
+ else if( maxRadius <= minRadius )
+ maxRadius = minRadius + 2;
- switch( method )
- {
- case CV_HOUGH_GRADIENT:
if (type == CV_32FC3)
HoughCirclesGradient<Vec3f>(_image, _circles, (float)dp, (float)minDist,
minRadius, maxRadius, cannyThresh,