Make photo.hpp independent from C API

This commit is contained in:
Andrey Kamaev 2013-04-07 23:23:53 +04:00
parent 0738ea7d0f
commit 69648f0a6f
11 changed files with 26 additions and 25 deletions

View File

@ -1,4 +1,4 @@
SET(OPENCV_HAARTRAINING_DEPS opencv_core opencv_imgproc opencv_highgui opencv_objdetect opencv_calib3d opencv_video opencv_features2d opencv_flann opencv_legacy)
SET(OPENCV_HAARTRAINING_DEPS opencv_core opencv_imgproc opencv_photo opencv_highgui opencv_objdetect opencv_calib3d opencv_video opencv_features2d opencv_flann opencv_legacy)
ocv_check_dependencies(${OPENCV_HAARTRAINING_DEPS})
if(NOT OCV_DEPENDENCIES_FOUND)

View File

@ -1,4 +1,4 @@
set(OPENCV_TRAINCASCADE_DEPS opencv_core opencv_ml opencv_imgproc opencv_objdetect opencv_highgui opencv_calib3d opencv_video opencv_features2d opencv_flann opencv_legacy)
set(OPENCV_TRAINCASCADE_DEPS opencv_core opencv_ml opencv_imgproc opencv_photo opencv_objdetect opencv_highgui opencv_calib3d opencv_video opencv_features2d opencv_flann opencv_legacy)
ocv_check_dependencies(${OPENCV_TRAINCASCADE_DEPS})
if(NOT OCV_DEPENDENCIES_FOUND)

View File

@ -62,6 +62,8 @@
#include "opencv2/core/core_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/photo/photo_c.h"
#include "opencv2/video.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/flann.hpp"

View File

@ -50,6 +50,7 @@
#include "cv.h"
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/highgui.hpp"
#endif

View File

@ -48,6 +48,8 @@
#include "opencv2/core/core_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/photo/photo_c.h"
#include "opencv2/video.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/calib3d.hpp"

View File

@ -46,10 +46,6 @@
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/photo/photo_c.h"
#ifdef __cplusplus
/*! \namespace cv
Namespace where all the C++ OpenCV functionality resides
*/
@ -59,8 +55,8 @@ namespace cv
//! the inpainting algorithm
enum
{
INPAINT_NS=CV_INPAINT_NS, // Navier-Stokes algorithm
INPAINT_TELEA=CV_INPAINT_TELEA // A. Telea algorithm
INPAINT_NS = 0, // Navier-Stokes algorithm
INPAINT_TELEA = 1 // A. Telea algorithm
};
//! restores the damaged image areas using one of the available intpainting algorithms
@ -84,8 +80,6 @@ CV_EXPORTS_W void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs,
float h = 3, float hColor = 3,
int templateWindowSize = 7, int searchWindowSize = 21);
}
#endif //__cplusplus
} // cv
#endif

View File

@ -74,7 +74,7 @@ void cv::fastNlMeansDenoising( InputArray _src, OutputArray _dst, float h,
src, dst, templateWindowSize, searchWindowSize, h));
break;
default:
CV_Error(CV_StsBadArg,
CV_Error(Error::StsBadArg,
"Unsupported image format! Only CV_8UC1, CV_8UC2 and CV_8UC3 are supported");
}
}
@ -88,7 +88,7 @@ void cv::fastNlMeansDenoisingColored( InputArray _src, OutputArray _dst,
Mat dst = _dst.getMat();
if (src.type() != CV_8UC3) {
CV_Error(CV_StsBadArg, "Type of input image should be CV_8UC3!");
CV_Error(Error::StsBadArg, "Type of input image should be CV_8UC3!");
return;
}
@ -118,27 +118,27 @@ static void fastNlMeansDenoisingMultiCheckPreconditions(
{
int src_imgs_size = (int)srcImgs.size();
if (src_imgs_size == 0) {
CV_Error(CV_StsBadArg, "Input images vector should not be empty!");
CV_Error(Error::StsBadArg, "Input images vector should not be empty!");
}
if (temporalWindowSize % 2 == 0 ||
searchWindowSize % 2 == 0 ||
templateWindowSize % 2 == 0) {
CV_Error(CV_StsBadArg, "All windows sizes should be odd!");
CV_Error(Error::StsBadArg, "All windows sizes should be odd!");
}
int temporalWindowHalfSize = temporalWindowSize / 2;
if (imgToDenoiseIndex - temporalWindowHalfSize < 0 ||
imgToDenoiseIndex + temporalWindowHalfSize >= src_imgs_size)
{
CV_Error(CV_StsBadArg,
CV_Error(Error::StsBadArg,
"imgToDenoiseIndex and temporalWindowSize "
"should be choosen corresponding srcImgs size!");
}
for (int i = 1; i < src_imgs_size; i++) {
if (srcImgs[0].size() != srcImgs[i].size() || srcImgs[0].type() != srcImgs[i].type()) {
CV_Error(CV_StsBadArg, "Input images should have the same size and type!");
CV_Error(Error::StsBadArg, "Input images should have the same size and type!");
}
}
}
@ -177,7 +177,7 @@ void cv::fastNlMeansDenoisingMulti( InputArrayOfArrays _srcImgs, OutputArray _ds
dst, templateWindowSize, searchWindowSize, h));
break;
default:
CV_Error(CV_StsBadArg,
CV_Error(Error::StsBadArg,
"Unsupported matrix format! Only uchar, Vec2b, Vec3b are supported");
}
}
@ -201,7 +201,7 @@ void cv::fastNlMeansDenoisingColoredMulti( InputArrayOfArrays _srcImgs, OutputAr
int src_imgs_size = (int)srcImgs.size();
if (srcImgs[0].type() != CV_8UC3) {
CV_Error(CV_StsBadArg, "Type of input images should be CV_8UC3!");
CV_Error(Error::StsBadArg, "Type of input images should be CV_8UC3!");
return;
}

View File

@ -47,6 +47,7 @@
#include "precomp.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/photo/photo_c.h"
#undef CV_MAT_ELEM_PTR_FAST
#define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size ) \
@ -782,7 +783,7 @@ cvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_i
cvSet(f,cvScalar(INSIDE,0,0,0),mask);
cvSet(t,cvScalar(0,0,0,0),band);
if( flags == CV_INPAINT_TELEA )
if( flags == cv::INPAINT_TELEA )
{
out = cvCreateMat(erows, ecols, CV_8UC1);
el_range = cvCreateStructuringElementEx(2*range+1,2*range+1,
@ -799,10 +800,10 @@ cvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_i
icvCalcFMM(out,t,Out,true);
icvTeleaInpaintFMM(mask,t,output_img,range,Heap);
}
else if (flags == CV_INPAINT_NS) {
else if (flags == cv::INPAINT_NS) {
icvNSInpaintFMM(mask,t,output_img,range,Heap);
} else {
CV_Error( CV_StsBadArg, "The flags argument must be one of CV_INPAINT_TELEA or CV_INPAINT_NS" );
CV_Error( cv::Error::StsBadArg, "The flags argument must be one of CV_INPAINT_TELEA or CV_INPAINT_NS" );
}
}

View File

@ -84,8 +84,8 @@ void CV_InpaintTest::run( int )
test.setTo(Scalar::all(255), mask1ch);
Mat res1, res2;
inpaint( test, mask1ch, res1, 5, CV_INPAINT_NS );
inpaint( test, mask1ch, res2, 5, CV_INPAINT_TELEA );
inpaint( test, mask1ch, res1, 5, INPAINT_NS );
inpaint( test, mask1ch, res2, 5, INPAINT_TELEA );
Mat diff1, diff2;
absdiff( orig, res1, diff1 );

View File

@ -24,6 +24,7 @@
#include "opencv2/highgui.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/photo/photo_c.h"
#include "opencv2/opencv_modules.hpp"

View File

@ -81,7 +81,7 @@ int main( int argc, char** argv )
if( c == 'i' || c == ' ' )
{
Mat inpainted;
inpaint(img, inpaintMask, inpainted, 3, CV_INPAINT_TELEA);
inpaint(img, inpaintMask, inpainted, 3, INPAINT_TELEA);
imshow("inpainted image", inpainted);
}
}