using namespace cv;\r
using namespace std;\r
\r
-class CV_FFmpegWriteBigImagesTest : public cvtest::BaseTest\r
+class CV_FFmpegWriteBigImageTest : public cvtest::BaseTest\r
{\r
public:\r
void run(int)\r
}\r
};\r
\r
+string ext_from_int(int ext)\r
+{\r
+ if (ext == 0) return ".png";\r
+ if (ext == 1) return ".jpg";\r
+ if (ext == 2) return ".bmp";\r
+ if (ext == 3) return ".pgm";\r
+ if (ext == 4) return ".tiff";\r
+}\r
+\r
+class CV_FFmpegWriteSequenceImageTest : public cvtest::BaseTest\r
+{\r
+ public:\r
+ void run(int)\r
+ {\r
+ try\r
+ {\r
+ const int img_r = 640;\r
+ const int img_c = 480;\r
+ Size frame_s = Size(img_c, img_r);\r
+\r
+ for (size_t ext = 0; ext < 5; ++ext) // 0 - png, 1 - jpg, 2 - bmp, 3 - pgm, 4 - tiff\r
+ for (size_t k = 1; k <= 3; ++k)\r
+ for (size_t num_channels = 1; num_channels <= 4; ++num_channels)\r
+ for (size_t depth = CV_8U; depth <= CV_16U; ++depth)\r
+ {\r
+ Mat img(img_r * k, img_c * k, CV_MAKETYPE(depth, num_channels), Scalar::all(0));\r
+ circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));\r
+ imwrite(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext), img);\r
+ Mat img_test = imread(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext));\r
+ CV_Assert(img.size() == img_test.size());\r
+ CV_Assert(img.type() == img_test.type());\r
+ if (countNonZero(img != img_test) != 0)\r
+ ts->set_failed_test_info(cvtest::TS::FAIL_GENERIC);\r
+ }\r
+ }\r
+ catch(...)\r
+ {\r
+ ts->set_failed_test_info(cvtest::TS::FAIL_EXCEPTION);\r
+ }\r
+ ts->set_failed_test_info(cvtest::TS::OK);\r
+ }\r
+};\r
+\r
\r
-TEST(Highgui_FFmpeg_WriteBigImage, regression) { CV_FFmpegWriteBigImagesTest test; test.safe_run(); }\r
-TEST(Highgui_FFmpeg_WriteBigVideo, regression) { CV_FFmpegWriteBigVideoTest test; test.safe_run(); }\r
+TEST(Highgui_FFmpeg_WriteSequenceImage, regression) { CV_FFmpegWriteSequenceImageTest test; test.safe_run(); }\r
+TEST(Highgui_FFmpeg_WriteBigImage, regression) { CV_FFmpegWriteBigImageTest test; test.safe_run(); }\r
+TEST(Highgui_FFmpeg_WriteBigVideo, regression) { CV_FFmpegWriteBigVideoTest test; test.safe_run(); }\r