mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
added test for 4 channel tiff
This commit is contained in:
parent
7927ebf20e
commit
9f80c6c989
@ -124,6 +124,36 @@ public:
|
||||
ts->set_failed_test_info(ts->FAIL_MISMATCH);
|
||||
}
|
||||
}
|
||||
if (ext == 3 /*TIFF*/)
|
||||
{
|
||||
/* 4 channels should stay 4 channels */
|
||||
int num_channels = 4;
|
||||
ts->printf(ts->LOG, "image type depth:%d channels:%d ext: %s\n", CV_8U,num_channels, ext_from_int(ext).c_str());
|
||||
Mat img(img_r * k, img_c * k, CV_MAKETYPE(CV_8U, num_channels), Scalar::all(0));
|
||||
circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));
|
||||
|
||||
string img_path = cv::tempfile(ext_from_int(ext).c_str());
|
||||
ts->printf(ts->LOG, "writing image : %s\n", img_path.c_str());
|
||||
imwrite(img_path, img);
|
||||
|
||||
ts->printf(ts->LOG, "reading test image : %s\n", img_path.c_str());
|
||||
Mat img_test = imread(img_path, CV_LOAD_IMAGE_UNCHANGED);
|
||||
|
||||
if (img_test.empty()) ts->set_failed_test_info(ts->FAIL_MISMATCH);
|
||||
|
||||
CV_Assert(img.size() == img_test.size());
|
||||
CV_Assert(img.type() == img_test.type());
|
||||
CV_Assert(img.channels() == 4);
|
||||
|
||||
double n = norm(img, img_test);
|
||||
if ( n > 1.0)
|
||||
{
|
||||
ts->printf(ts->LOG, "norm = %f \n", n);
|
||||
ts->set_failed_test_info(ts->FAIL_MISMATCH);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef HAVE_JPEG
|
||||
|
Loading…
Reference in New Issue
Block a user