Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions modules/photoeffects/doc/fade_color.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ Fade Color
=======================================
Applies color fade effect to image.

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

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

:return: Error code.

The algorithm.

1. Determine the coordinates of the vector by two points **(startPoint, endPoint)** .
Expand Down
3 changes: 1 addition & 2 deletions modules/photoeffects/doc/film_grain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ Film Grain
=======================================
Applies film grain effect to the initial image.

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

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

The algorithm.

Expand Down
4 changes: 2 additions & 2 deletions modules/photoeffects/include/opencv2/photoeffects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace cv { namespace photoeffects {

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

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

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

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

Expand Down
3 changes: 1 addition & 2 deletions modules/photoeffects/src/fadeColor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Point findFarthestPoint(Point vector, Mat& image)
return Point(a*image.cols, b*image.rows);
}

int fadeColor(InputArray src, OutputArray dst,
void fadeColor(InputArray src, OutputArray dst,
Point startPoint, Point endPoint)
{

Expand Down Expand Up @@ -98,7 +98,6 @@ int fadeColor(InputArray src, OutputArray dst,
image.copyTo(dstMat);
parallel_for_(Range(0, image.rows), FadeColorInvoker(dstMat, A,B,C,maxDistance));
dstMat.copyTo(dst);
return 0;
}

}}
3 changes: 1 addition & 2 deletions modules/photoeffects/src/filmGrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace cv { namespace photoeffects {

int filmGrain(InputArray src, OutputArray dst, int grainValue, RNG& rng)
void filmGrain(InputArray src, OutputArray dst, int grainValue, RNG& rng)
{
CV_Assert(!src.empty());
CV_Assert(src.type() == CV_8UC1 || src.type() == CV_8UC3);
Expand All @@ -18,7 +18,6 @@ int filmGrain(InputArray src, OutputArray dst, int grainValue, RNG& rng)
cvtColor(noise, noise, COLOR_GRAY2RGB);
}
dstMat=image+noise;
return 0;
}

}}
10 changes: 1 addition & 9 deletions modules/photoeffects/test/fadeColor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ TEST(photoeffects_fadeColor, invalid_argument)
EXPECT_ERROR(CV_StsAssert, fadeColor(src, dst, Point(5,5), Point(5,5)));
}

TEST(photoeffects_fadeColor, test) {
Mat imageWithOneChannel(100, 200, CV_8UC1);
Mat imageWithThreeChannel(100, 200, CV_8UC3);
Mat dst;
EXPECT_EQ(0, fadeColor(imageWithOneChannel, dst, Point(5,5), Point(5,8)));
EXPECT_EQ(0, fadeColor(imageWithThreeChannel, dst, Point(5,5), Point(5,8)));
}

TEST(photoeffects_fadeColor, regression)
{
string input = cvtest::TS::ptr()->get_data_path() + "photoeffects/fadeColor_test.png";
Expand All @@ -45,7 +37,7 @@ TEST(photoeffects_fadeColor, regression)
if (rightDst.empty())
FAIL() << "Can't read " + expectedOutput + " image";

EXPECT_EQ(0, fadeColor(image, dst, Point(100, 100), Point(250, 250)));
fadeColor(image, dst, Point(100, 100), Point(250, 250));

Mat diff = abs(rightDst - dst);
Mat mask = diff.reshape(1) > 1;
Expand Down
10 changes: 1 addition & 9 deletions modules/photoeffects/test/filmGrain_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ TEST(photoeffects_filmGrain, invalid_image_format)
EXPECT_ERROR(CV_StsAssert, filmGrain(src,dst,5));
}

TEST(photoeffects_filmGrain, test) {
Mat imageWithOneChannel(10, 20, CV_8UC1);
Mat imageWithThreeChannel(10, 20, CV_8UC3);
Mat dst;
EXPECT_EQ(0, filmGrain(imageWithOneChannel, dst, 5));
EXPECT_EQ(0, filmGrain(imageWithThreeChannel, dst, 5));
}

TEST(photoeffects_filmGrain, regression)
{
string input = cvtest::TS::ptr()->get_data_path() + "photoeffects/filmGrain_test.png";
Expand All @@ -36,7 +28,7 @@ TEST(photoeffects_filmGrain, regression)

Mat dst;
theRNG()=RNG(0);
EXPECT_EQ(0, filmGrain(image, dst, 25));
filmGrain(image, dst, 25);

Mat diff = abs(rightDst - dst);
Mat mask = diff.reshape(1) > 1;
Expand Down