Skip to content

Commit 8fc45c5

Browse files
committed
Merge pull request opencv#7 from DolotovEvgeniy/FadeColorAndFilmGrain_fix
fix photofilter
2 parents 93c9d41 + 6e15b1d commit 8fc45c5

File tree

7 files changed

+8
-29
lines changed

7 files changed

+8
-29
lines changed

modules/photoeffects/doc/fade_color.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ Fade Color
33
=======================================
44
Applies color fade effect to image.
55

6-
.. cpp:function:: int fadeColor(InputArray src, OutputArray dst, Point startPoint, Point endPoint)
6+
.. cpp:function:: void fadeColor(InputArray src, OutputArray dst, Point startPoint, Point endPoint)
77

88
:param src: Grayscale or RGB image.
99
:param dst: Destination image of the same size and the same type as **src**.
1010
:param startPoint: Initial point of direction vector for color fading.
1111
:param endPoint: Terminal point of direction vector for color fading.
1212

13-
:return: Error code.
14-
1513
The algorithm.
1614

1715
1. Determine the coordinates of the vector by two points **(startPoint, endPoint)** .

modules/photoeffects/doc/film_grain.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ Film Grain
33
=======================================
44
Applies film grain effect to the initial image.
55

6-
.. cpp:function:: int filmGrain(InputArray src, OutputArray dst, int grainValue, RNG& rng)
6+
.. cpp:function:: void filmGrain(InputArray src, OutputArray dst, int grainValue, RNG& rng)
77

88
:param src: Grayscale or RGB image.
99
:param dst: Destination image of the same size and the same type as **src**.
1010
:param grainValue: Degree of graininess. 8 is default value.
1111
:param rng: Random number generator. cv::theRNG() is default value.
12-
:return: Error code.
1312

1413
The algorithm.
1514

modules/photoeffects/include/opencv2/photoeffects.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ namespace cv { namespace photoeffects {
1010

1111
CV_EXPORTS_W int sepia(cv::InputArray src, cv::OutputArray dst);
1212

13-
CV_EXPORTS_W int filmGrain(cv::InputArray src, cv::OutputArray dst, int grainValue = 8, cv::RNG& rng = cv::theRNG());
13+
CV_EXPORTS_W void filmGrain(cv::InputArray src, cv::OutputArray dst, int grainValue = 8, cv::RNG& rng = cv::theRNG());
1414

15-
CV_EXPORTS_W int fadeColor(cv::InputArray src, cv::OutputArray dst,cv::Point startPoint,cv::Point endPoint);
15+
CV_EXPORTS_W void fadeColor(cv::InputArray src, cv::OutputArray dst,cv::Point startPoint,cv::Point endPoint);
1616

1717
CV_EXPORTS_W void tint(cv::InputArray src, cv::OutputArray dst, const cv::Vec3b &colorTint, float density);
1818

modules/photoeffects/src/fadeColor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Point findFarthestPoint(Point vector, Mat& image)
6969
return Point(a*image.cols, b*image.rows);
7070
}
7171

72-
int fadeColor(InputArray src, OutputArray dst,
72+
void fadeColor(InputArray src, OutputArray dst,
7373
Point startPoint, Point endPoint)
7474
{
7575

@@ -98,7 +98,6 @@ int fadeColor(InputArray src, OutputArray dst,
9898
image.copyTo(dstMat);
9999
parallel_for_(Range(0, image.rows), FadeColorInvoker(dstMat, A,B,C,maxDistance));
100100
dstMat.copyTo(dst);
101-
return 0;
102101
}
103102

104103
}}

modules/photoeffects/src/filmGrain.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace cv { namespace photoeffects {
44

5-
int filmGrain(InputArray src, OutputArray dst, int grainValue, RNG& rng)
5+
void filmGrain(InputArray src, OutputArray dst, int grainValue, RNG& rng)
66
{
77
CV_Assert(!src.empty());
88
CV_Assert(src.type() == CV_8UC1 || src.type() == CV_8UC3);
@@ -18,7 +18,6 @@ int filmGrain(InputArray src, OutputArray dst, int grainValue, RNG& rng)
1818
cvtColor(noise, noise, COLOR_GRAY2RGB);
1919
}
2020
dstMat=image+noise;
21-
return 0;
2221
}
2322

2423
}}

modules/photoeffects/test/fadeColor_test.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ TEST(photoeffects_fadeColor, invalid_argument)
2323
EXPECT_ERROR(CV_StsAssert, fadeColor(src, dst, Point(5,5), Point(5,5)));
2424
}
2525

26-
TEST(photoeffects_fadeColor, test) {
27-
Mat imageWithOneChannel(100, 200, CV_8UC1);
28-
Mat imageWithThreeChannel(100, 200, CV_8UC3);
29-
Mat dst;
30-
EXPECT_EQ(0, fadeColor(imageWithOneChannel, dst, Point(5,5), Point(5,8)));
31-
EXPECT_EQ(0, fadeColor(imageWithThreeChannel, dst, Point(5,5), Point(5,8)));
32-
}
33-
3426
TEST(photoeffects_fadeColor, regression)
3527
{
3628
string input = cvtest::TS::ptr()->get_data_path() + "photoeffects/fadeColor_test.png";
@@ -45,7 +37,7 @@ TEST(photoeffects_fadeColor, regression)
4537
if (rightDst.empty())
4638
FAIL() << "Can't read " + expectedOutput + " image";
4739

48-
EXPECT_EQ(0, fadeColor(image, dst, Point(100, 100), Point(250, 250)));
40+
fadeColor(image, dst, Point(100, 100), Point(250, 250));
4941

5042
Mat diff = abs(rightDst - dst);
5143
Mat mask = diff.reshape(1) > 1;

modules/photoeffects/test/filmGrain_test.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ TEST(photoeffects_filmGrain, invalid_image_format)
1313
EXPECT_ERROR(CV_StsAssert, filmGrain(src,dst,5));
1414
}
1515

16-
TEST(photoeffects_filmGrain, test) {
17-
Mat imageWithOneChannel(10, 20, CV_8UC1);
18-
Mat imageWithThreeChannel(10, 20, CV_8UC3);
19-
Mat dst;
20-
EXPECT_EQ(0, filmGrain(imageWithOneChannel, dst, 5));
21-
EXPECT_EQ(0, filmGrain(imageWithThreeChannel, dst, 5));
22-
}
23-
2416
TEST(photoeffects_filmGrain, regression)
2517
{
2618
string input = cvtest::TS::ptr()->get_data_path() + "photoeffects/filmGrain_test.png";
@@ -36,7 +28,7 @@ TEST(photoeffects_filmGrain, regression)
3628

3729
Mat dst;
3830
theRNG()=RNG(0);
39-
EXPECT_EQ(0, filmGrain(image, dst, 25));
31+
filmGrain(image, dst, 25);
4032

4133
Mat diff = abs(rightDst - dst);
4234
Mat mask = diff.reshape(1) > 1;

0 commit comments

Comments
 (0)