size_t src2_step;
#define DST_ARG1 DT * dst1_data_, size_t dst1_step_,
-#define DST_STORE1 dst1_data(dst1_data_), dst1_step(dst1_step_),
+#define DST_STORE1 dst1_data(dst1_data_), dst1_step(dst1_step_),
#define DST_VAR1 DT * dst1_data; \
size_t dst1_step;
inline int TEGRA_FILTERINIT(cvhalFilter2D **context, uchar *kernel_data, size_t kernel_step, int kernel_type, int kernel_width, int kernel_height,
int max_width, int max_height, int src_type, int dst_type, int borderType, double delta, int anchor_x, int anchor_y, bool allowSubmatrix, bool allowInplace)
{
- if(!context || !kernel_data || allowSubmatrix || allowInplace ||
+ if(!context || !kernel_data || allowSubmatrix || allowInplace ||
src_type != CV_8UC1 || dst_type != CV_8UC1 ||
delta != 0 || anchor_x != kernel_width / 2 || anchor_y != kernel_height / 2 )
return CV_HAL_ERROR_NOT_IMPLEMENTED;
return CV_HAL_ERROR_NOT_IMPLEMENTED;
}
- if(!CAROTENE_NS::isConvolutionSupported(CAROTENE_NS::Size2D(max_width, max_height), ctx->ksize, ctx->border))
+ if(!CAROTENE_NS::isConvolutionSupported(CAROTENE_NS::Size2D(max_width, max_height), ctx->ksize, ctx->border))
{
delete ctx;
return CV_HAL_ERROR_NOT_IMPLEMENTED;
return CV_HAL_ERROR_NOT_IMPLEMENTED;
}
- if(!CAROTENE_NS::isSeparableFilter3x3Supported(CAROTENE_NS::Size2D(16, 16), ctx->border, 3, 3))
+ if(!CAROTENE_NS::isSeparableFilter3x3Supported(CAROTENE_NS::Size2D(16, 16), ctx->border, 3, 3))
{
delete ctx;
return CV_HAL_ERROR_NOT_IMPLEMENTED;
ctx->anchor_y = anchor_y;
switch(operation)
{
- case MORPH_ERODE:
- case MORPH_DILATE:
+ case CV_HAL_MORPH_ERODE:
+ case CV_HAL_MORPH_DILATE:
ctx->operation = operation;
break;
default:
ctx->border = CAROTENE_NS::BORDER_MODE_CONSTANT;
if( borderValue[0] == DBL_MAX && borderValue[1] == DBL_MAX && borderValue[2] == DBL_MAX && borderValue[3] == DBL_MAX )
{
- if( operation == MORPH_ERODE )
+ if( operation == CV_HAL_MORPH_ERODE )
for(int i = 0; i < ctx->channels; ++i)
ctx->borderValues[i] = (CAROTENE_NS::u8)UCHAR_MAX;
else
( \
(void)dst_full_width, (void)dst_full_height, (void)dst_roi_x, (void)dst_roi_y, \
context && CAROTENE_NS::isSupportedConfiguration() ? \
- ((MorphCtx*)context)->operation == MORPH_ERODE ? \
+ ((MorphCtx*)context)->operation == CV_HAL_MORPH_ERODE ? \
CAROTENE_NS::erode(CAROTENE_NS::Size2D(width, height), ((MorphCtx*)context)->channels, \
src_data, src_step, dst_data, dst_step, \
((MorphCtx*)context)->ksize, ((MorphCtx*)context)->anchor_x, ((MorphCtx*)context)->anchor_y, \
((MorphCtx*)context)->border, ((MorphCtx*)context)->border, ((MorphCtx*)context)->borderValues, \
CAROTENE_NS::Margin(src_roi_x, src_full_width - width - src_roi_x, src_roi_y, src_full_height - height - src_roi_y)), \
CV_HAL_ERROR_OK : \
- ((MorphCtx*)context)->operation == MORPH_DILATE ? \
+ ((MorphCtx*)context)->operation == CV_HAL_MORPH_DILATE ? \
CAROTENE_NS::dilate(CAROTENE_NS::Size2D(width, height), ((MorphCtx*)context)->channels, \
src_data, src_step, dst_data, dst_step, \
((MorphCtx*)context)->ksize, ((MorphCtx*)context)->anchor_x, ((MorphCtx*)context)->anchor_y, \
case CV_HAL_BORDER_CONSTANT:
if (borderValue[0] == DBL_MAX && borderValue[1] == DBL_MAX && borderValue[2] == DBL_MAX && borderValue[3] == DBL_MAX)
{
- if (operation == MORPH_ERODE)
+ if (operation == CV_HAL_MORPH_ERODE)
setConstantBorder(border, UCHAR_MAX);
else
setConstantBorder(border, 0);
MorphCtx* mat;
switch (operation)
{
- case MORPH_ERODE:
+ case CV_HAL_MORPH_ERODE:
mat = new MorphCtx(ctx, kernel_mat, kernel_width, kernel_height, VX_NONLINEAR_FILTER_MIN, border);
break;
- case MORPH_DILATE:
+ case CV_HAL_MORPH_DILATE:
mat = new MorphCtx(ctx, kernel_mat, kernel_width, kernel_height, VX_NONLINEAR_FILTER_MAX, border);
break;
default:
bool Graph::areVerticesAdjacent(size_t id1, size_t id2) const
{
- CV_Assert( doesVertexExist( id1 ) );
- CV_Assert( doesVertexExist( id2 ) );
-
Vertices::const_iterator it = vertices.find(id1);
- return it->second.neighbors.find(id2) != it->second.neighbors.end();
+ CV_Assert(it != vertices.end());
+ const Neighbors & neighbors = it->second.neighbors;
+ return neighbors.find(id2) != neighbors.end();
}
size_t Graph::getVerticesCount() const
size_t Graph::getDegree(size_t id) const
{
- CV_Assert( doesVertexExist(id) );
-
Vertices::const_iterator it = vertices.find(id);
+ CV_Assert( it != vertices.end() );
return it->second.neighbors.size();
}
const Graph::Neighbors& Graph::getNeighbors(size_t id) const
{
- CV_Assert( doesVertexExist(id) );
-
Vertices::const_iterator it = vertices.find(id);
+ CV_Assert( it != vertices.end() );
return it->second.neighbors;
}
void compute_pose(cv::Mat& R, cv::Mat& t);
private:
+ epnp(const epnp &); // copy disabled
+ epnp& operator=(const epnp &); // assign disabled
template <typename T>
void init_camera_parameters(const cv::Mat& cameraMatrix)
{
float* rotation, float* translation )
{
int i, j, k;
- int count = 0, converged = 0;
+ int count = 0;
+ bool converged = false;
float scale = 0, inv_Z = 0;
float diff = (float)criteria.epsilon;
inv_Z = scale * inv_focalLength;
count++;
- converged = ((criteria.type & CV_TERMCRIT_EPS) && (diff < criteria.epsilon));
- converged |= ((criteria.type & CV_TERMCRIT_ITER) && (count == criteria.max_iter));
+ converged = ((criteria.type & CV_TERMCRIT_EPS) && (diff < criteria.epsilon))
+ || ((criteria.type & CV_TERMCRIT_ITER) && (count == criteria.max_iter));
}
const float invScale = 1 / scale;
translation[0] = imagePoints[0].x * invScale;
double compute_pose(cv::Mat& R, cv::Mat& t);
private:
+ upnp(const upnp &); // copy disabled
+ upnp& operator=(const upnp &); // assign disabled
template <typename T>
void init_camera_parameters(const cv::Mat& cameraMatrix)
{
// returns number of dimensions to iterate.
/*
Checks whether <count> arrays have equal type, sizes (mask is optional array
-that needs to have the same size, but 8uC1 or 8sC1 type).
+that needs to have the same size, but 8uC1 or 8sC1 type - feature has been disabled).
Returns number of dimensions to iterate through:
0 means that all arrays are continuous,
1 means that all arrays are vectors of continuous arrays etc.
if( !iterator )
CV_Error( CV_StsNullPtr, "Iterator pointer is NULL" );
- for( i = 0; i <= count; i++ )
+ if (mask)
+ CV_Error( CV_StsBadArg, "Iterator with mask is not supported" );
+
+ for( i = 0; i < count; i++ )
{
- const CvArr* arr = i < count ? arrs[i] : mask;
+ const CvArr* arr = arrs[i];
CvMatND* hdr;
if( !arr )
- {
- if( i < count )
- CV_Error( CV_StsNullPtr, "Some of required array pointers is NULL" );
- break;
- }
+ CV_Error( CV_StsNullPtr, "Some of required array pointers is NULL" );
if( CV_IS_MATND( arr ))
hdr = (CvMatND*)arr;
CV_Error( CV_StsUnmatchedSizes,
"Number of dimensions is the same for all arrays" );
- if( i < count )
+ switch( flags & (CV_NO_DEPTH_CHECK|CV_NO_CN_CHECK))
{
- switch( flags & (CV_NO_DEPTH_CHECK|CV_NO_CN_CHECK))
- {
- case 0:
- if( !CV_ARE_TYPES_EQ( hdr, hdr0 ))
- CV_Error( CV_StsUnmatchedFormats,
- "Data type is not the same for all arrays" );
- break;
- case CV_NO_DEPTH_CHECK:
- if( !CV_ARE_CNS_EQ( hdr, hdr0 ))
- CV_Error( CV_StsUnmatchedFormats,
- "Number of channels is not the same for all arrays" );
- break;
- case CV_NO_CN_CHECK:
- if( !CV_ARE_CNS_EQ( hdr, hdr0 ))
- CV_Error( CV_StsUnmatchedFormats,
- "Depth is not the same for all arrays" );
- break;
- }
- }
- else
- {
- if( !CV_IS_MASK_ARR( hdr ))
- CV_Error( CV_StsBadMask, "Mask should have 8uC1 or 8sC1 data type" );
+ case 0:
+ if( !CV_ARE_TYPES_EQ( hdr, hdr0 ))
+ CV_Error( CV_StsUnmatchedFormats,
+ "Data type is not the same for all arrays" );
+ break;
+ case CV_NO_DEPTH_CHECK:
+ if( !CV_ARE_CNS_EQ( hdr, hdr0 ))
+ CV_Error( CV_StsUnmatchedFormats,
+ "Number of channels is not the same for all arrays" );
+ break;
+ case CV_NO_CN_CHECK:
+ if( !CV_ARE_CNS_EQ( hdr, hdr0 ))
+ CV_Error( CV_StsUnmatchedFormats,
+ "Depth is not the same for all arrays" );
+ break;
}
if( !(flags & CV_NO_SIZE_CHECK) )
if( k == STD_ARRAY_MAT )
{
const Mat* vv = (const Mat*)obj;
- CV_Assert(i < sz.height);
+ CV_Assert(i > 0 && i < sz.height);
return vv[i].isContinuous();
}
const Mat* arrays[] = {&mat, 0};
uchar* ptr;
- NAryMatIterator it(arrays, &ptr);
+ NAryMatIterator it(arrays, &ptr, 1);
int total = (int)it.size, blockSize = std::min((BLOCK_SIZE + cn - 1)/cn, total);
size_t esz = mat.elemSize();
AutoBuffer<double> buf;
// Disable AVX1 since we don't track regressions for it. SSE42 will be used instead
if(cpuFeatures&ippCPUID_AVX && !(cpuFeatures&ippCPUID_AVX2))
- ippFeatures &= ~ippCPUID_AVX;
+ ippFeatures &= ~((Ipp64u)ippCPUID_AVX);
// IPP integrations in OpenCV support only SSE4.2, AVX2 and AVX-512 optimizations.
if(!(
//forward parents
MapIdToLayerData::iterator it;
- for (it = layers.begin(); it->second.id < ld.id; it++)
+ for (it = layers.begin(); it != layers.end() && (it->second.id < ld.id); ++it)
{
LayerData &ld = it->second;
if (ld.flag)
{
CV_TRACE_FUNCTION();
- forwardToLayer(layers.rbegin()->second, true);
+ MapIdToLayerData::reverse_iterator last_layer = layers.rbegin();
+ CV_Assert(last_layer != layers.rend());
+ forwardToLayer(last_layer->second, true);
}
void getLayerShapesRecursively(int id, LayersShapesMap& inOutShapes)
parallel_for_(Range(0, nstripes), cc, nstripes);
}
- ChannelConcatInvoker() {}
+ ChannelConcatInvoker() : inputs(0), output(0), nstripes(0) {}
void operator()(const Range& r) const
{
switch (tensor.dtype())
{
- case 1: // float
+ case tensorflow::DT_FLOAT:
{
const float *data = reinterpret_cast<const float*>(tensor.tensor_content().c_str());
int size = tensor.tensor_content().size() / sizeof(float);
std::cout << " ... " << size - 10 << " more";
break;
}
- case 3: // int32
+ case tensorflow::DT_INT32:
{
const int *data = reinterpret_cast<const int*>(tensor.tensor_content().c_str());
int size = tensor.tensor_content().size() / sizeof(int);
THFile file;
FILE *handle;
- char *name;
int isNativeEncoding;
int longSize;
return (dfself->handle != NULL);
}
-const char *THDiskFile_name(THFile *self)
-{
- THDiskFile *dfself = (THDiskFile*)self;
- return dfself->name;
-}
-
/* workaround mac osx lion ***insane*** fread bug */
#ifdef __APPLE__
static size_t fread__(void *ptr, size_t size, size_t nitems, FILE *stream)
THDiskFile *dfself = (THDiskFile*)(self);
if(dfself->handle)
fclose(dfself->handle);
- THFree(dfself->name);
THFree(dfself);
}
return 0;
}
-
-THFile *THDiskFile_new(const char *name, const char *mode, int isQuiet)
+THFile *THDiskFile_new(const std::string &name, const char *mode, int isQuiet)
{
static struct THFileVTable vtable = {
THDiskFile_isOpened,
THArgCheck(THDiskFile_mode(mode, &isReadable, &isWritable), 2, "file mode should be 'r','w' or 'rw'");
CV_Assert(isReadable && !isWritable);
+
#ifdef _MSC_VER
- if (fopen_s(&handle, name, "rb") != 0)
+ if (fopen_s(&handle, name.c_str(), "rb") != 0)
handle = NULL;
#else
- handle = fopen(name,"rb");
+ handle = fopen(name.c_str(),"rb");
#endif
if(!handle)
if(isQuiet)
return 0;
else
- THError("cannot open <%s> in mode %c%c", name, (isReadable ? 'r' : ' '), (isWritable ? 'w' : ' '));
+ THError("cannot open <%s> in mode %c%c", name.c_str(), (isReadable ? 'r' : ' '), (isWritable ? 'w' : ' '));
}
self = (THDiskFile*)THAlloc(sizeof(THDiskFile));
THError("cannot allocate memory for self");
self->handle = handle;
- self->name = (char*)THAlloc(strlen(name)+1);
- if (!self->name)
- THError("cannot allocate memory for self->name");
- strcpy(self->name, name);
self->isNativeEncoding = 1;
self->longSize = 0;
#define TH_DISK_FILE_INC
#include "THFile.h"
+#include <string>
namespace TH
{
-TH_API THFile *THDiskFile_new(const char *name, const char *mode, int isQuiet);
-
-TH_API const char *THDiskFile_name(THFile *self);
+TH_API THFile *THDiskFile_new(const std::string &name, const char *mode, int isQuiet);
TH_API int THDiskFile_isLittleEndianCPU(void);
TH_API int THDiskFile_isBigEndianCPU(void);
rootModule = curModule = NULL;
moduleCounter = 0;
- file = cv::Ptr<THFile>(THDiskFile_new(filename.c_str(), "r", 0), THFile_free);
+ file = cv::Ptr<THFile>(THDiskFile_new(filename, "r", 0), THFile_free);
CV_Assert(file && THFile_isOpened(file));
if (isBinary)
// general
static const float basicSize_;
+
+private:
+ BRISK_Impl(const BRISK_Impl &); // copy disabled
+ BRISK_Impl& operator=(const BRISK_Impl &); // assign disabled
};
dst.resize(src.size());
std::vector<EllipticKeyPoint>::const_iterator srcIt = src.begin();
std::vector<EllipticKeyPoint>::iterator dstIt = dst.begin();
- for( ; srcIt != src.end(); ++srcIt, ++dstIt )
+ for( ; srcIt != src.end() && dstIt != dst.end(); ++srcIt, ++dstIt )
srcIt->calcProjection(H, *dstIt);
}
}
keypoints.resize(corners.size());
std::vector<Point2f>::const_iterator corner_it = corners.begin();
std::vector<KeyPoint>::iterator keypoint_it = keypoints.begin();
- for( ; corner_it != corners.end(); ++corner_it, ++keypoint_it )
+ for( ; corner_it != corners.end() && keypoint_it != keypoints.end(); ++corner_it, ++keypoint_it )
*keypoint_it = KeyPoint( *corner_it, (float)blockSize );
}
history->parent_ = h;
}
}
+ CV_Assert(h != NULL);
h->val = gray_level;
h->size = size;
h->head = head;
return mem;
}
+private:
+ PooledAllocator(const PooledAllocator &); // copy disabled
+ PooledAllocator& operator=(const PooledAllocator &); // assign disabled
};
}
bool loaded_;
/** Parameters passed to the index */
IndexParams index_params_;
+
+ Index(const Index &); // copy disabled
+ Index& operator=(const Index &); // assign disabled
};
/**
std::vector<double>& numValues) const;
void* params;
+
+private:
+ IndexParams(const IndexParams &); // copy disabled
+ IndexParams& operator=(const IndexParams &); // assign disabled
};
struct CV_EXPORTS KDTreeIndexParams : public IndexParams
bool m_native_depth;
bool m_iscolor;
bool m_isfloat;
+
+private:
+ ExrDecoder(const ExrDecoder &); // copy disabled
+ ExrDecoder& operator=(const ExrDecoder &); // assign disabled
};
FILE* m_f;
void* m_state;
+
+private:
+ JpegDecoder(const JpegDecoder &); // copy disabled
+ JpegDecoder& operator=(const JpegDecoder &); // assign disabled
};
bool readHdrData(Mat& img);
bool m_hdr;
size_t m_buf_pos;
+
+private:
+ TiffDecoder(const TiffDecoder &); // copy disabled
+ TiffDecoder& operator=(const TiffDecoder &); // assign disabled
};
#endif
//! @name Morphology operations
//! @sa cv::MorphTypes
//! @{
-#define MORPH_ERODE 0
-#define MORPH_DILATE 1
+#define CV_HAL_MORPH_ERODE 0
+#define CV_HAL_MORPH_DILATE 1
//! @}
//! @}
opts + "-D dcn=4 -D bidx=3");
break;
}
- case CV_BGR2Lab: case CV_RGB2Lab: case CV_LBGR2Lab: case CV_LRGB2Lab:
- case CV_BGR2Luv: case CV_RGB2Luv: case CV_LBGR2Luv: case CV_LRGB2Luv:
+ case COLOR_BGR2Lab: case COLOR_RGB2Lab: case COLOR_LBGR2Lab: case COLOR_LRGB2Lab:
+ case COLOR_BGR2Luv: case COLOR_RGB2Luv: case COLOR_LBGR2Luv: case COLOR_LRGB2Luv:
{
CV_Assert( (scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F) );
- bidx = code == CV_BGR2Lab || code == CV_LBGR2Lab || code == CV_BGR2Luv || code == CV_LBGR2Luv ? 0 : 2;
- bool srgb = code == CV_BGR2Lab || code == CV_RGB2Lab || code == CV_RGB2Luv || code == CV_BGR2Luv;
- bool lab = code == CV_BGR2Lab || code == CV_RGB2Lab || code == CV_LBGR2Lab || code == CV_LRGB2Lab;
+ bidx = code == COLOR_BGR2Lab || code == COLOR_LBGR2Lab || code == COLOR_BGR2Luv || code == COLOR_LBGR2Luv ? 0 : 2;
+ bool srgb = code == COLOR_BGR2Lab || code == COLOR_RGB2Lab || code == COLOR_RGB2Luv || code == COLOR_BGR2Luv;
+ bool lab = code == COLOR_BGR2Lab || code == COLOR_RGB2Lab || code == COLOR_LBGR2Lab || code == COLOR_LRGB2Lab;
float un, vn;
dcn = 3;
return k.run(dims, globalsize, NULL, false);
}
- case CV_Lab2BGR: case CV_Lab2RGB: case CV_Lab2LBGR: case CV_Lab2LRGB:
- case CV_Luv2BGR: case CV_Luv2RGB: case CV_Luv2LBGR: case CV_Luv2LRGB:
+ case COLOR_Lab2BGR: case COLOR_Lab2RGB: case COLOR_Lab2LBGR: case COLOR_Lab2LRGB:
+ case COLOR_Luv2BGR: case COLOR_Luv2RGB: case COLOR_Luv2LBGR: case COLOR_Luv2LRGB:
{
if( dcn <= 0 )
dcn = 3;
CV_Assert( scn == 3 && (dcn == 3 || dcn == 4) && (depth == CV_8U || depth == CV_32F) );
- bidx = code == CV_Lab2BGR || code == CV_Lab2LBGR || code == CV_Luv2BGR || code == CV_Luv2LBGR ? 0 : 2;
- bool srgb = code == CV_Lab2BGR || code == CV_Lab2RGB || code == CV_Luv2BGR || code == CV_Luv2RGB;
- bool lab = code == CV_Lab2BGR || code == CV_Lab2RGB || code == CV_Lab2LBGR || code == CV_Lab2LRGB;
+ bidx = code == COLOR_Lab2BGR || code == COLOR_Lab2LBGR || code == COLOR_Luv2BGR || code == COLOR_Luv2LBGR ? 0 : 2;
+ bool srgb = code == COLOR_Lab2BGR || code == COLOR_Lab2RGB || code == COLOR_Luv2BGR || code == COLOR_Luv2RGB;
+ bool lab = code == COLOR_Lab2BGR || code == COLOR_Lab2RGB || code == COLOR_Lab2LBGR || code == COLOR_Lab2LRGB;
float un, vn;
k.create(format("%s2BGR", lab ? "Lab" : "Luv").c_str(),
//
// Helper functions
//
+namespace {
+using namespace cv;
inline bool isHSV(int code)
{
switch(code)
{
- case CV_HSV2BGR: case CV_HSV2RGB: case CV_HSV2BGR_FULL: case CV_HSV2RGB_FULL:
- case CV_BGR2HSV: case CV_RGB2HSV: case CV_BGR2HSV_FULL: case CV_RGB2HSV_FULL:
+ case COLOR_HSV2BGR: case COLOR_HSV2RGB: case COLOR_HSV2BGR_FULL: case COLOR_HSV2RGB_FULL:
+ case COLOR_BGR2HSV: case COLOR_RGB2HSV: case COLOR_BGR2HSV_FULL: case COLOR_RGB2HSV_FULL:
return true;
default:
return false;
{
switch (code)
{
- case CV_Lab2BGR: case CV_Lab2RGB: case CV_Lab2LBGR: case CV_Lab2LRGB:
- case CV_BGR2Lab: case CV_RGB2Lab: case CV_LBGR2Lab: case CV_LRGB2Lab:
+ case COLOR_Lab2BGR: case COLOR_Lab2RGB: case COLOR_Lab2LBGR: case COLOR_Lab2LRGB:
+ case COLOR_BGR2Lab: case COLOR_RGB2Lab: case COLOR_LBGR2Lab: case COLOR_LRGB2Lab:
return true;
default:
return false;
{
switch (code)
{
- case CV_BGR2Lab: case CV_RGB2Lab: case CV_BGR2Luv: case CV_RGB2Luv:
- case CV_Lab2BGR: case CV_Lab2RGB: case CV_Luv2BGR: case CV_Luv2RGB:
+ case COLOR_BGR2Lab: case COLOR_RGB2Lab: case COLOR_BGR2Luv: case COLOR_RGB2Luv:
+ case COLOR_Lab2BGR: case COLOR_Lab2RGB: case COLOR_Luv2BGR: case COLOR_Luv2RGB:
return true;
default:
return false;
{
switch (code)
{
- case CV_BGR2BGRA: case CV_BGRA2BGR:
- case CV_BGR2BGR565: case CV_BGR2BGR555: case CV_BGRA2BGR565: case CV_BGRA2BGR555:
- case CV_BGR5652BGR: case CV_BGR5552BGR: case CV_BGR5652BGRA: case CV_BGR5552BGRA:
- case CV_BGR2GRAY: case CV_BGRA2GRAY:
- case CV_BGR2YCrCb: case CV_BGR2YUV:
- case CV_YCrCb2BGR: case CV_YUV2BGR:
- case CV_BGR2XYZ: case CV_XYZ2BGR:
- case CV_BGR2HSV: case CV_BGR2HLS: case CV_BGR2HSV_FULL: case CV_BGR2HLS_FULL:
- case CV_YUV2BGR_YV12: case CV_YUV2BGRA_YV12: case CV_YUV2BGR_IYUV: case CV_YUV2BGRA_IYUV:
- case CV_YUV2BGR_NV21: case CV_YUV2BGRA_NV21: case CV_YUV2BGR_NV12: case CV_YUV2BGRA_NV12:
- case CV_Lab2BGR: case CV_Luv2BGR: case CV_Lab2LBGR: case CV_Luv2LBGR:
- case CV_BGR2Lab: case CV_BGR2Luv: case CV_LBGR2Lab: case CV_LBGR2Luv:
- case CV_HSV2BGR: case CV_HLS2BGR: case CV_HSV2BGR_FULL: case CV_HLS2BGR_FULL:
- case CV_YUV2BGR_UYVY: case CV_YUV2BGRA_UYVY: case CV_YUV2BGR_YUY2:
- case CV_YUV2BGRA_YUY2: case CV_YUV2BGR_YVYU: case CV_YUV2BGRA_YVYU:
- case CV_BGR2YUV_IYUV: case CV_BGRA2YUV_IYUV: case CV_BGR2YUV_YV12: case CV_BGRA2YUV_YV12:
+ case COLOR_BGR2BGRA: case COLOR_BGRA2BGR:
+ case COLOR_BGR2BGR565: case COLOR_BGR2BGR555: case COLOR_BGRA2BGR565: case COLOR_BGRA2BGR555:
+ case COLOR_BGR5652BGR: case COLOR_BGR5552BGR: case COLOR_BGR5652BGRA: case COLOR_BGR5552BGRA:
+ case COLOR_BGR2GRAY: case COLOR_BGRA2GRAY:
+ case COLOR_BGR2YCrCb: case COLOR_BGR2YUV:
+ case COLOR_YCrCb2BGR: case COLOR_YUV2BGR:
+ case COLOR_BGR2XYZ: case COLOR_XYZ2BGR:
+ case COLOR_BGR2HSV: case COLOR_BGR2HLS: case COLOR_BGR2HSV_FULL: case COLOR_BGR2HLS_FULL:
+ case COLOR_YUV2BGR_YV12: case COLOR_YUV2BGRA_YV12: case COLOR_YUV2BGR_IYUV: case COLOR_YUV2BGRA_IYUV:
+ case COLOR_YUV2BGR_NV21: case COLOR_YUV2BGRA_NV21: case COLOR_YUV2BGR_NV12: case COLOR_YUV2BGRA_NV12:
+ case COLOR_Lab2BGR: case COLOR_Luv2BGR: case COLOR_Lab2LBGR: case COLOR_Luv2LBGR:
+ case COLOR_BGR2Lab: case COLOR_BGR2Luv: case COLOR_LBGR2Lab: case COLOR_LBGR2Luv:
+ case COLOR_HSV2BGR: case COLOR_HLS2BGR: case COLOR_HSV2BGR_FULL: case COLOR_HLS2BGR_FULL:
+ case COLOR_YUV2BGR_UYVY: case COLOR_YUV2BGRA_UYVY: case COLOR_YUV2BGR_YUY2:
+ case COLOR_YUV2BGRA_YUY2: case COLOR_YUV2BGR_YVYU: case COLOR_YUV2BGRA_YVYU:
+ case COLOR_BGR2YUV_IYUV: case COLOR_BGRA2YUV_IYUV: case COLOR_BGR2YUV_YV12: case COLOR_BGRA2YUV_YV12:
return false;
default:
return true;
{
switch (code)
{
- case CV_BGR2HSV_FULL: case CV_RGB2HSV_FULL: case CV_BGR2HLS_FULL: case CV_RGB2HLS_FULL:
- case CV_HSV2BGR_FULL: case CV_HSV2RGB_FULL: case CV_HLS2BGR_FULL: case CV_HLS2RGB_FULL:
+ case COLOR_BGR2HSV_FULL: case COLOR_RGB2HSV_FULL: case COLOR_BGR2HLS_FULL: case COLOR_RGB2HLS_FULL:
+ case COLOR_HSV2BGR_FULL: case COLOR_HSV2RGB_FULL: case COLOR_HLS2BGR_FULL: case COLOR_HLS2RGB_FULL:
return true;
default:
return false;
}
}
+} // namespace::
+
//////////////////////////////////////////////////////////////////////////////////////////
// The main function //
//////////////////////////////////////////////////////////////////////////////////////////
int stype = _src.type();
int scn = CV_MAT_CN(stype), depth = CV_MAT_DEPTH(stype), uidx, gbits, ycn;
- CV_OCL_RUN( _src.dims() <= 2 && _dst.isUMat() && !(depth == CV_8U && (code == CV_Luv2BGR || code == CV_Luv2RGB)),
+ CV_OCL_RUN( _src.dims() <= 2 && _dst.isUMat() && !(depth == CV_8U && (code == COLOR_Luv2BGR || code == COLOR_Luv2RGB)),
ocl_cvtColor(_src, _dst, code, dcn) )
Mat src, dst;
switch( code )
{
- case CV_BGR2BGRA: case CV_RGB2BGRA: case CV_BGRA2BGR:
- case CV_RGBA2BGR: case CV_RGB2BGR: case CV_BGRA2RGBA:
+ case COLOR_BGR2BGRA: case COLOR_RGB2BGRA: case COLOR_BGRA2BGR:
+ case COLOR_RGBA2BGR: case COLOR_RGB2BGR: case COLOR_BGRA2RGBA:
CV_Assert( scn == 3 || scn == 4 );
- dcn = code == CV_BGR2BGRA || code == CV_RGB2BGRA || code == CV_BGRA2RGBA ? 4 : 3;
+ dcn = code == COLOR_BGR2BGRA || code == COLOR_RGB2BGRA || code == COLOR_BGRA2RGBA ? 4 : 3;
_dst.create( sz, CV_MAKETYPE(depth, dcn));
dst = _dst.getMat();
hal::cvtBGRtoBGR(src.data, src.step, dst.data, dst.step, src.cols, src.rows,
depth, scn, dcn, swapBlue(code));
break;
- case CV_BGR2BGR565: case CV_BGR2BGR555: case CV_RGB2BGR565: case CV_RGB2BGR555:
- case CV_BGRA2BGR565: case CV_BGRA2BGR555: case CV_RGBA2BGR565: case CV_RGBA2BGR555:
+ case COLOR_BGR2BGR565: case COLOR_BGR2BGR555: case COLOR_RGB2BGR565: case COLOR_RGB2BGR555:
+ case COLOR_BGRA2BGR565: case COLOR_BGRA2BGR555: case COLOR_RGBA2BGR565: case COLOR_RGBA2BGR555:
CV_Assert( (scn == 3 || scn == 4) && depth == CV_8U );
- gbits = code == CV_BGR2BGR565 || code == CV_RGB2BGR565 ||
- code == CV_BGRA2BGR565 || code == CV_RGBA2BGR565 ? 6 : 5;
+ gbits = code == COLOR_BGR2BGR565 || code == COLOR_RGB2BGR565 ||
+ code == COLOR_BGRA2BGR565 || code == COLOR_RGBA2BGR565 ? 6 : 5;
_dst.create(sz, CV_8UC2);
dst = _dst.getMat();
hal::cvtBGRtoBGR5x5(src.data, src.step, dst.data, dst.step, src.cols, src.rows,
scn, swapBlue(code), gbits);
break;
- case CV_BGR5652BGR: case CV_BGR5552BGR: case CV_BGR5652RGB: case CV_BGR5552RGB:
- case CV_BGR5652BGRA: case CV_BGR5552BGRA: case CV_BGR5652RGBA: case CV_BGR5552RGBA:
- if(dcn <= 0) dcn = (code==CV_BGR5652BGRA || code==CV_BGR5552BGRA || code==CV_BGR5652RGBA || code==CV_BGR5552RGBA) ? 4 : 3;
+ case COLOR_BGR5652BGR: case COLOR_BGR5552BGR: case COLOR_BGR5652RGB: case COLOR_BGR5552RGB:
+ case COLOR_BGR5652BGRA: case COLOR_BGR5552BGRA: case COLOR_BGR5652RGBA: case COLOR_BGR5552RGBA:
+ if(dcn <= 0) dcn = (code==COLOR_BGR5652BGRA || code==COLOR_BGR5552BGRA || code==COLOR_BGR5652RGBA || code==COLOR_BGR5552RGBA) ? 4 : 3;
CV_Assert( (dcn == 3 || dcn == 4) && scn == 2 && depth == CV_8U );
- gbits = code == CV_BGR5652BGR || code == CV_BGR5652RGB ||
- code == CV_BGR5652BGRA || code == CV_BGR5652RGBA ? 6 : 5;
+ gbits = code == COLOR_BGR5652BGR || code == COLOR_BGR5652RGB ||
+ code == COLOR_BGR5652BGRA || code == COLOR_BGR5652RGBA ? 6 : 5;
_dst.create(sz, CV_MAKETYPE(depth, dcn));
dst = _dst.getMat();
hal::cvtBGR5x5toBGR(src.data, src.step, dst.data, dst.step, src.cols, src.rows,
dcn, swapBlue(code), gbits);
break;
- case CV_BGR2GRAY: case CV_BGRA2GRAY: case CV_RGB2GRAY: case CV_RGBA2GRAY:
+ case COLOR_BGR2GRAY: case COLOR_BGRA2GRAY: case COLOR_RGB2GRAY: case COLOR_RGBA2GRAY:
CV_Assert( scn == 3 || scn == 4 );
_dst.create(sz, CV_MAKETYPE(depth, 1));
dst = _dst.getMat();
depth, scn, swapBlue(code));
break;
- case CV_BGR5652GRAY: case CV_BGR5552GRAY:
+ case COLOR_BGR5652GRAY: case COLOR_BGR5552GRAY:
CV_Assert( scn == 2 && depth == CV_8U );
- gbits = code == CV_BGR5652GRAY ? 6 : 5;
+ gbits = code == COLOR_BGR5652GRAY ? 6 : 5;
_dst.create(sz, CV_8UC1);
dst = _dst.getMat();
hal::cvtBGR5x5toGray(src.data, src.step, dst.data, dst.step, src.cols, src.rows, gbits);
break;
- case CV_GRAY2BGR: case CV_GRAY2BGRA:
- if( dcn <= 0 ) dcn = (code==CV_GRAY2BGRA) ? 4 : 3;
+ case COLOR_GRAY2BGR: case COLOR_GRAY2BGRA:
+ if( dcn <= 0 ) dcn = (code==COLOR_GRAY2BGRA) ? 4 : 3;
CV_Assert( scn == 1 && (dcn == 3 || dcn == 4));
_dst.create(sz, CV_MAKETYPE(depth, dcn));
dst = _dst.getMat();
hal::cvtGraytoBGR(src.data, src.step, dst.data, dst.step, src.cols, src.rows, depth, dcn);
break;
- case CV_GRAY2BGR565: case CV_GRAY2BGR555:
+ case COLOR_GRAY2BGR565: case COLOR_GRAY2BGR555:
CV_Assert( scn == 1 && depth == CV_8U );
- gbits = code == CV_GRAY2BGR565 ? 6 : 5;
+ gbits = code == COLOR_GRAY2BGR565 ? 6 : 5;
_dst.create(sz, CV_8UC2);
dst = _dst.getMat();
hal::cvtGraytoBGR5x5(src.data, src.step, dst.data, dst.step, src.cols, src.rows, gbits);
break;
- case CV_BGR2YCrCb: case CV_RGB2YCrCb:
- case CV_BGR2YUV: case CV_RGB2YUV:
+ case COLOR_BGR2YCrCb: case COLOR_RGB2YCrCb:
+ case COLOR_BGR2YUV: case COLOR_RGB2YUV:
CV_Assert( scn == 3 || scn == 4 );
_dst.create(sz, CV_MAKETYPE(depth, 3));
dst = _dst.getMat();
hal::cvtBGRtoYUV(src.data, src.step, dst.data, dst.step, src.cols, src.rows,
- depth, scn, swapBlue(code), code == CV_BGR2YCrCb || code == CV_RGB2YCrCb);
+ depth, scn, swapBlue(code), code == COLOR_BGR2YCrCb || code == COLOR_RGB2YCrCb);
break;
- case CV_YCrCb2BGR: case CV_YCrCb2RGB:
- case CV_YUV2BGR: case CV_YUV2RGB:
+ case COLOR_YCrCb2BGR: case COLOR_YCrCb2RGB:
+ case COLOR_YUV2BGR: case COLOR_YUV2RGB:
if( dcn <= 0 ) dcn = 3;
CV_Assert( scn == 3 && (dcn == 3 || dcn == 4) );
_dst.create(sz, CV_MAKETYPE(depth, dcn));
dst = _dst.getMat();
hal::cvtYUVtoBGR(src.data, src.step, dst.data, dst.step, src.cols, src.rows,
- depth, dcn, swapBlue(code), code == CV_YCrCb2BGR || code == CV_YCrCb2RGB);
+ depth, dcn, swapBlue(code), code == COLOR_YCrCb2BGR || code == COLOR_YCrCb2RGB);
break;
- case CV_BGR2XYZ: case CV_RGB2XYZ:
+ case COLOR_BGR2XYZ: case COLOR_RGB2XYZ:
CV_Assert( scn == 3 || scn == 4 );
_dst.create(sz, CV_MAKETYPE(depth, 3));
dst = _dst.getMat();
hal::cvtBGRtoXYZ(src.data, src.step, dst.data, dst.step, src.cols, src.rows, depth, scn, swapBlue(code));
break;
- case CV_XYZ2BGR: case CV_XYZ2RGB:
+ case COLOR_XYZ2BGR: case COLOR_XYZ2RGB:
if( dcn <= 0 ) dcn = 3;
CV_Assert( scn == 3 && (dcn == 3 || dcn == 4) );
_dst.create(sz, CV_MAKETYPE(depth, dcn));
hal::cvtXYZtoBGR(src.data, src.step, dst.data, dst.step, src.cols, src.rows, depth, dcn, swapBlue(code));
break;
- case CV_BGR2HSV: case CV_RGB2HSV: case CV_BGR2HSV_FULL: case CV_RGB2HSV_FULL:
- case CV_BGR2HLS: case CV_RGB2HLS: case CV_BGR2HLS_FULL: case CV_RGB2HLS_FULL:
+ case COLOR_BGR2HSV: case COLOR_RGB2HSV: case COLOR_BGR2HSV_FULL: case COLOR_RGB2HSV_FULL:
+ case COLOR_BGR2HLS: case COLOR_RGB2HLS: case COLOR_BGR2HLS_FULL: case COLOR_RGB2HLS_FULL:
CV_Assert( (scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F) );
_dst.create(sz, CV_MAKETYPE(depth, 3));
dst = _dst.getMat();
depth, scn, swapBlue(code), isFullRange(code), isHSV(code));
break;
- case CV_HSV2BGR: case CV_HSV2RGB: case CV_HSV2BGR_FULL: case CV_HSV2RGB_FULL:
- case CV_HLS2BGR: case CV_HLS2RGB: case CV_HLS2BGR_FULL: case CV_HLS2RGB_FULL:
+ case COLOR_HSV2BGR: case COLOR_HSV2RGB: case COLOR_HSV2BGR_FULL: case COLOR_HSV2RGB_FULL:
+ case COLOR_HLS2BGR: case COLOR_HLS2RGB: case COLOR_HLS2BGR_FULL: case COLOR_HLS2RGB_FULL:
if( dcn <= 0 ) dcn = 3;
CV_Assert( scn == 3 && (dcn == 3 || dcn == 4) && (depth == CV_8U || depth == CV_32F) );
_dst.create(sz, CV_MAKETYPE(depth, dcn));
depth, dcn, swapBlue(code), isFullRange(code), isHSV(code));
break;
- case CV_BGR2Lab: case CV_RGB2Lab: case CV_LBGR2Lab: case CV_LRGB2Lab:
- case CV_BGR2Luv: case CV_RGB2Luv: case CV_LBGR2Luv: case CV_LRGB2Luv:
+ case COLOR_BGR2Lab: case COLOR_RGB2Lab: case COLOR_LBGR2Lab: case COLOR_LRGB2Lab:
+ case COLOR_BGR2Luv: case COLOR_RGB2Luv: case COLOR_LBGR2Luv: case COLOR_LRGB2Luv:
CV_Assert( (scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F) );
_dst.create(sz, CV_MAKETYPE(depth, 3));
dst = _dst.getMat();
depth, scn, swapBlue(code), isLab(code), issRGB(code));
break;
- case CV_Lab2BGR: case CV_Lab2RGB: case CV_Lab2LBGR: case CV_Lab2LRGB:
- case CV_Luv2BGR: case CV_Luv2RGB: case CV_Luv2LBGR: case CV_Luv2LRGB:
+ case COLOR_Lab2BGR: case COLOR_Lab2RGB: case COLOR_Lab2LBGR: case COLOR_Lab2LRGB:
+ case COLOR_Luv2BGR: case COLOR_Luv2RGB: case COLOR_Luv2LBGR: case COLOR_Luv2LRGB:
if( dcn <= 0 ) dcn = 3;
CV_Assert( scn == 3 && (dcn == 3 || dcn == 4) && (depth == CV_8U || depth == CV_32F) );
_dst.create(sz, CV_MAKETYPE(depth, dcn));
depth, dcn, swapBlue(code), isLab(code), issRGB(code));
break;
- case CV_BayerBG2GRAY: case CV_BayerGB2GRAY: case CV_BayerRG2GRAY: case CV_BayerGR2GRAY:
- case CV_BayerBG2BGR: case CV_BayerGB2BGR: case CV_BayerRG2BGR: case CV_BayerGR2BGR:
- case CV_BayerBG2BGR_VNG: case CV_BayerGB2BGR_VNG: case CV_BayerRG2BGR_VNG: case CV_BayerGR2BGR_VNG:
- case CV_BayerBG2BGR_EA: case CV_BayerGB2BGR_EA: case CV_BayerRG2BGR_EA: case CV_BayerGR2BGR_EA:
- case CV_BayerBG2BGRA: case CV_BayerGB2BGRA: case CV_BayerRG2BGRA: case CV_BayerGR2BGRA:
+ case COLOR_BayerBG2GRAY: case COLOR_BayerGB2GRAY: case COLOR_BayerRG2GRAY: case COLOR_BayerGR2GRAY:
+ case COLOR_BayerBG2BGR: case COLOR_BayerGB2BGR: case COLOR_BayerRG2BGR: case COLOR_BayerGR2BGR:
+ case COLOR_BayerBG2BGR_VNG: case COLOR_BayerGB2BGR_VNG: case COLOR_BayerRG2BGR_VNG: case COLOR_BayerGR2BGR_VNG:
+ case COLOR_BayerBG2BGR_EA: case COLOR_BayerGB2BGR_EA: case COLOR_BayerRG2BGR_EA: case COLOR_BayerGR2BGR_EA:
+ case COLOR_BayerBG2BGRA: case COLOR_BayerGB2BGRA: case COLOR_BayerRG2BGRA: case COLOR_BayerGR2BGRA:
demosaicing(src, _dst, code, dcn);
break;
- case CV_YUV2BGR_NV21: case CV_YUV2RGB_NV21: case CV_YUV2BGR_NV12: case CV_YUV2RGB_NV12:
- case CV_YUV2BGRA_NV21: case CV_YUV2RGBA_NV21: case CV_YUV2BGRA_NV12: case CV_YUV2RGBA_NV12:
+ case COLOR_YUV2BGR_NV21: case COLOR_YUV2RGB_NV21: case COLOR_YUV2BGR_NV12: case COLOR_YUV2RGB_NV12:
+ case COLOR_YUV2BGRA_NV21: case COLOR_YUV2RGBA_NV21: case COLOR_YUV2BGRA_NV12: case COLOR_YUV2RGBA_NV12:
// http://www.fourcc.org/yuv.php#NV21 == yuv420sp -> a plane of 8 bit Y samples followed by an interleaved V/U plane containing 8 bit 2x2 subsampled chroma samples
// http://www.fourcc.org/yuv.php#NV12 -> a plane of 8 bit Y samples followed by an interleaved U/V plane containing 8 bit 2x2 subsampled colour difference samples
- if (dcn <= 0) dcn = (code==CV_YUV420sp2BGRA || code==CV_YUV420sp2RGBA || code==CV_YUV2BGRA_NV12 || code==CV_YUV2RGBA_NV12) ? 4 : 3;
- uidx = (code==CV_YUV2BGR_NV21 || code==CV_YUV2BGRA_NV21 || code==CV_YUV2RGB_NV21 || code==CV_YUV2RGBA_NV21) ? 1 : 0;
+ if (dcn <= 0) dcn = (code==COLOR_YUV420sp2BGRA || code==COLOR_YUV420sp2RGBA || code==COLOR_YUV2BGRA_NV12 || code==COLOR_YUV2RGBA_NV12) ? 4 : 3;
+ uidx = (code==COLOR_YUV2BGR_NV21 || code==COLOR_YUV2BGRA_NV21 || code==COLOR_YUV2RGB_NV21 || code==COLOR_YUV2RGBA_NV21) ? 1 : 0;
CV_Assert( dcn == 3 || dcn == 4 );
CV_Assert( sz.width % 2 == 0 && sz.height % 3 == 0 && depth == CV_8U );
_dst.create(Size(sz.width, sz.height * 2 / 3), CV_MAKETYPE(depth, dcn));
hal::cvtTwoPlaneYUVtoBGR(src.data, src.step, dst.data, dst.step, dst.cols, dst.rows,
dcn, swapBlue(code), uidx);
break;
- case CV_YUV2BGR_YV12: case CV_YUV2RGB_YV12: case CV_YUV2BGRA_YV12: case CV_YUV2RGBA_YV12:
- case CV_YUV2BGR_IYUV: case CV_YUV2RGB_IYUV: case CV_YUV2BGRA_IYUV: case CV_YUV2RGBA_IYUV:
+ case COLOR_YUV2BGR_YV12: case COLOR_YUV2RGB_YV12: case COLOR_YUV2BGRA_YV12: case COLOR_YUV2RGBA_YV12:
+ case COLOR_YUV2BGR_IYUV: case COLOR_YUV2RGB_IYUV: case COLOR_YUV2BGRA_IYUV: case COLOR_YUV2RGBA_IYUV:
//http://www.fourcc.org/yuv.php#YV12 == yuv420p -> It comprises an NxM Y plane followed by (N/2)x(M/2) V and U planes.
//http://www.fourcc.org/yuv.php#IYUV == I420 -> It comprises an NxN Y plane followed by (N/2)x(N/2) U and V planes
- if (dcn <= 0) dcn = (code==CV_YUV2BGRA_YV12 || code==CV_YUV2RGBA_YV12 || code==CV_YUV2RGBA_IYUV || code==CV_YUV2BGRA_IYUV) ? 4 : 3;
- uidx = (code==CV_YUV2BGR_YV12 || code==CV_YUV2RGB_YV12 || code==CV_YUV2BGRA_YV12 || code==CV_YUV2RGBA_YV12) ? 1 : 0;
+ if (dcn <= 0) dcn = (code==COLOR_YUV2BGRA_YV12 || code==COLOR_YUV2RGBA_YV12 || code==COLOR_YUV2RGBA_IYUV || code==COLOR_YUV2BGRA_IYUV) ? 4 : 3;
+ uidx = (code==COLOR_YUV2BGR_YV12 || code==COLOR_YUV2RGB_YV12 || code==COLOR_YUV2BGRA_YV12 || code==COLOR_YUV2RGBA_YV12) ? 1 : 0;
CV_Assert( dcn == 3 || dcn == 4 );
CV_Assert( sz.width % 2 == 0 && sz.height % 3 == 0 && depth == CV_8U );
_dst.create(Size(sz.width, sz.height * 2 / 3), CV_MAKETYPE(depth, dcn));
dcn, swapBlue(code), uidx);
break;
- case CV_YUV2GRAY_420:
+ case COLOR_YUV2GRAY_420:
{
if (dcn <= 0) dcn = 1;
src(Range(0, dstSz.height), Range::all()).copyTo(dst);
}
break;
- case CV_RGB2YUV_YV12: case CV_BGR2YUV_YV12: case CV_RGBA2YUV_YV12: case CV_BGRA2YUV_YV12:
- case CV_RGB2YUV_IYUV: case CV_BGR2YUV_IYUV: case CV_RGBA2YUV_IYUV: case CV_BGRA2YUV_IYUV:
+ case COLOR_RGB2YUV_YV12: case COLOR_BGR2YUV_YV12: case COLOR_RGBA2YUV_YV12: case COLOR_BGRA2YUV_YV12:
+ case COLOR_RGB2YUV_IYUV: case COLOR_BGR2YUV_IYUV: case COLOR_RGBA2YUV_IYUV: case COLOR_BGRA2YUV_IYUV:
if (dcn <= 0) dcn = 1;
- uidx = (code == CV_BGR2YUV_IYUV || code == CV_BGRA2YUV_IYUV || code == CV_RGB2YUV_IYUV || code == CV_RGBA2YUV_IYUV) ? 1 : 2;
+ uidx = (code == COLOR_BGR2YUV_IYUV || code == COLOR_BGRA2YUV_IYUV || code == COLOR_RGB2YUV_IYUV || code == COLOR_RGBA2YUV_IYUV) ? 1 : 2;
CV_Assert( (scn == 3 || scn == 4) && depth == CV_8U );
CV_Assert( dcn == 1 );
CV_Assert( sz.width % 2 == 0 && sz.height % 2 == 0 );
hal::cvtBGRtoThreePlaneYUV(src.data, src.step, dst.data, dst.step, src.cols, src.rows,
scn, swapBlue(code), uidx);
break;
- case CV_YUV2RGB_UYVY: case CV_YUV2BGR_UYVY: case CV_YUV2RGBA_UYVY: case CV_YUV2BGRA_UYVY:
- case CV_YUV2RGB_YUY2: case CV_YUV2BGR_YUY2: case CV_YUV2RGB_YVYU: case CV_YUV2BGR_YVYU:
- case CV_YUV2RGBA_YUY2: case CV_YUV2BGRA_YUY2: case CV_YUV2RGBA_YVYU: case CV_YUV2BGRA_YVYU:
+ case COLOR_YUV2RGB_UYVY: case COLOR_YUV2BGR_UYVY: case COLOR_YUV2RGBA_UYVY: case COLOR_YUV2BGRA_UYVY:
+ case COLOR_YUV2RGB_YUY2: case COLOR_YUV2BGR_YUY2: case COLOR_YUV2RGB_YVYU: case COLOR_YUV2BGR_YVYU:
+ case COLOR_YUV2RGBA_YUY2: case COLOR_YUV2BGRA_YUY2: case COLOR_YUV2RGBA_YVYU: case COLOR_YUV2BGRA_YVYU:
//http://www.fourcc.org/yuv.php#UYVY
//http://www.fourcc.org/yuv.php#YUY2
//http://www.fourcc.org/yuv.php#YVYU
- if (dcn <= 0) dcn = (code==CV_YUV2RGBA_UYVY || code==CV_YUV2BGRA_UYVY || code==CV_YUV2RGBA_YUY2 || code==CV_YUV2BGRA_YUY2 || code==CV_YUV2RGBA_YVYU || code==CV_YUV2BGRA_YVYU) ? 4 : 3;
- ycn = (code==CV_YUV2RGB_UYVY || code==CV_YUV2BGR_UYVY || code==CV_YUV2RGBA_UYVY || code==CV_YUV2BGRA_UYVY) ? 1 : 0;
- uidx = (code==CV_YUV2RGB_YVYU || code==CV_YUV2BGR_YVYU || code==CV_YUV2RGBA_YVYU || code==CV_YUV2BGRA_YVYU) ? 1 : 0;
+ if (dcn <= 0) dcn = (code==COLOR_YUV2RGBA_UYVY || code==COLOR_YUV2BGRA_UYVY || code==COLOR_YUV2RGBA_YUY2 || code==COLOR_YUV2BGRA_YUY2 || code==COLOR_YUV2RGBA_YVYU || code==COLOR_YUV2BGRA_YVYU) ? 4 : 3;
+ ycn = (code==COLOR_YUV2RGB_UYVY || code==COLOR_YUV2BGR_UYVY || code==COLOR_YUV2RGBA_UYVY || code==COLOR_YUV2BGRA_UYVY) ? 1 : 0;
+ uidx = (code==COLOR_YUV2RGB_YVYU || code==COLOR_YUV2BGR_YVYU || code==COLOR_YUV2RGBA_YVYU || code==COLOR_YUV2BGRA_YVYU) ? 1 : 0;
CV_Assert( dcn == 3 || dcn == 4 );
CV_Assert( scn == 2 && depth == CV_8U );
_dst.create(sz, CV_8UC(dcn));
hal::cvtOnePlaneYUVtoBGR(src.data, src.step, dst.data, dst.step, src.cols, src.rows,
dcn, swapBlue(code), uidx, ycn);
break;
- case CV_YUV2GRAY_UYVY: case CV_YUV2GRAY_YUY2:
+ case COLOR_YUV2GRAY_UYVY: case COLOR_YUV2GRAY_YUY2:
{
if (dcn <= 0) dcn = 1;
CV_Assert( scn == 2 && depth == CV_8U );
src.release(); // T-API datarace fixup
- extractChannel(_src, _dst, code == CV_YUV2GRAY_UYVY ? 1 : 0);
+ extractChannel(_src, _dst, code == COLOR_YUV2GRAY_UYVY ? 1 : 0);
}
break;
- case CV_RGBA2mRGBA:
+ case COLOR_RGBA2mRGBA:
if (dcn <= 0) dcn = 4;
CV_Assert( scn == 4 && dcn == 4 && depth == CV_8U );
_dst.create(sz, CV_MAKETYPE(depth, dcn));
dst = _dst.getMat();
hal::cvtRGBAtoMultipliedRGBA(src.data, src.step, dst.data, dst.step, src.cols, src.rows);
break;
- case CV_mRGBA2RGBA:
+ case COLOR_mRGBA2RGBA:
if (dcn <= 0) dcn = 4;
CV_Assert( scn == 4 && dcn == 4 && depth == CV_8U );
_dst.create(sz, CV_MAKETYPE(depth, dcn));
}
}
- int bt_pix0 = (int)img.elemSize(), bt_pix = bt_pix0;
+ size_t bt_pix0 = img.elemSize(), bt_pix = bt_pix0;
size_t istep = img.step;
int dx = pt2.x - pt1.x;
plusDelta = dx + dx;
minusDelta = -(dy + dy);
plusStep = (int)istep;
- minusStep = bt_pix;
+ minusStep = (int)bt_pix;
count = dx + 1;
}
else /* connectivity == 4 */
err = 0;
plusDelta = (dx + dx) + (dy + dy);
minusDelta = -(dy + dy);
- plusStep = (int)istep - bt_pix;
- minusStep = bt_pix;
+ plusStep = (int)(istep - bt_pix);
+ minusStep = (int)bt_pix;
count = dx + dy + 1;
}
this->ptr0 = img.ptr();
this->step = (int)img.step;
- this->elemSize = bt_pix0;
+ this->elemSize = (int)bt_pix0;
}
static void
static int icvFindBasicVariables( float **cost, char **is_x,
CvNode1D * u, CvNode1D * v, int ssize, int dsize )
{
- int i, j, found;
+ int i, j;
int u_cfound, v_cfound;
CvNode1D u0_head, u1_head, *cur_u, *prev_u;
CvNode1D v0_head, v1_head, *cur_v, *prev_v;
+ bool found;
+
+ CV_Assert(u != 0 && v != 0);
/* initialize the rows list (u) and the columns list (v) */
u0_head.next = u;
u_cfound = v_cfound = 0;
while( u_cfound < ssize || v_cfound < dsize )
{
- found = 0;
+ found = false;
if( v_cfound < dsize )
{
/* loop over all marked columns */
prev_v = &v1_head;
-
- for( found |= (cur_v = v1_head.next) != 0; cur_v != 0; cur_v = cur_v->next )
+ cur_v = v1_head.next;
+ found = found || (cur_v != 0);
+ for( ; cur_v != 0; cur_v = cur_v->next )
{
float cur_v_val = cur_v->val;
{
/* loop over all marked rows */
prev_u = &u1_head;
- for( found |= (cur_u = u1_head.next) != 0; cur_u != 0; cur_u = cur_u->next )
+ cur_u = u1_head.next;
+ found = found || (cur_u != 0);
+ for( ; cur_u != 0; cur_u = cur_u->next )
{
float cur_u_val = cur_u->val;
float *_cost;
erode( src, dst, kernel, anchor, iterations, borderType, borderValue );
dilate( dst, dst, kernel, anchor, iterations, borderType, borderValue );
break;
- case CV_MOP_CLOSE:
+ case MORPH_CLOSE:
dilate( src, dst, kernel, anchor, iterations, borderType, borderValue );
erode( dst, dst, kernel, anchor, iterations, borderType, borderValue );
break;
- case CV_MOP_GRADIENT:
+ case MORPH_GRADIENT:
erode( src, temp, kernel, anchor, iterations, borderType, borderValue );
dilate( src, dst, kernel, anchor, iterations, borderType, borderValue );
dst -= temp;
break;
- case CV_MOP_TOPHAT:
+ case MORPH_TOPHAT:
if( src.data != dst.data )
temp = dst;
erode( src, temp, kernel, anchor, iterations, borderType, borderValue );
dilate( temp, temp, kernel, anchor, iterations, borderType, borderValue );
dst = src - temp;
break;
- case CV_MOP_BLACKHAT:
+ case MORPH_BLACKHAT:
if( src.data != dst.data )
temp = dst;
dilate( src, temp, kernel, anchor, iterations, borderType, borderValue );
break;
}
}
- assert( k < 16 );
+ CV_Assert( k < 16 );
/* Update corresponding histogram segment */
if ( luc[c][k] <= j-r )
break;
}
}
- assert( b < 16 );
+ CV_Assert( b < 16 );
}
}
else
break;
}
}
- assert( k < 16 );
+ CV_Assert( k < 16 );
/* Update corresponding histogram segment */
if ( luc[c][k] <= j-r )
break;
}
}
- assert( b < 16 );
+ CV_Assert( b < 16 );
}
}
}
}
#ifdef HAVE_IPP
- unsigned char thresh;
+ unsigned char thresh = 0;
CV_IPP_RUN_FAST(ipp_getThreshVal_Otsu_8u(_src.ptr(), step, size, thresh), thresh);
#endif
for(int i =0;i<labels.rows;i++)
{
- new_labels.at<int>(i,0) = lmap.find(labels.at<int>(i,0))->second;
+ map<int, int>::const_iterator val = lmap.find(labels.at<int>(i,0));
+ CV_Assert(val != lmap.end());
+ new_labels.at<int>(i,0) = val->second;
}
return new_labels;
}
typedef struct CvHidHaarClassifierCascade
{
int count;
- int isStumpBased;
int has_tilted_features;
- int is_tree;
double inv_window_area;
CvMat sum, sqsum, tilted;
CvHidHaarStageClassifier* stage_classifier;
sumtype *p0, *p1, *p2, *p3;
void** ipp_stages;
+ bool is_tree;
+ bool isStumpBased;
} CvHidHaarClassifierCascade;
CvHidHaarClassifier* haar_classifier_ptr;
CvHidHaarTreeNode* haar_node_ptr;
CvSize orig_window_size;
- int has_tilted_features = 0;
+ bool has_tilted_features = false;
int max_count = 0;
if( !CV_IS_HAAR_CLASSIFIER(cascade) )
{
CvRect r = classifier->haar_feature[l].rect[k].r;
int tilted = classifier->haar_feature[l].tilted;
- has_tilted_features |= tilted != 0;
+ has_tilted_features = has_tilted_features | (tilted != 0);
if( r.width < 0 || r.height < 0 || r.y < 0 ||
r.x + r.width > orig_window_size.width
||
haar_classifier_ptr = (CvHidHaarClassifier*)(out->stage_classifier + cascade->count);
haar_node_ptr = (CvHidHaarTreeNode*)(haar_classifier_ptr + total_classifiers);
- out->isStumpBased = 1;
+ out->isStumpBased = true;
out->has_tilted_features = has_tilted_features;
- out->is_tree = 0;
+ out->is_tree = false;
/* initialize internal representation */
for( i = 0; i < cascade->count; i++ )
hid_stage_classifier->child = (stage_classifier->child == -1)
? NULL : out->stage_classifier + stage_classifier->child;
- out->is_tree |= hid_stage_classifier->next != NULL;
+ out->is_tree = out->is_tree || (hid_stage_classifier->next != NULL);
for( j = 0; j < stage_classifier->count; j++ )
{
haar_node_ptr =
(CvHidHaarTreeNode*)cvAlignPtr(alpha_ptr+node_count+1, sizeof(void*));
- out->isStumpBased &= node_count == 1;
+ out->isStumpBased = out->isStumpBased && (node_count == 1);
}
}
class CvPriorityQueueFloat
{
+private:
+ CvPriorityQueueFloat(const CvPriorityQueueFloat & ); // copy disabled
+ CvPriorityQueueFloat& operator=(const CvPriorityQueueFloat &); // assign disabled
+
protected:
CvHeapElem *mem,*empty,*head,*tail;
int num,in;
{
CameraParams();
CameraParams(const CameraParams& other);
- const CameraParams& operator =(const CameraParams& other);
+ CameraParams& operator =(const CameraParams& other);
Mat K() const;
double focal; // Focal length
{
MatchesInfo();
MatchesInfo(const MatchesInfo &other);
- const MatchesInfo& operator =(const MatchesInfo &other);
+ MatchesInfo& operator =(const MatchesInfo &other);
int src_img_idx, dst_img_idx; //!< Images indices (optional)
std::vector<DMatch> matches;
CameraParams::CameraParams(const CameraParams &other) { *this = other; }
-const CameraParams& CameraParams::operator =(const CameraParams &other)
+CameraParams& CameraParams::operator =(const CameraParams &other)
{
focal = other.focal;
ppx = other.ppx;
MatchesInfo::MatchesInfo(const MatchesInfo &other) { *this = other; }
-const MatchesInfo& MatchesInfo::operator =(const MatchesInfo &other)
+MatchesInfo& MatchesInfo::operator =(const MatchesInfo &other)
{
src_img_idx = other.src_img_idx;
dst_img_idx = other.dst_img_idx;
for (std::map<int, int>::iterator itr = connect2.begin(); itr != connect2.end(); ++itr)
{
double len = static_cast<double>(contours_[comp1].size());
- isAdjComp[itr->first] = itr->second / len > 0.05 && connectOther.find(itr->first)->second / len < 0.1;
+ int res = 0;
+ if (itr->second / len > 0.05)
+ {
+ std::map<int, int>::const_iterator sub = connectOther.find(itr->first);
+ if (sub != connectOther.end() && (sub->second / len < 0.1))
+ {
+ res = 1;
+ }
+ }
+ isAdjComp[itr->first] = res;
}
// update labels