whitespaces removed and other minor changes to fix build error
Update 1 update 2 Update 3 Update 4 Update 5 update 6 Update 7 Update 8 Update 9 Update 10 Update 11 Update 12 Update 13 Update 14 Update 15 Update 16 Update 17 Update 18 Update 19 Update 20 Update 21 Update 22 Removed Headers Update 23 Update 24 Update 25 Update 26 Update 27 Update 28
This commit is contained in:
parent
05c7c9325a
commit
f85a615f3f
@ -9,7 +9,7 @@ Image editing tasks concern either global changes (color/intensity corrections,
|
|||||||
Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner.
|
Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner.
|
||||||
The extent of the changes ranges from slight distortions to complete replacement by novel content.
|
The extent of the changes ranges from slight distortions to complete replacement by novel content.
|
||||||
|
|
||||||
.. ocv:function:: void seamlessClone( InputArray src, InputArray dst, InputArray mask, Point p, OutputArray result, int flags)
|
.. ocv:function:: void seamlessClone( InputArray src, InputArray dst, InputArray mask, Point p, OutputArray blend, int flags)
|
||||||
|
|
||||||
:param src: Input 8-bit 3-channel image.
|
:param src: Input 8-bit 3-channel image.
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ The extent of the changes ranges from slight distortions to complete replacement
|
|||||||
|
|
||||||
:param mask: Input 8-bit 1 or 3-channel image.
|
:param mask: Input 8-bit 1 or 3-channel image.
|
||||||
|
|
||||||
:param Point: Point in dst image where object is placed.
|
:param p: Point in dst image where object is placed.
|
||||||
|
|
||||||
:param result: Output image with the same size and type as ``dst``.
|
:param result: Output image with the same size and type as ``dst``.
|
||||||
|
|
||||||
|
@ -17,4 +17,3 @@ Transforms a color image to a grayscale image. It is a basic tool in digital pri
|
|||||||
:param color_boost: Output 8-bit 3-channel image.
|
:param color_boost: Output 8-bit 3-channel image.
|
||||||
|
|
||||||
This function is to be applied on color images.
|
This function is to be applied on color images.
|
||||||
|
|
||||||
|
@ -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.4)
|
||||||
|
|
||||||
: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.15)
|
||||||
|
|
||||||
: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.07, float shade_factor = 0.02)
|
||||||
|
|
||||||
: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.45)
|
||||||
|
|
||||||
:param src: Input 8-bit 3-channel image.
|
:param src: Input 8-bit 3-channel image.
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ edgeEnhance
|
|||||||
-----------
|
-----------
|
||||||
Able to suppress low-amplitude details and enhance edges.
|
Able to suppress low-amplitude details and enhance edges.
|
||||||
|
|
||||||
.. ocv:function:: void edgeEnhance(InputArray src, OutputArray dst, float sigma_s = 60, float sigma_r = 0.45);
|
.. ocv:function:: void edgeEnhance(InputArray src, OutputArray dst, float sigma_s = 60, float sigma_r = 0.45)
|
||||||
|
|
||||||
:param src: Input 8-bit 3-channel image.
|
:param src: Input 8-bit 3-channel image.
|
||||||
|
|
||||||
@ -87,4 +87,3 @@ Able to suppress low-amplitude details and enhance edges.
|
|||||||
:param sigma_s: Range between 0 to 200.
|
:param sigma_s: Range between 0 to 200.
|
||||||
|
|
||||||
:param sigma_r: Range between 0 to 1.
|
:param sigma_r: Range between 0 to 1.
|
||||||
|
|
||||||
|
@ -10,3 +10,6 @@ photo. Computational Photography
|
|||||||
inpainting
|
inpainting
|
||||||
denoising
|
denoising
|
||||||
hdr_imaging
|
hdr_imaging
|
||||||
|
decolor
|
||||||
|
cloning
|
||||||
|
npr
|
||||||
|
@ -52,43 +52,43 @@
|
|||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
|
||||||
//! the inpainting algorithm
|
//! the inpainting algorithm
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
INPAINT_NS = 0, // Navier-Stokes algorithm
|
INPAINT_NS = 0, // Navier-Stokes algorithm
|
||||||
INPAINT_TELEA = 1 // A. Telea algorithm
|
INPAINT_TELEA = 1 // A. Telea algorithm
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
NORMAL_CLONE = 1,
|
NORMAL_CLONE = 1,
|
||||||
MIXED_CLONE = 2,
|
MIXED_CLONE = 2,
|
||||||
MONOCHROME_TRANSFER = 3
|
MONOCHROME_TRANSFER = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
RECURS_FILTER = 1,
|
RECURS_FILTER = 1,
|
||||||
NORMCONV_FILTER = 2
|
NORMCONV_FILTER = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
//! restores the damaged image areas using one of the available intpainting algorithms
|
//! restores the damaged image areas using one of the available intpainting algorithms
|
||||||
CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask,
|
CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask,
|
||||||
OutputArray dst, double inpaintRadius, int flags );
|
OutputArray dst, double inpaintRadius, int flags );
|
||||||
|
|
||||||
|
|
||||||
CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, float h = 3,
|
CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, float h = 3,
|
||||||
int templateWindowSize = 7, int searchWindowSize = 21);
|
int templateWindowSize = 7, int searchWindowSize = 21);
|
||||||
|
|
||||||
CV_EXPORTS_W void fastNlMeansDenoisingColored( InputArray src, OutputArray dst,
|
CV_EXPORTS_W void fastNlMeansDenoisingColored( InputArray src, OutputArray dst,
|
||||||
float h = 3, float hColor = 3,
|
float h = 3, float hColor = 3,
|
||||||
int templateWindowSize = 7, int searchWindowSize = 21);
|
int templateWindowSize = 7, int searchWindowSize = 21);
|
||||||
|
|
||||||
CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst,
|
CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst,
|
||||||
int imgToDenoiseIndex, int temporalWindowSize,
|
int imgToDenoiseIndex, int temporalWindowSize,
|
||||||
float h = 3, int templateWindowSize = 7, int searchWindowSize = 21);
|
float h = 3, int templateWindowSize = 7, int searchWindowSize = 21);
|
||||||
|
|
||||||
CV_EXPORTS_W void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs, OutputArray dst,
|
CV_EXPORTS_W void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs, OutputArray dst,
|
||||||
int imgToDenoiseIndex, int temporalWindowSize,
|
int imgToDenoiseIndex, int temporalWindowSize,
|
||||||
float h = 3, float hColor = 3,
|
float h = 3, float hColor = 3,
|
||||||
int templateWindowSize = 7, int searchWindowSize = 21);
|
int templateWindowSize = 7, int searchWindowSize = 21);
|
||||||
@ -301,34 +301,34 @@ public:
|
|||||||
|
|
||||||
CV_EXPORTS_W Ptr<MergeRobertson> createMergeRobertson();
|
CV_EXPORTS_W Ptr<MergeRobertson> createMergeRobertson();
|
||||||
|
|
||||||
CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray color_boost);
|
CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray color_boost);
|
||||||
|
|
||||||
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.0,
|
||||||
float green_mul = 1.0, float blue_mul = 1.0);
|
float green_mul = 1.0, float blue_mul = 1.0);
|
||||||
|
|
||||||
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.2, float beta = 0.4);
|
||||||
|
|
||||||
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, double high_threshold,
|
double low_threshold, double high_threshold,
|
||||||
int kernel_size);
|
int kernel_size);
|
||||||
|
|
||||||
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.4);
|
||||||
|
|
||||||
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.15);
|
||||||
|
|
||||||
CV_EXPORTS_W void pencilSketch(InputArray src, OutputArray dst, OutputArray dst1,
|
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.07, float shade_factor = 0.02);
|
||||||
|
|
||||||
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.45);
|
||||||
|
|
||||||
CV_EXPORTS_W void edgeEnhance(InputArray src, OutputArray dst, float sigma_s = 60,
|
CV_EXPORTS_W void edgeEnhance(InputArray src, OutputArray dst, float sigma_s = 60,
|
||||||
float sigma_r = 0.45);
|
float sigma_r = 0.45);
|
||||||
|
|
||||||
} // cv
|
} // cv
|
||||||
|
@ -42,8 +42,6 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/photo.hpp"
|
#include "opencv2/photo.hpp"
|
||||||
#include "opencv2/imgproc.hpp"
|
|
||||||
#include <opencv2/highgui.hpp>
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -53,21 +51,21 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
double norm(double);
|
double norm_m(double);
|
||||||
|
|
||||||
double norm(double E)
|
double norm_m(double E)
|
||||||
{
|
{
|
||||||
return (sqrt(pow(E,2)));
|
return sqrt(pow(E,2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _boost)
|
void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _color_boost)
|
||||||
{
|
{
|
||||||
Mat I = _src.getMat();
|
Mat I = _src.getMat();
|
||||||
_dst.create(I.size(), CV_8UC1);
|
_dst.create(I.size(), CV_8UC1);
|
||||||
Mat dst = _dst.getMat();
|
Mat dst = _dst.getMat();
|
||||||
|
|
||||||
_boost.create(I.size(), CV_8UC3);
|
_color_boost.create(I.size(), CV_8UC3);
|
||||||
Mat color_boost = _boost.getMat();
|
Mat color_boost = _color_boost.getMat();
|
||||||
|
|
||||||
if(!I.data )
|
if(!I.data )
|
||||||
{
|
{
|
||||||
@ -82,7 +80,7 @@ void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _boost)
|
|||||||
|
|
||||||
int maxIter = 15;
|
int maxIter = 15;
|
||||||
int iterCount = 0;
|
int iterCount = 0;
|
||||||
float tol = .0001;
|
double tol = .0001;
|
||||||
double E = 0;
|
double E = 0;
|
||||||
double pre_E = std::numeric_limits<double>::infinity();
|
double pre_E = std::numeric_limits<double>::infinity();
|
||||||
|
|
||||||
@ -113,7 +111,7 @@ void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _boost)
|
|||||||
|
|
||||||
//////////////////////////////// main loop starting ////////////////////////////////////////
|
//////////////////////////////// main loop starting ////////////////////////////////////////
|
||||||
|
|
||||||
while(norm(E-pre_E) > tol)
|
while(norm_m(E-pre_E) > tol)
|
||||||
{
|
{
|
||||||
iterCount +=1;
|
iterCount +=1;
|
||||||
pre_E = E;
|
pre_E = E;
|
||||||
@ -223,7 +221,7 @@ void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _boost)
|
|||||||
for(int i =0;i<h1;i++)
|
for(int i =0;i<h1;i++)
|
||||||
for(int j=0;j<w1;j++)
|
for(int j=0;j<w1;j++)
|
||||||
{
|
{
|
||||||
l.at<uchar>(i,j) = 255.0*Gray.at<float>(i,j);
|
l.at<uchar>(i,j) = dst.at<uchar>(i,j);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i =0;i<h1;i++)
|
for(int i =0;i<h1;i++)
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/photo.hpp"
|
#include "opencv2/photo.hpp"
|
||||||
#include "opencv2/imgproc.hpp"
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -124,12 +123,12 @@ void Decolor::init()
|
|||||||
vector<double> Decolor::product(vector < vector<int> > &comb, vector <double> &initRGB)
|
vector<double> Decolor::product(vector < vector<int> > &comb, vector <double> &initRGB)
|
||||||
{
|
{
|
||||||
vector <double> res;
|
vector <double> res;
|
||||||
float dp;
|
double dp;
|
||||||
for (unsigned int i=0;i<comb.size();i++)
|
for (unsigned int i=0;i<comb.size();i++)
|
||||||
{
|
{
|
||||||
dp = 0.0f;
|
dp = 0.0;
|
||||||
for(int j=0;j<3;j++)
|
for(int j=0;j<3;j++)
|
||||||
dp += comb[i][j] * initRGB[j];
|
dp = dp + (comb[i][j] * initRGB[j]);
|
||||||
res.push_back(dp);
|
res.push_back(dp);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@ -413,14 +412,14 @@ void Decolor::wei_update_matrix(vector < vector <double> > &poly, vector <double
|
|||||||
|
|
||||||
for(unsigned int i =0;i<poly.size();i++)
|
for(unsigned int i =0;i<poly.size();i++)
|
||||||
for(unsigned int j=0;j<poly[0].size();j++)
|
for(unsigned int j=0;j<poly[0].size();j++)
|
||||||
P.at<float>(i,j) = 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(poly.size(),poly[0].size(), CV_32FC1);
|
||||||
for(unsigned int i =0;i < poly.size();i++)
|
for(unsigned int i =0;i < poly.size();i++)
|
||||||
{
|
{
|
||||||
for(unsigned int j=0;j<Cg.size();j++)
|
for(unsigned int j=0;j<Cg.size();j++)
|
||||||
B.at<float>(i,j) = poly[i][j]*Cg[j];
|
B.at<float>(i,j) = (float) (poly[i][j] * Cg[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
A = P*P_trans;
|
A = P*P_trans;
|
||||||
@ -486,14 +485,14 @@ void Decolor::grayImContruct(vector <double> &wei, Mat img, Mat &Gray)
|
|||||||
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++)
|
||||||
Gray.at<float>(i,j)=Gray.at<float>(i,j) +
|
Gray.at<float>(i,j)=Gray.at<float>(i,j) +
|
||||||
wei[kk]*pow(red.at<float>(i,j),r)*pow(green.at<float>(i,j),g)*
|
(float) wei[kk]*pow(red.at<float>(i,j),r)*pow(green.at<float>(i,j),g)*
|
||||||
pow(blue.at<float>(i,j),b);
|
pow(blue.at<float>(i,j),b);
|
||||||
|
|
||||||
kk=kk+1;
|
kk=kk+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
double minval = INT_MAX;
|
float minval = INT_MAX;
|
||||||
double maxval = INT_MIN;
|
float maxval = INT_MIN;
|
||||||
|
|
||||||
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++)
|
||||||
|
@ -41,9 +41,6 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/photo.hpp"
|
#include "opencv2/photo.hpp"
|
||||||
#include "opencv2/highgui.hpp"
|
|
||||||
#include "opencv2/core.hpp"
|
|
||||||
#include "opencv2/imgproc.hpp"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -139,15 +136,15 @@ void cv::detailEnhance(InputArray _src, OutputArray _dst, float sigma_s, float s
|
|||||||
result.convertTo(dst,CV_8UC3,255);
|
result.convertTo(dst,CV_8UC3,255);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::pencilSketch(InputArray _src, OutputArray _dst, OutputArray _dst1, float sigma_s, float sigma_r, float shade_factor)
|
void cv::pencilSketch(InputArray _src, OutputArray _dst1, OutputArray _dst2, float sigma_s, float sigma_r, float shade_factor)
|
||||||
{
|
{
|
||||||
Mat I = _src.getMat();
|
Mat I = _src.getMat();
|
||||||
_dst.create(I.size(), CV_8UC1);
|
_dst1.create(I.size(), CV_8UC1);
|
||||||
Mat dst = _dst.getMat();
|
|
||||||
|
|
||||||
_dst1.create(I.size(), CV_8UC3);
|
|
||||||
Mat dst1 = _dst1.getMat();
|
Mat dst1 = _dst1.getMat();
|
||||||
|
|
||||||
|
_dst2.create(I.size(), CV_8UC3);
|
||||||
|
Mat dst2 = _dst2.getMat();
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@ -158,8 +155,8 @@ void cv::pencilSketch(InputArray _src, OutputArray _dst, OutputArray _dst1, floa
|
|||||||
|
|
||||||
obj.pencil_sketch(img, sketch, color_sketch, sigma_s, sigma_r, shade_factor);
|
obj.pencil_sketch(img, sketch, color_sketch, sigma_s, sigma_r, shade_factor);
|
||||||
|
|
||||||
sketch.convertTo(dst,CV_8UC1,255);
|
sketch.convertTo(dst1,CV_8UC1,255);
|
||||||
color_sketch.convertTo(dst1,CV_8UC3,255);
|
color_sketch.convertTo(dst2,CV_8UC3,255);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +221,7 @@ void cv::stylization(InputArray _src, OutputArray _dst, float sigma_s, float sig
|
|||||||
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++)
|
||||||
{
|
{
|
||||||
magnitude.at<float>(i,j) = 1.0 - magnitude.at<float>(i,j);
|
magnitude.at<float>(i,j) = 1.0f - magnitude.at<float>(i,j);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mat stylized = Mat(h,w,CV_32FC3);
|
Mat stylized = Mat(h,w,CV_32FC3);
|
||||||
|
@ -41,12 +41,12 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/photo.hpp"
|
#include "opencv2/photo.hpp"
|
||||||
#include "opencv2/imgproc.hpp"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ void Domain_Filter::find_magnitude(Mat &img, Mat &mag)
|
|||||||
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++)
|
||||||
{
|
{
|
||||||
mag.at<float>(i,j) = 1.0 - mag.at<float>(i,j);
|
mag.at<float>(i,j) = 1.0f - mag.at<float>(i,j);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ void Domain_Filter::compute_Rfilter(Mat &output, Mat &hz, float sigma_h)
|
|||||||
int w = output.cols;
|
int w = output.cols;
|
||||||
int channel = output.channels();
|
int channel = output.channels();
|
||||||
|
|
||||||
a = exp(-sqrt(2) / sigma_h);
|
a = (float) exp((-1.0 * sqrt(2.0)) / sigma_h);
|
||||||
|
|
||||||
Mat temp = Mat(h,w,CV_32FC3);
|
Mat temp = Mat(h,w,CV_32FC3);
|
||||||
|
|
||||||
@ -202,14 +202,12 @@ void Domain_Filter::compute_Rfilter(Mat &output, Mat &hz, float sigma_h)
|
|||||||
for(int c=0;c<channel;c++)
|
for(int c=0;c<channel;c++)
|
||||||
temp.at<float>(i,j*channel+c) = output.at<float>(i,j*channel+c);
|
temp.at<float>(i,j*channel+c) = output.at<float>(i,j*channel+c);
|
||||||
|
|
||||||
|
|
||||||
Mat V = Mat(h,w,CV_32FC1);
|
Mat V = Mat(h,w,CV_32FC1);
|
||||||
|
|
||||||
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++)
|
||||||
V.at<float>(i,j) = pow(a,hz.at<float>(i,j));
|
V.at<float>(i,j) = pow(a,hz.at<float>(i,j));
|
||||||
|
|
||||||
|
|
||||||
for(int i=0; i<h; i++)
|
for(int i=0; i<h; i++)
|
||||||
{
|
{
|
||||||
for(int j =1; j < w; j++)
|
for(int j =1; j < w; j++)
|
||||||
@ -267,7 +265,7 @@ void Domain_Filter::compute_boxfilter(Mat &output, Mat &hz, Mat &psketch, float
|
|||||||
{
|
{
|
||||||
for(int j=0;j<w;j++)
|
for(int j=0;j<w;j++)
|
||||||
domain_row.at<float>(0,j) = hz.at<float>(i,j);
|
domain_row.at<float>(0,j) = hz.at<float>(i,j);
|
||||||
domain_row.at<float>(0,w) = myinf;
|
domain_row.at<float>(0,w) = (float) myinf;
|
||||||
|
|
||||||
Mat lower_pos_row = Mat::zeros(1,w,CV_32FC1);
|
Mat lower_pos_row = Mat::zeros(1,w,CV_32FC1);
|
||||||
Mat upper_pos_row = Mat::zeros(1,w,CV_32FC1);
|
Mat upper_pos_row = Mat::zeros(1,w,CV_32FC1);
|
||||||
@ -285,7 +283,7 @@ void Domain_Filter::compute_boxfilter(Mat &output, Mat &hz, Mat &psketch, float
|
|||||||
{
|
{
|
||||||
if(domain_row.at<float>(0,j) > lower_pos_row.at<float>(0,0))
|
if(domain_row.at<float>(0,j) > lower_pos_row.at<float>(0,0))
|
||||||
{
|
{
|
||||||
temp_lower_idx.at<float>(0,0) = j;
|
temp_lower_idx.at<float>(0,0) = (float) j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +291,7 @@ void Domain_Filter::compute_boxfilter(Mat &output, Mat &hz, Mat &psketch, float
|
|||||||
{
|
{
|
||||||
if(domain_row.at<float>(0,j) > upper_pos_row.at<float>(0,0))
|
if(domain_row.at<float>(0,j) > upper_pos_row.at<float>(0,0))
|
||||||
{
|
{
|
||||||
temp_upper_idx.at<float>(0,0) = j;
|
temp_upper_idx.at<float>(0,0) = (float) j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,7 +300,7 @@ void Domain_Filter::compute_boxfilter(Mat &output, Mat &hz, Mat &psketch, float
|
|||||||
for(int j=1;j<w;j++)
|
for(int j=1;j<w;j++)
|
||||||
{
|
{
|
||||||
int count=0;
|
int count=0;
|
||||||
for(int k=temp_lower_idx.at<float>(0,j-1);k<w+1;k++)
|
for(int k=(int) temp_lower_idx.at<float>(0,j-1);k<w+1;k++)
|
||||||
{
|
{
|
||||||
if(domain_row.at<float>(0,k) > lower_pos_row.at<float>(0,j))
|
if(domain_row.at<float>(0,k) > lower_pos_row.at<float>(0,j))
|
||||||
{
|
{
|
||||||
@ -315,7 +313,7 @@ void Domain_Filter::compute_boxfilter(Mat &output, Mat &hz, Mat &psketch, float
|
|||||||
temp_lower_idx.at<float>(0,j) = temp_lower_idx.at<float>(0,j-1) + temp;
|
temp_lower_idx.at<float>(0,j) = temp_lower_idx.at<float>(0,j-1) + temp;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for(int k=temp_upper_idx.at<float>(0,j-1);k<w+1;k++)
|
for(int k=(int) temp_upper_idx.at<float>(0,j-1);k<w+1;k++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -374,7 +372,7 @@ void Domain_Filter::compute_NCfilter(Mat &output, Mat &hz, Mat &psketch, float r
|
|||||||
|
|
||||||
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++)
|
||||||
indices.at<float>(i,j) = i+1;
|
indices.at<float>(i,j) = (float) i+1;
|
||||||
|
|
||||||
Mat a = Mat::zeros(h,w,CV_32FC1);
|
Mat a = Mat::zeros(h,w,CV_32FC1);
|
||||||
Mat b = Mat::zeros(h,w,CV_32FC1);
|
Mat b = Mat::zeros(h,w,CV_32FC1);
|
||||||
@ -402,8 +400,8 @@ void Domain_Filter::compute_NCfilter(Mat &output, Mat &hz, Mat &psketch, float r
|
|||||||
for(int j=0;j<w;j++)
|
for(int j=0;j<w;j++)
|
||||||
{
|
{
|
||||||
|
|
||||||
r = b.at<float>(i,j)/(h*(w+1));
|
r = (int) b.at<float>(i,j)/(h*(w+1));
|
||||||
rem = b.at<float>(i,j) - r*h*(w+1);
|
rem = (int) b.at<float>(i,j) - r*h*(w+1);
|
||||||
q = rem/h;
|
q = rem/h;
|
||||||
p = rem - q*h;
|
p = rem - q*h;
|
||||||
if(q==0)
|
if(q==0)
|
||||||
@ -419,8 +417,8 @@ void Domain_Filter::compute_NCfilter(Mat &output, Mat &hz, Mat &psketch, float r
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
r1 = a.at<float>(i,j)/(h*(w+1));
|
r1 = (int) a.at<float>(i,j)/(h*(w+1));
|
||||||
rem1 = a.at<float>(i,j) - r1*h*(w+1);
|
rem1 = (int) a.at<float>(i,j) - r1*h*(w+1);
|
||||||
q1 = rem1/h;
|
q1 = rem1/h;
|
||||||
p1 = rem1 - q1*h;
|
p1 = rem1 - q1*h;
|
||||||
if(p1==0)
|
if(p1==0)
|
||||||
@ -543,7 +541,7 @@ void Domain_Filter::filter(const Mat &img, Mat &res, float sigma_s = 60, float s
|
|||||||
|
|
||||||
for(int i=0;i<no_of_iter;i++)
|
for(int i=0;i<no_of_iter;i++)
|
||||||
{
|
{
|
||||||
sigma_h = sigma_s * sqrt(3) * pow(2.0,(no_of_iter - (i+1))) / sqrt(pow(4.0,no_of_iter) -1);
|
sigma_h = (float) (sigma_s * sqrt(3.0) * pow(2.0,(no_of_iter - (i+1))) / sqrt(pow(4.0,no_of_iter) -1));
|
||||||
|
|
||||||
compute_Rfilter(O, horiz, sigma_h);
|
compute_Rfilter(O, horiz, sigma_h);
|
||||||
|
|
||||||
@ -566,9 +564,9 @@ void Domain_Filter::filter(const Mat &img, Mat &res, float sigma_s = 60, float s
|
|||||||
|
|
||||||
for(int i=0;i<no_of_iter;i++)
|
for(int i=0;i<no_of_iter;i++)
|
||||||
{
|
{
|
||||||
sigma_h = sigma_s * sqrt(3) * pow(2.0,(no_of_iter - (i+1))) / sqrt(pow(4.0,no_of_iter) -1);
|
sigma_h = (float) (sigma_s * sqrt(3.0) * pow(2.0,(no_of_iter - (i+1))) / sqrt(pow(4.0,no_of_iter) -1));
|
||||||
|
|
||||||
radius = sqrt(3) * sigma_h;
|
radius = (float) sqrt(3.0) * sigma_h;
|
||||||
|
|
||||||
compute_NCfilter(O, ct_H, temp,radius);
|
compute_NCfilter(O, ct_H, temp,radius);
|
||||||
|
|
||||||
@ -616,9 +614,9 @@ void Domain_Filter::pencil_sketch(const Mat &img, Mat &sketch, Mat &color_res, f
|
|||||||
|
|
||||||
for(int i=0;i<no_of_iter;i++)
|
for(int i=0;i<no_of_iter;i++)
|
||||||
{
|
{
|
||||||
sigma_h = sigma_s * sqrt(3) * pow(2.0,(no_of_iter - (i+1))) / sqrt(pow(4.0,no_of_iter) -1);
|
sigma_h = (float) (sigma_s * sqrt(3.0) * pow(2.0,(no_of_iter - (i+1))) / sqrt(pow(4.0,no_of_iter) -1));
|
||||||
|
|
||||||
radius = sqrt(3) * sigma_h;
|
radius = (float) sqrt(3.0) * sigma_h;
|
||||||
|
|
||||||
compute_boxfilter(O, ct_H, penx, radius);
|
compute_boxfilter(O, ct_H, penx, radius);
|
||||||
|
|
||||||
|
@ -41,9 +41,6 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/photo.hpp"
|
#include "opencv2/photo.hpp"
|
||||||
#include "opencv2/imgproc.hpp"
|
|
||||||
#include "opencv2/highgui.hpp"
|
|
||||||
#include "opencv2/core.hpp"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -243,4 +240,3 @@ void cv::textureFlattening(InputArray _src, InputArray _mask, OutputArray _dst,
|
|||||||
Cloning obj;
|
Cloning obj;
|
||||||
obj.texture_flatten(src,cs_mask,gray,low_threshold,high_threshold,kernel_size,blend);
|
obj.texture_flatten(src,cs_mask,gray,low_threshold,high_threshold,kernel_size,blend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,9 +41,6 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/photo.hpp"
|
#include "opencv2/photo.hpp"
|
||||||
#include "opencv2/imgproc.hpp"
|
|
||||||
#include "opencv2/highgui.hpp"
|
|
||||||
#include "opencv2/core.hpp"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <complex>
|
#include <complex>
|
||||||
@ -162,7 +159,7 @@ void Cloning::dst(double *gtest, double *gfinal,int h,int w)
|
|||||||
for(int j=0,r=1;j<h;j++,r++)
|
for(int j=0,r=1;j<h;j++,r++)
|
||||||
{
|
{
|
||||||
idx = j*w+i;
|
idx = j*w+i;
|
||||||
temp.at<float>(r,0) = gtest[idx];
|
temp.at<float>(r,0) = (float) gtest[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
temp.at<float>(h+1,0)=0.0;
|
temp.at<float>(h+1,0)=0.0;
|
||||||
@ -170,7 +167,7 @@ void Cloning::dst(double *gtest, double *gfinal,int h,int w)
|
|||||||
for(int j=h-1, r=h+2;j>=0;j--,r++)
|
for(int j=h-1, r=h+2;j>=0;j--,r++)
|
||||||
{
|
{
|
||||||
idx = j*w+i;
|
idx = j*w+i;
|
||||||
temp.at<float>(r,0) = -1*gtest[idx];
|
temp.at<float>(r,0) = (float) (-1.0 * gtest[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
merge(planes, 2, complex1);
|
merge(planes, 2, complex1);
|
||||||
@ -187,7 +184,7 @@ void Cloning::dst(double *gtest, double *gfinal,int h,int w)
|
|||||||
|
|
||||||
for(int c=1,z=0;c<h+1;c++,z++)
|
for(int c=1,z=0;c<h+1;c++,z++)
|
||||||
{
|
{
|
||||||
res.at<float>(z,0) = planes1[1].at<float>(c,0)/fac;
|
res.at<float>(z,0) = (float) (planes1[1].at<float>(c,0)/fac);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int q=0,z=0;q<h;q++,z++)
|
for(int q=0,z=0;q<h;q++,z++)
|
||||||
@ -229,7 +226,7 @@ void Cloning::transpose(double *mat, double *mat_t,int h,int w)
|
|||||||
{
|
{
|
||||||
|
|
||||||
idx = i*(w) + j;
|
idx = i*(w) + j;
|
||||||
tmp.at<float>(i,j) = mat[idx];
|
tmp.at<float>(i,j) = (float) mat[idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mat tmp_t = tmp.t();
|
Mat tmp_t = tmp.t();
|
||||||
@ -264,7 +261,7 @@ void Cloning::poisson_solver(const Mat &img, Mat &gxx , Mat &gyy, Mat &result)
|
|||||||
for(int i =1;i<h-1;i++)
|
for(int i =1;i<h-1;i++)
|
||||||
for(int j=1;j<w-1;j++)
|
for(int j=1;j<w-1;j++)
|
||||||
{
|
{
|
||||||
bound.at<uchar>(i,j) = 0.0;
|
bound.at<uchar>(i,j) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double *f_bp = new double[h*w];
|
double *f_bp = new double[h*w];
|
||||||
@ -284,7 +281,7 @@ void Cloning::poisson_solver(const Mat &img, Mat &gxx , Mat &gyy, Mat &result)
|
|||||||
for(int j=0;j<w;j++)
|
for(int j=0;j<w;j++)
|
||||||
{
|
{
|
||||||
idx = i*w+j;
|
idx = i*w+j;
|
||||||
diff.at<float>(i,j) = (lap.at<float>(i,j) - f_bp[idx]);
|
diff.at<float>(i,j) = (float) (lap.at<float>(i,j) - f_bp[idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +333,6 @@ void Cloning::poisson_solver(const Mat &img, Mat &gxx , Mat &gyy, Mat &result)
|
|||||||
gfinal_t[idx] = gfinal_t[idx]/denom[idx];
|
gfinal_t[idx] = gfinal_t[idx]/denom[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
idst(gfinal_t,f3,h-2,w-2);
|
idst(gfinal_t,f3,h-2,w-2);
|
||||||
|
|
||||||
transpose(f3,f3_t,h-2,w-2);
|
transpose(f3,f3_t,h-2,w-2);
|
||||||
@ -379,9 +375,9 @@ void Cloning::poisson_solver(const Mat &img, Mat &gxx , Mat &gyy, Mat &result)
|
|||||||
if(img_d[idx] < 0.0)
|
if(img_d[idx] < 0.0)
|
||||||
result.at<uchar>(i,j) = 0;
|
result.at<uchar>(i,j) = 0;
|
||||||
else if(img_d[idx] > 255.0)
|
else if(img_d[idx] > 255.0)
|
||||||
result.at<uchar>(i,j) = 255.0;
|
result.at<uchar>(i,j) = 255;
|
||||||
else
|
else
|
||||||
result.at<uchar>(i,j) = img_d[idx];
|
result.at<uchar>(i,j) = (uchar) img_d[idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,18 +470,10 @@ void Cloning::calc(Mat &I, Mat &gx, Mat &gy, Mat &sx, Mat &sy)
|
|||||||
resultg = Mat(I.size(),CV_8UC1);
|
resultg = Mat(I.size(),CV_8UC1);
|
||||||
resultb = Mat(I.size(),CV_8UC1);
|
resultb = Mat(I.size(),CV_8UC1);
|
||||||
|
|
||||||
clock_t tic = clock();
|
|
||||||
|
|
||||||
|
|
||||||
poisson_solver(r_channel,rx_channel, ry_channel,resultr);
|
poisson_solver(r_channel,rx_channel, ry_channel,resultr);
|
||||||
poisson_solver(g_channel,gx_channel, gy_channel,resultg);
|
poisson_solver(g_channel,gx_channel, gy_channel,resultg);
|
||||||
poisson_solver(b_channel,bx_channel, by_channel,resultb);
|
poisson_solver(b_channel,bx_channel, by_channel,resultb);
|
||||||
|
|
||||||
clock_t toc = clock();
|
|
||||||
|
|
||||||
printf("Execution time: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cloning::normal_clone(Mat &I, Mat &mask, Mat &wmask, Mat &final, int num)
|
void Cloning::normal_clone(Mat &I, Mat &mask, Mat &wmask, Mat &final, int num)
|
||||||
|
@ -125,7 +125,7 @@ TEST(Photo_SeamlessClone_featureExchange, regression)
|
|||||||
|
|
||||||
TEST(Photo_SeamlessClone_colorChange, regression)
|
TEST(Photo_SeamlessClone_colorChange, regression)
|
||||||
{
|
{
|
||||||
string folder = string(cvtest::TS::ptr()->get_data_path()) + "cloning/Color_Change/";
|
string folder = string(cvtest::TS::ptr()->get_data_path()) + "cloning/color_change/";
|
||||||
string original_path1 = folder + "source1.png";
|
string original_path1 = folder + "source1.png";
|
||||||
string original_path2 = folder + "mask.png";
|
string original_path2 = folder + "mask.png";
|
||||||
|
|
||||||
@ -179,4 +179,3 @@ TEST(Photo_SeamlessClone_textureFlattening, regression)
|
|||||||
imwrite(folder + "cloned.png", result);
|
imwrite(folder + "cloned.png", result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,4 +65,3 @@ TEST(Photo_Decolor, regression)
|
|||||||
imwrite(folder + "color_boost.png",color_boost);
|
imwrite(folder + "color_boost.png",color_boost);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ using namespace std;
|
|||||||
|
|
||||||
TEST(Photo_NPR_EdgePreserveSmoothing_RecursiveFilter, regression)
|
TEST(Photo_NPR_EdgePreserveSmoothing_RecursiveFilter, regression)
|
||||||
{
|
{
|
||||||
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/Smoothing/";
|
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
|
||||||
string original_path = folder + "test1.png";
|
string original_path = folder + "test1.png";
|
||||||
|
|
||||||
Mat source = imread(original_path, IMREAD_COLOR);
|
Mat source = imread(original_path, IMREAD_COLOR);
|
||||||
@ -66,7 +66,7 @@ TEST(Photo_NPR_EdgePreserveSmoothing_RecursiveFilter, regression)
|
|||||||
|
|
||||||
TEST(Photo_NPR_EdgePreserveSmoothing_NormConvFilter, regression)
|
TEST(Photo_NPR_EdgePreserveSmoothing_NormConvFilter, regression)
|
||||||
{
|
{
|
||||||
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/Smoothing/";
|
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
|
||||||
string original_path = folder + "test1.png";
|
string original_path = folder + "test1.png";
|
||||||
|
|
||||||
Mat source = imread(original_path, IMREAD_COLOR);
|
Mat source = imread(original_path, IMREAD_COLOR);
|
||||||
@ -82,7 +82,7 @@ TEST(Photo_NPR_EdgePreserveSmoothing_NormConvFilter, regression)
|
|||||||
|
|
||||||
TEST(Photo_NPR_DetailEnhance, regression)
|
TEST(Photo_NPR_DetailEnhance, regression)
|
||||||
{
|
{
|
||||||
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/Detail_Enhance/";
|
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
|
||||||
string original_path = folder + "test1.png";
|
string original_path = folder + "test1.png";
|
||||||
|
|
||||||
Mat source = imread(original_path, IMREAD_COLOR);
|
Mat source = imread(original_path, IMREAD_COLOR);
|
||||||
@ -98,7 +98,7 @@ TEST(Photo_NPR_DetailEnhance, regression)
|
|||||||
|
|
||||||
TEST(Photo_NPR_PencilSketch, regression)
|
TEST(Photo_NPR_PencilSketch, regression)
|
||||||
{
|
{
|
||||||
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/Pencil_Sketch/";
|
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
|
||||||
string original_path = folder + "test1.png";
|
string original_path = folder + "test1.png";
|
||||||
|
|
||||||
Mat source = imread(original_path, IMREAD_COLOR);
|
Mat source = imread(original_path, IMREAD_COLOR);
|
||||||
@ -115,7 +115,7 @@ TEST(Photo_NPR_PencilSketch, regression)
|
|||||||
|
|
||||||
TEST(Photo_NPR_Stylization, regression)
|
TEST(Photo_NPR_Stylization, regression)
|
||||||
{
|
{
|
||||||
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/Stylization/";
|
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
|
||||||
string original_path = folder + "test1.png";
|
string original_path = folder + "test1.png";
|
||||||
|
|
||||||
Mat source = imread(original_path, IMREAD_COLOR);
|
Mat source = imread(original_path, IMREAD_COLOR);
|
||||||
@ -131,7 +131,7 @@ TEST(Photo_NPR_Stylization, regression)
|
|||||||
|
|
||||||
TEST(Photo_NPR_EdgeEnhance, regression)
|
TEST(Photo_NPR_EdgeEnhance, regression)
|
||||||
{
|
{
|
||||||
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/Edge_Enhance/";
|
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
|
||||||
string original_path = folder + "test1.png";
|
string original_path = folder + "test1.png";
|
||||||
|
|
||||||
Mat source = imread(original_path, IMREAD_COLOR);
|
Mat source = imread(original_path, IMREAD_COLOR);
|
||||||
|
@ -52,9 +52,6 @@ Point* pts = new Point[100];
|
|||||||
Point* pts2 = new Point[100];
|
Point* pts2 = new Point[100];
|
||||||
Point* pts_diff = new Point[100];
|
Point* pts_diff = new Point[100];
|
||||||
|
|
||||||
char src[50];
|
|
||||||
char dest[50];
|
|
||||||
|
|
||||||
int var = 0;
|
int var = 0;
|
||||||
int flag = 0, flag1 = 0, flag4 = 0;
|
int flag = 0, flag1 = 0, flag4 = 0;
|
||||||
|
|
||||||
@ -94,7 +91,6 @@ void source(int event, int x, int y, int, void*)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (event == EVENT_LBUTTONUP && drag)
|
if (event == EVENT_LBUTTONUP && drag)
|
||||||
{
|
{
|
||||||
imshow("Source", img1);
|
imshow("Source", img1);
|
||||||
@ -302,13 +298,12 @@ int main()
|
|||||||
cin >> num;
|
cin >> num;
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
char s[]="Source";
|
|
||||||
char d[]="Destination";
|
|
||||||
|
|
||||||
minx = INT_MAX; miny = INT_MAX; maxx = INT_MIN; maxy = INT_MIN;
|
minx = INT_MAX; miny = INT_MAX; maxx = INT_MIN; maxy = INT_MIN;
|
||||||
|
|
||||||
minxd = INT_MAX; minyd = INT_MAX; maxxd = INT_MIN; maxyd = INT_MIN;
|
minxd = INT_MAX; minyd = INT_MAX; maxxd = INT_MIN; maxyd = INT_MIN;
|
||||||
|
|
||||||
|
int flag3 = 0;
|
||||||
|
|
||||||
if(num == 1 || num == 2 || num == 3)
|
if(num == 1 || num == 2 || num == 3)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -449,12 +444,15 @@ int main()
|
|||||||
setMouseCallback("Source", source, NULL);
|
setMouseCallback("Source", source, NULL);
|
||||||
imshow("Source", img0);
|
imshow("Source", img0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
int flag3 = 0;
|
|
||||||
|
|
||||||
while(true)
|
|
||||||
{
|
{
|
||||||
char key = waitKey(0);
|
cout << "Wrong Option Choosen" << endl;
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
char key = (char) waitKey(0);
|
||||||
|
|
||||||
if(key == 'd' && flag3 == 0)
|
if(key == 'd' && flag3 == 0)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* create_mask.cpp
|
* create_mask.cpp
|
||||||
*
|
*
|
||||||
* Author:
|
* Author:
|
||||||
@ -9,8 +9,6 @@
|
|||||||
* mask image.
|
* mask image.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "opencv2/imgproc.hpp"
|
#include "opencv2/imgproc.hpp"
|
||||||
#include "opencv2/highgui.hpp"
|
#include "opencv2/highgui.hpp"
|
||||||
#include "opencv2/core.hpp"
|
#include "opencv2/core.hpp"
|
||||||
@ -59,7 +57,6 @@ void mouseHandler(int event, int x, int y, int, void*)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (event == EVENT_LBUTTONUP && drag)
|
if (event == EVENT_LBUTTONUP && drag)
|
||||||
{
|
{
|
||||||
imshow("Source", img1);
|
imshow("Source", img1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user