int aperture_size0 = aperture_size;
int temp_step = 0, d_step;
uchar* shifted_ptr = 0;
- int depth, d_depth, datatype;
+ int depth, d_depth;
int stage = CV_START;
CvSobelFixedIPPFunc ipp_sobel_vert = 0, ipp_sobel_horiz = 0;
CvFilterFixedIPPFunc ipp_scharr_vert = 0, ipp_scharr_horiz = 0;
CvPoint el_anchor;
double factorx, factory;
bool use_ipp = false;
- CvMat _cov2, *cov2 = &_cov2;
if( block_size < 3 || !(block_size & 1) )
CV_ERROR( CV_StsOutOfRange, "averaging window size must be an odd number >= 3" );
depth = CV_MAT_DEPTH(src->type);
d_depth = depth == CV_8U ? CV_16S : CV_32F;
- datatype = depth == CV_8U ? cv8u : cv32f;
size = cvGetMatSize(src);
aligned_width = cvAlign(size.width, 4);
CV_CALL( Dx = cvCreateMat( max_dy, aligned_width, d_depth ));
CV_CALL( Dy = cvCreateMat( max_dy, aligned_width, d_depth ));
CV_CALL( cov = cvCreateMat( max_dy + block_size + 1, size.width, CV_32FC3 ));
- _cov2 = *cov;
CV_CALL( sqrt_buf = cvCreateMat( 2, size.width, CV_32F ));
Dx->cols = Dy->cols = size.width;
if( y + stripe_size.height >= size.height )
stage = stage & CV_START ? CV_START + CV_END : CV_END;
- cov->rows = stripe_size.height;
- stripe_size.height = blur_filter.process(cov,cov2,
- cvRect(0,0,-1,-1),cvPoint(0,0),stage);
+ stripe_size.height = blur_filter.process(cov,cov,
+ cvRect(0,0,-1,stripe_size.height),cvPoint(0,0),stage+CV_ISOLATED_ROI);
if( op_type == ICV_MINEIGENVAL )
icvCalcMinEigenVal( cov->data.fl, cov->step,
int i, j, y, dst_y = 0, max_dy, delta = 0;
int temp_step = 0, d_step;
uchar* shifted_ptr = 0;
- int depth, d_depth, datatype;
+ int depth, d_depth;
int stage = CV_START;
CvSobelFixedIPPFunc ipp_sobel_vert = 0, ipp_sobel_horiz = 0,
ipp_sobel_vert_second = 0, ipp_sobel_horiz_second = 0,
depth = CV_MAT_DEPTH(src->type);
d_depth = depth == CV_8U ? CV_16S : CV_32F;
- datatype = depth == CV_8U ? cv8u : cv32f;
size = cvGetMatSize(src);
aligned_width = cvAlign(size.width, 4);
__BEGIN__;
- int total_buf_sz, src_pix_sz, work_pix_sz, row_tab_sz, bsz;
+ int total_buf_sz, src_pix_sz, row_tab_sz, bsz;
uchar* ptr;
if( !(buffer && _max_width <= max_width && _src_type == src_type &&
buf_size = cvAlign( buf_size, ALIGN );
src_pix_sz = CV_ELEM_SIZE(src_type);
- work_pix_sz = CV_ELEM_SIZE(work_type);
border_tab_sz1 = anchor.x*src_pix_sz;
border_tab_sz = (ksize.width-1)*src_pix_sz;
bsz = cvAlign( border_tab_sz*sizeof(int), ALIGN );
int CvBaseImageFilter::process( const CvMat* src, CvMat* dst,
- CvRect src_roi, CvPoint dst_origin, int phase )
+ CvRect src_roi, CvPoint dst_origin, int flags )
{
int rows_processed = 0;
__BEGIN__;
int i, width, _src_y1, _src_y2;
- int src_y, src_y1, src_y2, dst_y, width_n;
+ int src_x, src_y, src_y1, src_y2, dst_y;
int pix_size = CV_ELEM_SIZE(src_type);
uchar *sptr = 0, *dptr;
+ int phase = flags & (CV_START|CV_END|CV_MIDDLE);
+ bool isolated_roi = (flags & CV_ISOLATED_ROI) != 0;
if( !CV_IS_MAT(src) )
CV_ERROR( CV_StsBadArg, "" );
CV_ERROR( CV_StsUnmatchedFormats, "" );
width = src->cols;
- _src_y1 = 0;
- _src_y2 = src->rows;
if( src_roi.width == -1 && src_roi.x == 0 )
src_roi.width = width;
if( src_roi.height == -1 && src_roi.y == 0 )
{
- src_roi.y = _src_y1;
- src_roi.height = _src_y2 - _src_y1;
+ src_roi.y = 0;
+ src_roi.height = src->rows;
}
if( src_roi.width > max_width ||
src_roi.x < 0 || src_roi.width < 0 ||
- src_roi.y < _src_y1 || src_roi.height < 0 ||
+ src_roi.y < 0 || src_roi.height < 0 ||
src_roi.x + src_roi.width > width ||
- src_roi.y + src_roi.height > _src_y2 )
+ src_roi.y + src_roi.height > src->rows )
CV_ERROR( CV_StsOutOfRange, "Too large source image or its ROI" );
+ src_x = src_roi.x;
+ _src_y1 = 0;
+ _src_y2 = src->rows;
+
+ if( isolated_roi )
+ {
+ src_roi.x = 0;
+ width = src_roi.width;
+ _src_y1 = src_roi.y;
+ _src_y2 = src_roi.y + src_roi.height;
+ }
+
if( !CV_IS_MAT(dst) )
CV_ERROR( CV_StsBadArg, "" );
dst_y = dst_origin.y;
src_y1 = src_roi.y;
src_y2 = src_roi.y + src_roi.height;
- width_n = src_roi.width*pix_size;
if( phase & CV_START )
{
}
dptr = dst->data.ptr + dst_origin.y*dst->step + dst_origin.x*CV_ELEM_SIZE(dst_type);
- src_y1 -= _src_y1;
- src_y2 -= _src_y1;
-
- sptr = src->data.ptr + src_y1*src->step + src_roi.x*pix_size;
+ sptr = src->data.ptr + src_y1*src->step + src_x*pix_size;
for( src_y = src_y1; src_y < src_y2; )
{
{
CvMat* kernel = k == 0 ? _kx : _ky;
int order = k == 0 ? dx : dy;
- int n = kernel->cols + kernel->rows - 1;
- int type = CV_MAT_TYPE(kernel->type), step;
+ int n = kernel->cols + kernel->rows - 1, step;
+ int type = CV_MAT_TYPE(kernel->type);
double scale = !normalize ? 1. : 1./(1 << (n-order-1));
int iscale = 1;
for( i = 0; i < n; i++ )
{
if( type == CV_32SC1 )
- kernel->data.i[i] = kerI[i]*iscale;
+ kernel->data.i[i*step] = kerI[i]*iscale;
else if( type == CV_32FC1 )
- kernel->data.fl[i] = (float)(kerI[i]*scale);
+ kernel->data.fl[i*step] = (float)(kerI[i]*scale);
else
- kernel->data.db[i] = kerI[i]*scale;
+ kernel->data.db[i*step] = kerI[i]*scale;
}
}
{
CvMat* kernel = k == 0 ? _kx : _ky;
int order = k == 0 ? dx : dy;
- int n = kernel->cols + kernel->rows - 1;
- int type = CV_MAT_TYPE(kernel->type), step;
+ int n = kernel->cols + kernel->rows - 1, step;
+ int type = CV_MAT_TYPE(kernel->type);
double scale = !normalize ? 1. : order == 0 ? 1./16 : 1./2;
int iscale = 1;
for( i = 0; i < n; i++ )
{
if( type == CV_32SC1 )
- kernel->data.i[i] = kerI[i]*iscale;
+ kernel->data.i[i*step] = kerI[i]*iscale;
else if( type == CV_32FC1 )
- kernel->data.fl[i] = (float)(kerI[i]*scale);
+ kernel->data.fl[i*step] = (float)(kerI[i]*scale);
else
- kernel->data.db[i] = kerI[i]*scale;
+ kernel->data.db[i*step] = kerI[i]*scale;
}
}
int coi1 = 0, coi2 = 0;
CvMat srcstub, *src = (CvMat*)_src;
CvMat dststub, *dst = (CvMat*)_dst;
- CvSize size;
- int type, depth;
+ int type;
CV_CALL( src = cvGetMat( src, &srcstub, &coi1 ));
CV_CALL( dst = cvGetMat( dst, &dststub, &coi2 ));
if( !CV_ARE_TYPES_EQ( src, dst ))
CV_ERROR( CV_StsUnmatchedFormats, "" );
- size = cvGetMatSize( src );
- depth = CV_MAT_DEPTH(type);
-
if( icvFilter_8u_C1R_p && (src->rows >= ipp_lower_limit || src->cols >= ipp_lower_limit) )
{
CvFilterIPPFunc ipp_func =