Skip to content

Commit f79fd4c

Browse files
committed
Fixed vignette test and documentation
1 parent 5a8f1c5 commit f79fd4c

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

modules/photoeffects/doc/vignette.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Vignette
44

55
Makes the edges of the photo less bright, creating an oval frame around its central part.
66

7-
.. ocv:function:: int vignette(cv::InputArray src, cv::OutputArray dst, cv::Size rect)
7+
.. ocv:function:: void vignette(cv::InputArray src, cv::OutputArray dst, cv::Size rect)
88
99
:param src: Source 3-channel image.
1010
:param dst: Destination image of the same size and the same type as **src**.

modules/photoeffects/test/vignette_test.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,26 @@ using namespace cv::photoeffects;
55

66
using namespace std;
77

8-
TEST(photoeffects_vignette, invalid_arguments)
8+
TEST(photoeffects_vignette, incorrect_image)
99
{
1010
Mat image(100, 100, CV_8UC1);
1111
Mat dst;
1212
Size rectangle;
13-
rectangle.height = 0;
14-
rectangle.width = 0;
13+
rectangle.height = image.rows / 1.5f;
14+
rectangle.width = image.cols / 2.0f;
1515

1616
EXPECT_ERROR(CV_StsAssert, vignette(image, dst, rectangle));
1717
}
1818

19-
TEST(photoeffects_vignette, test)
19+
TEST(photoeffects_vignette, incorrect_ellipse_size)
2020
{
2121
Mat image(100, 100, CV_8UC3);
2222
Mat dst;
2323
Size rectangle;
24-
rectangle.height = image.rows / 1.5f;
25-
rectangle.width = image.cols / 2.0f;
24+
rectangle.height = 0.0f;
25+
rectangle.width = 0.0f;
26+
27+
EXPECT_ERROR(CV_StsAssert, vignette(image, dst, rectangle));
2628
}
2729

2830
TEST(photoeffects_vignette, regression)
@@ -43,9 +45,11 @@ TEST(photoeffects_vignette, regression)
4345
FAIL() << "Can't read " + expectedOutput + " image";
4446
}
4547

46-
Size rect;
47-
rect.height = image.rows / 1.5f;
48-
rect.width = image.cols / 2.0f;
48+
Size rectangle;
49+
rectangle.height = image.rows / 1.5f;
50+
rectangle.width = image.cols / 2.0f;
51+
52+
vignette(image, dst, rectangle);
4953

5054
Mat diff = abs(rightDst - dst);
5155
Mat mask = diff.reshape(1) > 1;

0 commit comments

Comments
 (0)