forked from opencv/opencv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
- Loading branch information
Showing
14 changed files
with
394 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html | ||
#include "test_precomp.hpp" | ||
#include "test_common.hpp" | ||
|
||
namespace opencv_test { | ||
|
||
static | ||
Mat generateTestImageBGR_() | ||
{ | ||
Size sz(640, 480); | ||
Mat result(sz, CV_8UC3, Scalar::all(0)); | ||
|
||
const string fname = cvtest::findDataFile("../cv/shared/baboon.png"); | ||
Mat image = imread(fname, IMREAD_COLOR); | ||
CV_Assert(!image.empty()); | ||
CV_CheckEQ(image.size(), Size(512, 512), ""); | ||
Rect roi((640-512) / 2, 0, 512, 480); | ||
image(Rect(0, 0, 512, 480)).copyTo(result(roi)); | ||
result(Rect(0, 0, 5, 5)).setTo(Scalar(0, 0, 255)); // R | ||
result(Rect(5, 0, 5, 5)).setTo(Scalar(0, 255, 0)); // G | ||
result(Rect(10, 0, 5, 5)).setTo(Scalar(255, 0, 0)); // B | ||
result(Rect(0, 5, 5, 5)).setTo(Scalar(128, 128, 128)); // gray | ||
//imshow("test_image", result); waitKey(); | ||
return result; | ||
} | ||
Mat generateTestImageBGR() | ||
{ | ||
static Mat image = generateTestImageBGR_(); // initialize once | ||
CV_Assert(!image.empty()); | ||
return image; | ||
} | ||
|
||
static | ||
Mat generateTestImageGrayscale_() | ||
{ | ||
Mat imageBGR = generateTestImageBGR(); | ||
CV_Assert(!imageBGR.empty()); | ||
|
||
Mat result; | ||
cvtColor(imageBGR, result, COLOR_BGR2GRAY); | ||
return result; | ||
} | ||
Mat generateTestImageGrayscale() | ||
{ | ||
static Mat image = generateTestImageGrayscale_(); // initialize once | ||
return image; | ||
} | ||
|
||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html | ||
|
||
#ifndef OPENCV_TEST_IMGCODECS_COMMON_HPP | ||
#define OPENCV_TEST_IMGCODECS_COMMON_HPP | ||
|
||
namespace opencv_test { | ||
|
||
Mat generateTestImageBGR(); | ||
Mat generateTestImageGrayscale(); | ||
|
||
} // namespace | ||
|
||
#endif // OPENCV_TEST_IMGCODECS_COMMON_HPP |
Oops, something went wrong.