mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 19:50:38 +08:00
Merge pull request #1942 from ilya-lavrenov:warn_fix
This commit is contained in:
commit
f36858b3a0
@ -39,7 +39,7 @@ colorChange
|
|||||||
-----------
|
-----------
|
||||||
Given an original color image, two differently colored versions of this image can be mixed seamlessly.
|
Given an original color image, two differently colored versions of this image can be mixed seamlessly.
|
||||||
|
|
||||||
.. ocv:function:: void colorChange( InputArray src, InputArray mask, OutputArray dst, float red_mul = 1.0, float green_mul = 1.0, float blue_mul = 1.0)
|
.. ocv:function:: void colorChange( InputArray src, InputArray mask, OutputArray dst, float red_mul = 1.0f, float green_mul = 1.0f, float blue_mul = 1.0f)
|
||||||
|
|
||||||
:param src: Input 8-bit 3-channel image.
|
:param src: Input 8-bit 3-channel image.
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ illuminationChange
|
|||||||
Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson
|
Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson
|
||||||
solver, modifies locally the apparent illumination of an image.
|
solver, modifies locally the apparent illumination of an image.
|
||||||
|
|
||||||
.. ocv:function:: void illuminationChange(InputArray src, InputArray mask, OutputArray dst, float alpha = 0.2, float beta = 0.4)
|
.. ocv:function:: void illuminationChange(InputArray src, InputArray mask, OutputArray dst, float alpha = 0.2f, float beta = 0.4f)
|
||||||
|
|
||||||
:param src: Input 8-bit 3-channel image.
|
:param src: Input 8-bit 3-channel image.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ edgePreservingFilter
|
|||||||
|
|
||||||
Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing filters are used in many different applications.
|
Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing filters are used in many different applications.
|
||||||
|
|
||||||
.. ocv:function:: void edgePreservingFilter(InputArray src, OutputArray dst, int flags = 1, float sigma_s = 60, float sigma_r = 0.4)
|
.. ocv:function:: void edgePreservingFilter(InputArray src, OutputArray dst, int flags = 1, float sigma_s = 60, float sigma_r = 0.4f)
|
||||||
|
|
||||||
:param src: Input 8-bit 3-channel image.
|
:param src: Input 8-bit 3-channel image.
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ detailEnhance
|
|||||||
-------------
|
-------------
|
||||||
This filter enhances the details of a particular image.
|
This filter enhances the details of a particular image.
|
||||||
|
|
||||||
.. ocv:function:: void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10, float sigma_r = 0.15)
|
.. ocv:function:: void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10, float sigma_r = 0.15f)
|
||||||
|
|
||||||
:param src: Input 8-bit 3-channel image.
|
:param src: Input 8-bit 3-channel image.
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ pencilSketch
|
|||||||
------------
|
------------
|
||||||
Pencil-like non-photorealistic line drawing
|
Pencil-like non-photorealistic line drawing
|
||||||
|
|
||||||
.. ocv:function:: void pencilSketch(InputArray src, OutputArray dst1, OutputArray dst2, float sigma_s = 60, float sigma_r = 0.07, float shade_factor = 0.02)
|
.. ocv:function:: void pencilSketch(InputArray src, OutputArray dst1, OutputArray dst2, float sigma_s = 60, float sigma_r = 0.07f, float shade_factor = 0.02f)
|
||||||
|
|
||||||
:param src: Input 8-bit 3-channel image.
|
:param src: Input 8-bit 3-channel image.
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ stylization
|
|||||||
-----------
|
-----------
|
||||||
Stylization aims to produce digital imagery with a wide variety of effects not focused on photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low contrast while preserving, or enhancing, high-contrast features.
|
Stylization aims to produce digital imagery with a wide variety of effects not focused on photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low contrast while preserving, or enhancing, high-contrast features.
|
||||||
|
|
||||||
.. ocv:function:: void stylization(InputArray src, OutputArray dst, float sigma_s = 60, float sigma_r = 0.45)
|
.. ocv:function:: void stylization(InputArray src, OutputArray dst, float sigma_s = 60, float sigma_r = 0.45f)
|
||||||
|
|
||||||
:param src: Input 8-bit 3-channel image.
|
:param src: Input 8-bit 3-channel image.
|
||||||
|
|
||||||
|
@ -306,27 +306,27 @@ CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray co
|
|||||||
CV_EXPORTS_W void seamlessClone( InputArray src, InputArray dst, InputArray mask, Point p,
|
CV_EXPORTS_W void seamlessClone( InputArray src, InputArray dst, InputArray mask, Point p,
|
||||||
OutputArray blend, int flags);
|
OutputArray blend, int flags);
|
||||||
|
|
||||||
CV_EXPORTS_W void colorChange(InputArray src, InputArray mask, OutputArray dst, float red_mul = 1.0,
|
CV_EXPORTS_W void colorChange(InputArray src, InputArray mask, OutputArray dst, float red_mul = 1.0f,
|
||||||
float green_mul = 1.0, float blue_mul = 1.0);
|
float green_mul = 1.0f, float blue_mul = 1.0f);
|
||||||
|
|
||||||
CV_EXPORTS_W void illuminationChange(InputArray src, InputArray mask, OutputArray dst,
|
CV_EXPORTS_W void illuminationChange(InputArray src, InputArray mask, OutputArray dst,
|
||||||
float alpha = 0.2, float beta = 0.4);
|
float alpha = 0.2f, float beta = 0.4f);
|
||||||
|
|
||||||
CV_EXPORTS_W void textureFlattening(InputArray src, InputArray mask, OutputArray dst,
|
CV_EXPORTS_W void textureFlattening(InputArray src, InputArray mask, OutputArray dst,
|
||||||
double low_threshold = 30, double high_threshold = 45,
|
double low_threshold = 30, double high_threshold = 45,
|
||||||
int kernel_size = 3);
|
int kernel_size = 3);
|
||||||
|
|
||||||
CV_EXPORTS_W void edgePreservingFilter(InputArray src, OutputArray dst, int flags = 1,
|
CV_EXPORTS_W void edgePreservingFilter(InputArray src, OutputArray dst, int flags = 1,
|
||||||
float sigma_s = 60, float sigma_r = 0.4);
|
float sigma_s = 60, float sigma_r = 0.4f);
|
||||||
|
|
||||||
CV_EXPORTS_W void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10,
|
CV_EXPORTS_W void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10,
|
||||||
float sigma_r = 0.15);
|
float sigma_r = 0.15f);
|
||||||
|
|
||||||
CV_EXPORTS_W void pencilSketch(InputArray src, OutputArray dst1, OutputArray dst2,
|
CV_EXPORTS_W void pencilSketch(InputArray src, OutputArray dst1, OutputArray dst2,
|
||||||
float sigma_s = 60, float sigma_r = 0.07, float shade_factor = 0.02);
|
float sigma_s = 60, float sigma_r = 0.07f, float shade_factor = 0.02f);
|
||||||
|
|
||||||
CV_EXPORTS_W void stylization(InputArray src, OutputArray dst, float sigma_s = 60,
|
CV_EXPORTS_W void stylization(InputArray src, OutputArray dst, float sigma_s = 60,
|
||||||
float sigma_r = 0.45);
|
float sigma_r = 0.45f);
|
||||||
|
|
||||||
} // cv
|
} // cv
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _color_boost)
|
|||||||
obj.weak_order(img,alf);
|
obj.weak_order(img,alf);
|
||||||
|
|
||||||
// Solver
|
// Solver
|
||||||
Mat Mt = Mat(polyGrad.size(),polyGrad[0].size(), CV_32FC1);
|
Mat Mt = Mat((int)polyGrad.size(),(int)polyGrad[0].size(), CV_32FC1);
|
||||||
obj.wei_update_matrix(polyGrad,Cg,Mt);
|
obj.wei_update_matrix(polyGrad,Cg,Mt);
|
||||||
|
|
||||||
vector <double> wei;
|
vector <double> wei;
|
||||||
|
@ -117,7 +117,7 @@ void Decolor::init()
|
|||||||
kernely.at<float>(0,0)=1.0;
|
kernely.at<float>(0,0)=1.0;
|
||||||
kernely.at<float>(1,0)=-1.0;
|
kernely.at<float>(1,0)=-1.0;
|
||||||
order = 2;
|
order = 2;
|
||||||
sigma = .02;
|
sigma = 0.02f;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<double> Decolor::product(vector < vector<int> > &comb, vector <double> &initRGB)
|
vector<double> Decolor::product(vector < vector<int> > &comb, vector <double> &initRGB)
|
||||||
@ -343,18 +343,19 @@ void Decolor::grad_system(Mat img, vector < vector < double > > &polyGrad,
|
|||||||
|
|
||||||
void Decolor::wei_update_matrix(vector < vector <double> > &poly, vector <double> &Cg, Mat &X)
|
void Decolor::wei_update_matrix(vector < vector <double> > &poly, vector <double> &Cg, Mat &X)
|
||||||
{
|
{
|
||||||
Mat P = Mat(poly.size(),poly[0].size(), CV_32FC1);
|
int size = static_cast<int>(poly.size()), size0 = static_cast<int>(poly[0].size());
|
||||||
Mat A = Mat(poly.size(),poly.size(), CV_32FC1);
|
Mat P = Mat(size, size0, CV_32FC1);
|
||||||
|
Mat A = Mat(size, size, CV_32FC1);
|
||||||
|
|
||||||
for(unsigned int i =0;i<poly.size();i++)
|
for (int i = 0; i < size; i++)
|
||||||
for(unsigned int j=0;j<poly[0].size();j++)
|
for (int j = 0; j < size0;j++)
|
||||||
P.at<float>(i,j) = (float) poly[i][j];
|
P.at<float>(i,j) = (float) poly[i][j];
|
||||||
|
|
||||||
Mat P_trans = P.t();
|
Mat P_trans = P.t();
|
||||||
Mat B = Mat(poly.size(),poly[0].size(), CV_32FC1);
|
Mat B = Mat(size, size0, CV_32FC1);
|
||||||
for(unsigned int i =0;i < poly.size();i++)
|
for(int i =0;i < size;i++)
|
||||||
{
|
{
|
||||||
for(unsigned int j=0;j<Cg.size();j++)
|
for(int j = 0, end = Cg.size(); j < end;j++)
|
||||||
B.at<float>(i,j) = (float) (poly[i][j] * Cg[j]);
|
B.at<float>(i,j) = (float) (poly[i][j] * Cg[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,8 +415,8 @@ void Decolor::grayImContruct(vector <double> &wei, Mat img, Mat &Gray)
|
|||||||
kk=kk+1;
|
kk=kk+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
float minval = INT_MAX;
|
float minval = FLT_MAX;
|
||||||
float maxval = INT_MIN;
|
float maxval = -FLT_MAX;
|
||||||
|
|
||||||
for(int i=0;i<h;i++)
|
for(int i=0;i<h;i++)
|
||||||
for(int j =0;j<w;j++)
|
for(int j =0;j<w;j++)
|
||||||
|
@ -79,7 +79,7 @@ void cv::detailEnhance(InputArray _src, OutputArray _dst, float sigma_s, float s
|
|||||||
|
|
||||||
int h = I.size().height;
|
int h = I.size().height;
|
||||||
int w = I.size().width;
|
int w = I.size().width;
|
||||||
float factor = 3.0;
|
float factor = 3.0f;
|
||||||
|
|
||||||
Mat img = Mat(I.size(),CV_32FC3);
|
Mat img = Mat(I.size(),CV_32FC3);
|
||||||
I.convertTo(img,CV_32FC3,1.0/255.0);
|
I.convertTo(img,CV_32FC3,1.0/255.0);
|
||||||
|
@ -155,7 +155,7 @@ TEST(Photo_SeamlessClone_illuminationChange, regression)
|
|||||||
ASSERT_FALSE(mask.empty()) << "Could not load mask image " << original_path2;
|
ASSERT_FALSE(mask.empty()) << "Could not load mask image " << original_path2;
|
||||||
|
|
||||||
Mat result;
|
Mat result;
|
||||||
illuminationChange(source, mask, result, .2, .4);
|
illuminationChange(source, mask, result, 0.2f, 0.4f);
|
||||||
|
|
||||||
imwrite(folder + "cloned.png", result);
|
imwrite(folder + "cloned.png", result);
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ TEST(Photo_NPR_PencilSketch, regression)
|
|||||||
ASSERT_FALSE(source.empty()) << "Could not load input image " << original_path;
|
ASSERT_FALSE(source.empty()) << "Could not load input image " << original_path;
|
||||||
|
|
||||||
Mat result,result1;
|
Mat result,result1;
|
||||||
pencilSketch(source,result,result1,10,.1,.03);
|
pencilSketch(source,result,result1, 10, 0.1f, 0.03f);
|
||||||
|
|
||||||
imwrite(folder + "pencil_sketch.png", result);
|
imwrite(folder + "pencil_sketch.png", result);
|
||||||
imwrite(folder + "color_pencil_sketch.png", result1);
|
imwrite(folder + "color_pencil_sketch.png", result1);
|
||||||
|
@ -210,7 +210,7 @@ int main()
|
|||||||
|
|
||||||
Mat result;
|
Mat result;
|
||||||
|
|
||||||
illuminationChange(source, mask, result, .2, .4);
|
illuminationChange(source, mask, result, 0.2f, 0.4f);
|
||||||
|
|
||||||
imshow("Output",result);
|
imshow("Output",result);
|
||||||
imwrite(folder + "cloned.png", result);
|
imwrite(folder + "cloned.png", result);
|
||||||
|
@ -83,7 +83,7 @@ int main(int argc, char* argv[])
|
|||||||
else if(num == 3)
|
else if(num == 3)
|
||||||
{
|
{
|
||||||
Mat img1;
|
Mat img1;
|
||||||
pencilSketch(I,img1, img, 10 ,.1,.03);
|
pencilSketch(I,img1, img, 10 , 0.1f, 0.03f);
|
||||||
imshow("Pencil Sketch",img1);
|
imshow("Pencil Sketch",img1);
|
||||||
imshow("Color Pencil Sketch",img);
|
imshow("Color Pencil Sketch",img);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user