Commit 97d602ff authored by Bellaktris's avatar Bellaktris

some warnings and compmilation error fixed

parent cdba517e
set(the_description "Advanced edge-detection algorithms") set(the_description "Advanced edge-detection algorithms")
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wshadow)
ocv_define_module(ximpgroc opencv_core opencv_imgproc OPTIONAL opencv_highgui) ocv_define_module(ximpgroc opencv_core opencv_imgproc OPTIONAL opencv_highgui)
set(the_description "Addon to basic photo module") set(the_description "Addon to basic photo module")
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
ocv_define_module(xphoto opencv_core opencv_imgproc opencv_stitching OPTIONAL opencv_photo opencv_highgui) ocv_define_module(xphoto opencv_core opencv_imgproc opencv_stitching OPTIONAL opencv_photo opencv_highgui)
\ No newline at end of file
...@@ -7,7 +7,7 @@ balanceWhite ...@@ -7,7 +7,7 @@ balanceWhite
------------ ------------
.. ocv:function:: (const Mat &src, Mat &dst, const int algorithmType, .. ocv:function:: (const Mat &src, Mat &dst, const int algorithmType,
const float inputMin = 0.0f, const float inputMax = 255.0f, const float inputMin = 0.0f, const float inputMax = 255.0f,
const float outputMin = 0.0f, const float outputMax = 255.0f); const float outputMin = 0.0f, const float outputMax = 255.0f)
The function implements different algorithm of automatic white balance, i.e. The function implements different algorithm of automatic white balance, i.e.
it tries to map image's white color to perceptual white (this can be violated it tries to map image's white color to perceptual white (this can be violated
...@@ -20,6 +20,7 @@ due to specific illumination or camera settings). ...@@ -20,6 +20,7 @@ due to specific illumination or camera settings).
smart histogram adjustments smart histogram adjustments
(ignoring 4% pixels with minimal (ignoring 4% pixels with minimal
and maximal values) for each channel. and maximal values) for each channel.
:param inputMin : minimum value in the input image :param inputMin : minimum value in the input image
:param inputMax : maximum value in the input image :param inputMax : maximum value in the input image
:param outputMin : minimum value in the output image :param outputMin : minimum value in the output image
......
...@@ -5,7 +5,7 @@ Image denoising techniques ...@@ -5,7 +5,7 @@ Image denoising techniques
dctDenoising dctDenoising
------------ ------------
.. ocv:function:: (const Mat &src, Mat &dst, const float sigma); .. ocv:function:: (const Mat &src, Mat &dst, const float sigma)
The function implements simple dct-based denoising, The function implements simple dct-based denoising,
link: http://www.ipol.im/pub/art/2011/ys-dct/. link: http://www.ipol.im/pub/art/2011/ys-dct/.
......
...@@ -43,10 +43,11 @@ ...@@ -43,10 +43,11 @@
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <limits>
template <typename Tp> static inline int min_idx(std::vector <Tp> vec) template <typename Tp> static inline int min_idx(std::vector <Tp> vec)
{ {
return std::min_element(vec.begin(), vec.end()) - vec.begin(); return int( std::min_element(vec.begin(), vec.end()) - vec.begin() );
} }
static inline int hamming_length(int x) static inline int hamming_length(int x)
......
...@@ -128,21 +128,12 @@ namespace cv ...@@ -128,21 +128,12 @@ namespace cv
{ {
CV_Assert( src.type() == CV_MAKE_TYPE(CV_32F, 3) ); CV_Assert( src.type() == CV_MAKE_TYPE(CV_32F, 3) );
float M[] = {cvInvSqrt(3), cvInvSqrt(3), cvInvSqrt(3), Mat m = Mat_<float>(3, 3) << (cvInvSqrt(3), cvInvSqrt(3), cvInvSqrt(3),
cvInvSqrt(2), 0.0f, -cvInvSqrt(2), cvInvSqrt(2), 0.0f, -cvInvSqrt(2),
cvInvSqrt(6), -2.0f*cvInvSqrt(6), cvInvSqrt(6)}; cvInvSqrt(6), -2.0f*cvInvSqrt(6), cvInvSqrt(6));
Mat_<Vec3f>::iterator outIt = dst.begin<Vec3f>(); cv::transform(src, dst, m);
for (Mat_<Vec3f>::const_iterator it = src.begin<Vec3f>(); it != src.end<Vec3f>(); ++it, ++outIt)
{
Vec3f rgb = *it;
*outIt = Vec3f(M[0]*rgb[0] + M[1]*rgb[1] + M[2]*rgb[2],
M[3]*rgb[0] + M[4]*rgb[1] + M[5]*rgb[2],
M[6]*rgb[0] + M[7]*rgb[1] + M[8]*rgb[2]);
}
/*************************************/
std::vector <Mat> mv; std::vector <Mat> mv;
split(dst, mv); split(dst, mv);
...@@ -150,15 +141,8 @@ namespace cv ...@@ -150,15 +141,8 @@ namespace cv
grayDctDenoising(mv[i], mv[i], sigma, psize); grayDctDenoising(mv[i], mv[i], sigma, psize);
merge(mv, dst); merge(mv, dst);
/*************************************/
for (Mat_<Vec3f>::iterator it = dst.begin<Vec3f>(); it != dst.end<Vec3f>(); ++it) cv::transform( dst, dst, m.inv() );
{
Vec3f rgb = *it;
*it = Vec3f(M[0]*rgb[0] + M[3]*rgb[1] + M[6]*rgb[2],
M[1]*rgb[0] + M[4]*rgb[1] + M[7]*rgb[2],
M[2]*rgb[0] + M[5]*rgb[1] + M[8]*rgb[2]);
}
} }
/*! This function implements simple dct-based image denoising, /*! This function implements simple dct-based image denoising,
...@@ -182,7 +166,8 @@ namespace cv ...@@ -182,7 +166,8 @@ namespace cv
else if ( img.type() == CV_32FC1 ) else if ( img.type() == CV_32FC1 )
grayDctDenoising( img, img, sigma, psize ); grayDctDenoising( img, img, sigma, psize );
else else
CV_Assert( false ); CV_Error_( CV_StsNotImplemented,
("Unsupported source image format (=%d)", img.type()) );
img.convertTo( dst, src.type() ); img.convertTo( dst, src.type() );
} }
......
...@@ -64,16 +64,16 @@ namespace cv ...@@ -64,16 +64,16 @@ namespace cv
static void shiftMapInpaint(const Mat &src, const Mat &mask, Mat &dst) static void shiftMapInpaint(const Mat &src, const Mat &mask, Mat &dst)
{ {
const int nTransform = 60; // number of dominant transforms for stitching const int nTransform = 60; // number of dominant transforms for stitching
const int psize = 8; // single ANNF patch size //const int psize = 8; // single ANNF patch size
/** ANNF computation **/ /** ANNF computation **/
srand( time(NULL) ); srand( unsigned int(time(NULL)) );
std::vector <Matx33f> transforms; // dominant transforms std::vector <Matx33f> transforms; // dominant transforms
for (int i = 0; i < nTransform; ++i) for (int i = 0; i < nTransform; ++i)
{ {
float dx = rand()%src.cols - src.cols/2; float dx = float( rand()%src.cols - src.cols/2 );
float dy = rand()%src.rows - src.rows/2; float dy = float( rand()%src.rows - src.rows/2 );
transforms.push_back( Matx33f( 1, 0, dx, transforms.push_back( Matx33f( 1, 0, dx,
0, 1, dy, 0, 1, dy,
0, 0, 1) ); 0, 0, 1) );
...@@ -117,7 +117,8 @@ namespace cv ...@@ -117,7 +117,8 @@ namespace cv
shiftMapInpaint <Tp, cn>(src, mask, dst); shiftMapInpaint <Tp, cn>(src, mask, dst);
break; break;
default: default:
CV_Assert( false ); CV_Error_( CV_StsNotImplemented,
("Unsupported algorithm type (=%d)", algorithmType) );
break; break;
} }
} }
...@@ -196,7 +197,9 @@ namespace cv ...@@ -196,7 +197,9 @@ namespace cv
inpaint <double, 4>( src, mask, dst, algorithmType ); inpaint <double, 4>( src, mask, dst, algorithmType );
break; break;
default: default:
CV_Assert( false ); CV_Error_( CV_StsNotImplemented,
("Unsupported source image format (=%d)",
src.type()) );
break; break;
} }
} }
......
...@@ -90,7 +90,7 @@ protected: ...@@ -90,7 +90,7 @@ protected:
virtual void setWeights(GCGraph <double> &graph, const cv::Point &pA, const cv::Point &pB, const int lA, const int lB, const int lX); virtual void setWeights(GCGraph <double> &graph, const cv::Point &pA, const cv::Point &pB, const int lA, const int lB, const int lX);
public: public:
Photomontage(const std::vector <cv::Mat> &images, const std::vector <cv::Mat> &masks, bool multiscale = true); Photomontage(const std::vector <cv::Mat> &images, const std::vector <cv::Mat> &masks);
virtual ~Photomontage(){}; virtual ~Photomontage(){};
void assignLabeling(cv::Mat &img); void assignLabeling(cv::Mat &img);
...@@ -109,36 +109,36 @@ setWeights(GCGraph <double> &graph, const cv::Point &pA, const cv::Point &pB, co ...@@ -109,36 +109,36 @@ setWeights(GCGraph <double> &graph, const cv::Point &pA, const cv::Point &pB, co
if (lA == lB) if (lA == lB)
{ {
/** Link from A to B **/ /** Link from A to B **/
double weightAB = dist( images[lA].at<Tp>(pA), double weightAB = dist( typename images[lA].at<Tp>(pA),
images[lA].at<Tp>(pB), typename images[lA].at<Tp>(pB),
images[lX].at<Tp>(pA), typename images[lX].at<Tp>(pA),
images[lX].at<Tp>(pB) ); typename images[lX].at<Tp>(pB) );
graph.addEdges(pA.y*width + pA.x, pB.y*width + pB.x, weightAB, weightAB); graph.addEdges( int(pA.y*width + pA.x), int(pB.y*width + pB.x), weightAB, weightAB);
} }
else else
{ {
int X = graph.addVtx(); int X = graph.addVtx();
/** Link from X to sink **/ /** Link from X to sink **/
double weightXS = dist( images[lA].at<Tp>(pA), double weightXS = dist( typename images[lA].at<Tp>(pA),
images[lA].at<Tp>(pB), typename images[lA].at<Tp>(pB),
images[lB].at<Tp>(pA), typename images[lB].at<Tp>(pA),
images[lB].at<Tp>(pB) ); typename images[lB].at<Tp>(pB) );
graph.addTermWeights(X, 0, weightXS); graph.addTermWeights(X, 0, weightXS);
/** Link from A to X **/ /** Link from A to X **/
double weightAX = dist( images[lA].at<Tp>(pA), double weightAX = dist( typename images[lA].at<Tp>(pA),
images[lA].at<Tp>(pB), typename images[lA].at<Tp>(pB),
images[lX].at<Tp>(pA), typename images[lX].at<Tp>(pA),
images[lX].at<Tp>(pB) ); typename images[lX].at<Tp>(pB) );
graph.addEdges(pA.y*width + pA.x, X, weightAX, weightAX); graph.addEdges( int(pA.y*width + pA.x), X, weightAX, weightAX);
/** Link from X to B **/ /** Link from X to B **/
double weightXB = dist( images[lX].at<Tp>(pA), double weightXB = dist( typename images[lX].at<Tp>(pA),
images[lX].at<Tp>(pB), typename images[lX].at<Tp>(pB),
images[lB].at<Tp>(pA), typename images[lB].at<Tp>(pA),
images[lB].at<Tp>(pB) ); typename images[lB].at<Tp>(pB) );
graph.addEdges(X, pB.y*width + pB.x, weightXB, weightXB); graph.addEdges(X, int(pB.y*width + pB.x), weightXB, weightXB);
} }
} }
...@@ -151,8 +151,8 @@ singleExpansion(const int alpha) ...@@ -151,8 +151,8 @@ singleExpansion(const int alpha)
/** Terminal links **/ /** Terminal links **/
for (int i = 0; i < height; ++i) for (int i = 0; i < height; ++i)
{ {
const uchar *maskAlphaRow = masks[alpha].ptr <uchar>(i); typename const uchar *maskAlphaRow = masks[alpha].ptr <uchar>(i);
const int *labelRow = (const int *) x_i.ptr <int>(i); typename const int *labelRow = (const int *) x_i.ptr <int>(i);
for (int j = 0; j < width; ++j) for (int j = 0; j < width; ++j)
graph.addTermWeights( graph.addVtx(), graph.addTermWeights( graph.addVtx(),
...@@ -163,8 +163,8 @@ singleExpansion(const int alpha) ...@@ -163,8 +163,8 @@ singleExpansion(const int alpha)
/** Neighbor links **/ /** Neighbor links **/
for (int i = 0; i < height - 1; ++i) for (int i = 0; i < height - 1; ++i)
{ {
const int *currentRow = (const int *) x_i.ptr <int>(i); typename const int *currentRow = (const int *) x_i.ptr <int>(i);
const int *nextRow = (const int *) x_i.ptr <int>(i + 1); typename const int *nextRow = (const int *) x_i.ptr <int>(i + 1);
for (int j = 0; j < width - 1; ++j) for (int j = 0; j < width - 1; ++j)
{ {
...@@ -188,8 +188,8 @@ singleExpansion(const int alpha) ...@@ -188,8 +188,8 @@ singleExpansion(const int alpha)
labelings[alpha].create( height, width, CV_32SC1 ); labelings[alpha].create( height, width, CV_32SC1 );
for (int i = 0; i < height; ++i) for (int i = 0; i < height; ++i)
{ {
const int *inRow = (const int *) x_i.ptr <int>(i); typename const int *inRow = (const int *) x_i.ptr <int>(i);
int *outRow = (int *) labelings[alpha].ptr <int>(i); typename int *outRow = (int *) labelings[alpha].ptr <int>(i);
for (int j = 0; j < width; ++j) for (int j = 0; j < width; ++j)
outRow[j] = graph.inSourceSegment(i*width + j) ? inRow[j] : alpha; outRow[j] = graph.inSourceSegment(i*width + j) ? inRow[j] : alpha;
...@@ -242,11 +242,11 @@ assignResImage(cv::Mat &img) ...@@ -242,11 +242,11 @@ assignResImage(cv::Mat &img)
} }
template <typename Tp> Photomontage <Tp>:: template <typename Tp> Photomontage <Tp>::
Photomontage(const std::vector <cv::Mat> &images, const std::vector <cv::Mat> &masks, const bool multiscale) Photomontage(const std::vector <cv::Mat> &images, const std::vector <cv::Mat> &masks)
: :
images(images), masks(masks), height(images[0].rows), width(images[0].cols), images(images), masks(masks), height(int(images[0].rows)), width(int(images[0].cols)),
type(images[0].type()), x_i(height, width, CV_32SC1), channels(images[0].channels()), type(images[0].type()), x_i(height, width, CV_32SC1), channels(images[0].channels()),
lsize(images.size()), labelings(images.size()), distances(images.size()) lsize(int(images.size())), labelings(images.size()), distances(images.size())
{ {
CV_Assert(images[0].depth() != CV_8U && masks[0].depth() == CV_8U); CV_Assert(images[0].depth() != CV_8U && masks[0].depth() == CV_8U);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment