/* Trajectory Analyser module */
-class CvBlobTrackAnalysisOne
+class CV_EXPORTS CvBlobTrackAnalysisOne
{
public:
+ virtual ~CvBlobTrackAnalysisOne() {};
virtual int Process(CvBlob* pBlob, IplImage* pImg, IplImage* pFG) = 0;
/* return 0 if trajectory is normal
return >0 if trajectory abnormal */
class CV_EXPORTS CvProb
{
public:
+ virtual ~CvProb() {};
/* calculate probability value */
virtual double Value(int* /*comp*/, int /*x*/ = 0, int /*y*/ = 0){return -1;};
/* update histograpp Pnew = (1-W)*Pold + W*Padd*/
else
{
hull.s = hullseq;
- hull.c->rect = cvBoundingRect( ptseq, ptseq == (CvSeq*)&contour_header );
+ hull.c->rect = cvBoundingRect( ptseq,
+ ptseq->header_size < (int)sizeof(CvContour) ||
+ &ptseq->flags == &contour_header.flags );
/*if( ptseq != (CvSeq*)&contour_header )
hullseq->v_prev = ptseq;*/
float _ranges[] = { 0, 256 };
float* ranges = _ranges;
int hist_size = 256;
+ void* srcarr0 = src;
if( CV_MAT_TYPE(src->type) != CV_8UC1 )
CV_ERROR( CV_StsNotImplemented, "Otsu method can only be used with 8uC1 images" );
CV_CALL( hist = cvCreateHist( 1, &hist_size, CV_HIST_ARRAY, &ranges ));
- cvCalcArrHist( (void**)&src, hist );
+ cvCalcArrHist( &srcarr0, hist );
thresh = cvFloor(icvGetThreshVal_Otsu( hist ));
}
CvRect rect;
CvSize bp_size;
+ union
+ {
+ void** arr;
+ IplImage** img;
+ } u;
+
if( m_comp.rect.width == 0 || m_comp.rect.height == 0 ||
m_hist == 0 )
{
}
color_transform( cur_frame );
- cvCalcBackProject( m_color_planes, m_back_project, m_hist );
+ u.img = m_color_planes;
+ cvCalcArrBackProject( u.arr, m_back_project, m_hist );
cvAnd( m_back_project, m_mask, m_back_project );
rect = m_comp.rect;
if( cvGetErrStatus() < 0 )
{
+ CvBGStatModel* base_ptr = (CvBGStatModel*)p_model;
+
if( p_model && p_model->release )
- p_model->release( (CvBGStatModel**)&p_model );
+ p_model->release( &base_ptr );
else
cvFree( &p_model );
+ p_model = 0;
}
return (CvBGStatModel*)p_model;
if( cvGetErrStatus() < 0 )
{
+ CvBGStatModel* base_ptr = (CvBGStatModel*)bg_model;
+
if( bg_model && bg_model->release )
- bg_model->release( (CvBGStatModel**)&bg_model );
+ bg_model->release( &base_ptr );
else
cvFree( &bg_model );
+ bg_model = 0;
}
return (CvBGStatModel*)bg_model;
{
if(m_pSparse)cvReleaseSparseMat(&m_pSparse);
if(m_pND)cvReleaseMatND(&m_pND);
- if(m_IDXs) cvFree((void**)&m_IDXs);
+ if(m_IDXs) cvFree(&m_IDXs);
}
void Realloc(int dim, int* sizes, int type = SPARSE)
// pF->pFVGen->Release();
m_TrackFGList.DelBlob(i-1);
}
- cvFree((void**)&m_pFVi);
- cvFree((void**)&m_pFViVar);
- cvFree((void**)&m_pFViVarRes);
- cvFree((void**)&m_Sizes);
+ cvFree(&m_pFVi);
+ cvFree(&m_pFViVar);
+ cvFree(&m_pFViVarRes);
+ cvFree(&m_Sizes);
}/* FreeData */
virtual void ParamUpdate()
{
//pF->pFVGen->Release();
}
if(m_pStatImg)cvReleaseImage(&m_pStatImg);
- cvFree((void**)&m_pFV);
+ cvFree(&m_pFV);
}/* destructor */
/*----------------- interface --------------------*/
public:
CvBlobTrackAnalysisIOR()
{
- m_AnNum = NULL;
+ m_AnNum = 0;
}
~CvBlobTrackAnalysisIOR()
{
~CvBGEstimPixHist()
{
cvReleaseImage(&bg_image);
- cvFree((void**)&m_PixHists);
+ cvFree(&m_PixHists);
}/* destructor */
}
~CvBlobTrackerOneMSPF()
{
- if(m_pParticlesResampled)cvFree((void**)&m_pParticlesResampled);
- if(m_pParticlesPredicted)cvFree((void**)&m_pParticlesPredicted);
+ if(m_pParticlesResampled)cvFree(&m_pParticlesResampled);
+ if(m_pParticlesPredicted)cvFree(&m_pParticlesPredicted);
#ifdef _OPENMP
if(m_HistForParalel) delete[] m_HistForParalel;
#endif
private:
void Realloc()
{
- if(m_pParticlesResampled)cvFree((void**)&m_pParticlesResampled);
- if(m_pParticlesPredicted)cvFree((void**)&m_pParticlesPredicted);
+ if(m_pParticlesResampled)cvFree(&m_pParticlesResampled);
+ if(m_pParticlesPredicted)cvFree(&m_pParticlesPredicted);
m_pParticlesPredicted = (DefParticle*)cvAlloc(sizeof(DefParticle)*m_ParticleNum);
m_pParticlesResampled = (DefParticle*)cvAlloc(sizeof(DefParticle)*m_ParticleNum);
};/* Realloc*/
CvBlobDetectorReal(CvTestSeq* pTestSeq)
{
m_pTestSeq = pTestSeq;
- m_pMem = cvCreateMemStorage(NULL);
+ m_pMem = cvCreateMemStorage(0);
}
/* destructor of BlobDetector*/
~CvBlobDetectorReal()
else
SET_TRANS_0(pNewTrans+i);
}
- if(p->pTrans)cvFree((void**)&p->pTrans);
+ if(p->pTrans)cvFree(&p->pTrans);
p->pTrans = pNewTrans;
p->TransNum = num;
}/* allocate new transforamtion array */
}
if(p->pImg)cvReleaseImage(&p->pImg);
if(p->pImgMask)cvReleaseImage(&p->pImgMask);
- if(p->pPos)cvFree((void**)&p->pPos);
- if(p->pTrans)cvFree((void**)&p->pTrans);
- if(p->pSize)cvFree((void**)&p->pSize);
+ if(p->pPos)cvFree(&p->pPos);
+ if(p->pTrans)cvFree(&p->pTrans);
+ if(p->pSize)cvFree(&p->pSize);
p=p->next;
- cvFree((void**)&pd);
+ cvFree(&pd);
}/* next element */
ppElemList[0] = NULL;
}/* icvTestSeqReleaseAll */
wndc.lpszClassName = "HighGUI class";
wndc.lpszMenuName = "HighGUI class";
wndc.hIcon = LoadIcon(0, IDI_APPLICATION);
- wndc.hCursor = (HCURSOR)LoadCursor(0, MAKEINTRESOURCE(IDC_CROSS));
+ wndc.hCursor = (HCURSOR)LoadCursor(0, (LPSTR)(size_t)IDC_CROSS );
wndc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
RegisterClass(&wndc);
BITMAP bmp;
GdiFlush();
HGDIOBJ h = GetCurrentObject( window->dc, OBJ_BITMAP );
+ if( size )
+ size->cx = size->cy = 0;
+ if( data )
+ *data = 0;
+
if (h == NULL)
return true;
if (GetObject(h, sizeof(bmp), &bmp) == 0)
if( (window->flags & CV_WINDOW_AUTOSIZE) && window->image )
{
int i;
- SIZE size;
+ SIZE size = {0,0};
icvGetBitmapData( window, &size, 0, 0 );
// Repeat two times because after the first resizing of the mainhWnd window
{
POINT pt;
RECT rect;
- SIZE size;
+ SIZE size = {0,0};
int flags = (wParam & MK_LBUTTON ? CV_EVENT_FLAG_LBUTTON : 0)|
(wParam & MK_RBUTTON ? CV_EVENT_FLAG_RBUTTON : 0)|
if(window->image != 0)
{
int nchannels = 3;
- SIZE size;
+ SIZE size = {0,0};
PAINTSTRUCT paint;
HDC hdc;
RGBQUAD table[256];
}
}
- cvFree((void**)&knots);
+ cvFree(&knots);
}
/* Generates <sample> from gaussian mixture distribution */
cvReleaseMat(&classes);
for( i = 0; i < clsnum; i++ )
cvReleaseMat(&utmats[i]);
- cvFree((void**)&utmats);
- cvFree((void**)&sample_clsnum);
+ cvFree(&utmats);
+ cvFree(&sample_clsnum);
cvReleaseMat(&vect);
}
dst = out_responses->data.fl;
if( r_type == CV_32FC1 )
{
- const float* src = src = responses->data.fl;
+ const float* src = responses->data.fl;
for( i = 0; i < sample_count; i++ )
{
int idx = map ? map[i] : i;
}
else
{
- const int* src = src = responses->data.i;
+ const int* src = responses->data.i;
for( i = 0; i < sample_count; i++ )
{
int idx = map ? map[i] : i;
__END__
- cvFree ((void**)&old_data);
- cvFree ((void**)&new_data);
+ cvFree(&old_data);
+ cvFree(&new_data);
}
CV_ERROR (CV_StsBadArg, "");
}
- cvFree ((void**)&pModel->sampleIdxAll);
- cvFree ((void**)&pModel->folds);
+ cvFree (&pModel->sampleIdxAll);
+ cvFree (&pModel->folds);
cvReleaseMat (&pModel->sampleIdxEval);
cvReleaseMat (&pModel->sampleIdxTrain);
cvReleaseMat (&pModel->predict_results);
- cvFree ((void**)model);
+ cvFree (model);
__END__
} // End of cvReleaseCrossValidationModel.
{
trees[0]->share_data( false );
delete trees[0];
- cvFree( (void**) &trees );
+ cvFree( &trees );
}
cvReleaseMat( &active_var_mask );
{
bool ok = false;
- CV_FUNCNAME( "CvSVM::train1" );
+ //CV_FUNCNAME( "CvSVM::train1" );
__BEGIN__;
solver = 0;
cvReleaseMemStorage( &temp_storage );
cvReleaseMat( &responses );
- cvFree( (void**)&samples );
+ cvFree( &samples );
if( cvGetErrStatus() < 0 || !ok )
clear();
void CvSVM::write_params( CvFileStorage* fs )
{
- CV_FUNCNAME( "CvSVM::write_params" );
+ //CV_FUNCNAME( "CvSVM::write_params" );
__BEGIN__;
// allocate root node and the buffer for the whole training data
max_split_size = cvAlign(sizeof(CvDTreeSplit) +
(MAX(0,sample_count - 33)/32)*sizeof(int),sizeof(void*));
- tree_block_size = MAX(sizeof(CvDTreeNode)*8, max_split_size);
+ tree_block_size = MAX((int)sizeof(CvDTreeNode)*8, max_split_size);
tree_block_size = MAX(tree_block_size + block_size_delta, min_block_size);
CV_CALL( tree_storage = cvCreateMemStorage( tree_block_size ));
CV_CALL( node_heap = cvCreateSet( 0, sizeof(*node_heap), sizeof(CvDTreeNode), tree_storage ));
data = new CvDTreeTrainData;
- data->is_classifier = is_classifier = cvReadIntByName( fs, node, "is_classifier" ) != 0;
+ is_classifier = (cvReadIntByName( fs, node, "is_classifier" ) != 0);
+ data->is_classifier = is_classifier;
data->var_all = cvReadIntByName( fs, node, "var_all" );
data->var_count = cvReadIntByName( fs, node, "var_count", data->var_all );
data->cat_var_count = cvReadIntByName( fs, node, "cat_var_count" );
max_split_size = cvAlign(sizeof(CvDTreeSplit) +
(MAX(0,data->max_c_count - 33)/32)*sizeof(int),sizeof(void*));
- tree_block_size = MAX(sizeof(CvDTreeNode)*8, max_split_size);
+ tree_block_size = MAX((int)sizeof(CvDTreeNode)*8, max_split_size);
tree_block_size = MAX(tree_block_size + block_size_delta, min_block_size);
CV_CALL( data->tree_storage = cvCreateMemStorage( tree_block_size ));
CV_CALL( data->node_heap = cvCreateSet( 0, sizeof(data->node_heap[0]),
/* Testing parameters */
static char test_desc[] = "Canny Edge Detector";
-static char TestClass[] = "Algorithm";
static int lImageWidth;
static int lImageHeight;
static int Sobord;
static int SamplesNum;
static int read_param = 0;
-static int data_types = 0;
static double EPSILON = 1.000;
static void CondProbDens(CvConDensation* CD, float* Measurement)
}
}
- cvFree( (void**)&objs );
- cvFree( (void**)&eigObjs );
- cvFree( (void**)&eigObjs0 );
- cvFree( (void**)&coeffs );
- cvFree( (void**)&coeffs0 );
- cvFree( (void**)&eigVal );
- cvFree( (void**)&eigVal0 );
- cvFree( (void**)&Objs );
- cvFree( (void**)&EigObjs );
- cvFree( (void**)&EigObjs0 );
- cvFree( (void**)&covMatr );
- cvFree( (void**)&covMatr0 );
+ cvFree( &objs );
+ cvFree( &eigObjs );
+ cvFree( &eigObjs0 );
+ cvFree( &coeffs );
+ cvFree( &coeffs0 );
+ cvFree( &eigVal );
+ cvFree( &eigVal0 );
+ cvFree( &Objs );
+ cvFree( &EigObjs );
+ cvFree( &EigObjs0 );
+ cvFree( &covMatr );
+ cvFree( &covMatr0 );
trsWrite(TW_RUN|TW_CON, "\n Errors number: %d\n", err );
r = _cvCalcCovarMatrix_8u32fR_q ( nObjects, objects, objStep,
avg, 4*avgStep, size, c );
- if(r) { cvFree((void**)&c ); return r; }
+ if(r) { cvFree( &c ); return r; }
/* Calculation of eigenvalues & eigenvectors */
ev = (float*)cvAlloc ( sizeof(float)*nObjects*nObjects );
- if(ev==NULL) { cvFree((void**)&c ); return CV_OUTOFMEM_ERR; }
+ if(ev==NULL) { cvFree( &c ); return CV_OUTOFMEM_ERR; }
_cvJacobiEigens_32f( c, ev, eigVals, nObjects, 0.0f );
- cvFree((void**)&c );
+ cvFree( &c );
for(i=0; i<*nEigObjs; i++) if( fabs(eigVals[i]/eigVals[0]) < *eps ) break;
*nEigObjs = i;
}
}
- cvFree((void**)&ev );
+ cvFree( &ev );
return CV_NO_ERR;
} /* --- End of _cvCalcEigenObjects_8u32fR --- */
/*______________________________________________________________________________________*/
return mi->matr[i*mi->cols + j];
}
-static int emd_test( void* arg )
+static int emd_test( void* )
{
const double success_error_level = 1e-6;
#define M 10000
w2[] = { 30, 20, 70, 30, 60 };
matr_info mi;
float emd;
- arg;
mi.x_origin = w1;
mi.y_origin = w2;
{
cvReleaseImage( &src8u[i] );
cvReleaseImage( &src32f[i] );
- cvFree( (void**)&thresh[i] );
- cvFree( (void**)&threshe[i] );
+ cvFree( &thresh[i] );
+ cvFree( &threshe[i] );
}
cvReleaseHist( &hist1 );
cvReleaseHist( &hist2 );
{
cvReleaseImage( &src8u[i] );
cvReleaseImage( &src32f[i] );
- cvFree( (void**)&thresh[i] );
- cvFree( (void**)&threshe[i] );
+ cvFree( &thresh[i] );
+ cvFree( &threshe[i] );
}
cvReleaseHist( &hist1 );
cvReleaseHist( &hist2 );
{
cvReleaseImage( &src8u[i] );
cvReleaseImage( &src32f[i] );
- cvFree( (void**)&thresh[i] );
- cvFree( (void**)&threshe[i] );
+ cvFree( &thresh[i] );
+ cvFree( &threshe[i] );
}
cvReleaseHist( &hist1 );
cvReleaseHist( &hist2 );
{
cvReleaseImage( &src8u[i] );
cvReleaseImage( &src32f[i] );
- cvFree( (void**)&thresh[i] );
- cvFree( (void**)&threshe[i] );
+ cvFree( &thresh[i] );
+ cvFree( &threshe[i] );
}
cvReleaseImage( &dst8u );
{
cvReleaseImage( &src8u[i] );
cvReleaseImage( &src32f[i] );
- cvFree( (void**)&thresh[i] );
- cvFree( (void**)&threshe[i] );
+ cvFree( &thresh[i] );
+ cvFree( &threshe[i] );
}
cvReleaseImage( &dst8u );
cvReleaseHist(&model);
for(i = 0; i < c_dims; i++)
{
- cvFree((void**)&_test8u[i]);
- cvFree((void**)&_test32f[i]);
+ cvFree( &_test8u[i]);
+ cvFree( &_test32f[i]);
cvReleaseImageHeader( img8u + i );
cvReleaseImageHeader( img32f + i );
}
- cvFree( (void**)&img8u );
- cvFree( (void**)&img32f );
+ cvFree( &img8u );
+ cvFree( &img32f );
return TRS_OK;
}
{
cvReleaseImage( &src8u[i] );
cvReleaseImage( &src32f[i] );
- cvFree( (void**)&thresh[i] );
+ cvFree( &thresh[i] );
}
cvReleaseImage( &_dst8u );
static int c_dimss;
static int dims;
static int init = 0;
- static int width;
- static int height;
- static int range_width;
- static int range_height;
static double acc;
int c_dims;
/* Testing parameters */
static char test_desc[] = "Image Creation & access";
-static char TestClass[] = "Algorithm";
static char func_name[] = "cvCreateImage cvCreateImageHeader cvSetImageROI cvGetImageROI "
"cvSetImageCOI cvCreateImageData cvReleaseImageData "
"cvSetImageData cvCloneImage cvCopyImage cvInitImageHeader";
{
if( depths[i] == IPL_DEPTH_1U && channels[j] != 1 ) // skip for IPL_DEPTH_1U
continue; // all non 1 channels
- if( depths[i] == IPL_DEPTH_8S )
+ if( depths[i] == (int)IPL_DEPTH_8S )
continue;
IplImage* image = cvCreateImageHeader( size, depths[i], channels[j] );
if( image->width != size.width || image->height != size.height )
{
if( depths[i] == IPL_DEPTH_1U && channels[j] != 1 ) // skip for IPL_DEPTH_1U
continue; // all non 1 channels
- if( depths[i] == IPL_DEPTH_8S )
+ if( depths[i] == (int)IPL_DEPTH_8S )
continue;
IplImage* src = cvCreateImage( size, depths[i], channels[j] );
//IplImage* dst = cvCreateImage( size, depths[i], channels[j] );
static int Steps;
static int read_param = 0;
-static int data_types = 0;
static double EPSILON = 1.000;
static int fcaKalman( void )
/* Testing parameters */
static char test_desc[] = "KMeans clustering";
-static char TestClass[] = "Algorithm";
static char* func_name[] =
{
"cvKMeans"
};
-static int data_type = 0;
-
//based on Ara Nefian's implementation
float distance(float* vector_1, float *vector_2, int VecSize)
{
//free memory
for( i = 0; i < lNumVect; i++ )
{
- cvFree( (void**)&(vectors[i]) );
+ cvFree( &(vectors[i]) );
}
- cvFree((void**)&vectors);
- cvFree((void**)&output);
- cvFree((void**)&etalon_output);
+ cvFree(&vectors);
+ cvFree(&output);
+ cvFree(&etalon_output);
if( lErrors == 0 ) return trsResult( TRS_OK, "No errors fixed for this text" );
else return trsResult( TRS_FAIL, "Detected %d errors", lErrors );
region->rect.width = XMax - XMin + 1;
region->rect.height = YMax - YMin + 1;
region->value = cvScalar(nv);
- cvFree((void**)&CurStack);
- cvFree((void**)&NextStack);
+ cvFree(&CurStack);
+ cvFree(&NextStack);
return;
}
static char TestClass[] = "Algorithm";
static int lImageWidth;
static int lImageHeight;
-static int Sobord;
static int read_param = 0;
static int data_types = 0;
static long lImageWidth;
static long lImageHeight;
-static long lNumIterations;
-static float flEpsilon;
static float lambda;
#define EPSILON 0.0001f
}
/* Free memory */
- cvFree( (void**)&VelocityX );
- cvFree( (void**)&VelocityY );
- cvFree( (void**)&auxVelocityX );
- cvFree( (void**)&auxVelocityY );
+ cvFree( &VelocityX );
+ cvFree( &VelocityY );
+ cvFree( &auxVelocityX );
+ cvFree( &auxVelocityY );
- cvFree( (void**)&DerX );
- cvFree( (void**)&DerY );
- cvFree( (void**)&DerT );
+ cvFree( &DerX );
+ cvFree( &DerY );
+ cvFree( &DerT );
cvReleaseImage( &imgA );
cvReleaseImage( &imgB );
}
}
}
- cvFree( (void**)&VelocityX );
- cvFree( (void**)&VelocityY );
+ cvFree( &VelocityX );
+ cvFree( &VelocityY );
- cvFree( (void**)&DerivativeX );
- cvFree( (void**)&DerivativeY );
- cvFree( (void**)&DerivativeT );
+ cvFree( &DerivativeX );
+ cvFree( &DerivativeY );
+ cvFree( &DerivativeT );
cvReleaseImage( &imgA );
cvReleaseImage( &imgB );
test_exit:
/* release occupied memory */
- cvFree( (void**)&status );
- cvFree( (void**)&v2 );
+ cvFree( &status );
+ cvFree( &v2 );
free( u );
free( v );
if( imgI ) atsReleaseImage( imgI );
static char TestClass[] = "Algorithm";
static float flFocalLength;
-static long lMaxIter;
static float flEpsilon;
typedef float* Vect32f;
translation.data.fl[2] );
}
- cvFree( (void**)&obj_points );
- cvFree( (void**)&img_points );
+ cvFree( &obj_points );
+ cvFree( &img_points );
cvmFree( &true_rotationX );
cvmFree( &true_rotationY );
static int aPyrSegmentation(void* agr)
{
- CvPoint _cp[] ={33,33, 43,33, 43,43, 33,43};
- CvPoint _cp2[] ={50,50, 70,50, 70,70, 50,70};
+ CvPoint _cp[] ={{33,33}, {43,33}, {43,43}, {33,43}};
+ CvPoint _cp2[] ={{50,50}, {70,50}, {70,70}, {50,70}};
CvPoint* cp = _cp;
CvPoint* cp2 = _cp2;
CvConnectedComp *dst_comp[3];
- CvRect rect[3] = {50,50,21,21, 0,0,128,128, 33,33,11,11};
+ CvRect rect[3] = {{50,50,21,21}, {0,0,128,128}, {33,33,11,11}};
double a[3] = {441.0, 15822.0, 121.0};
/* ippiPoint cp3[] ={130,130, 150,130, 150,150, 130,150}; */
// Test is considered to be succesfull if resultant positions
// are identical.
*/
-static char TestClass[] = "Algorithm";
-static int lImageWidth;
-static int lImageHeight;
static char* func_name[] =
{
"cvSnakeImage"
// at once, delete the headers, though is not very good from structural point of view ...
for( i = 0; i < 4; i++ )
- cvReleaseMat( (CvMat**)&hdrs[i] );
+ cvRelease( &hdrs[i] );
CxCore_MemTest::print_timing_params( test_case_idx, ptr, params_left );
}
cvTsExtract( input, h, i );
else
cvTsInsert( h, output, i );
- if( are_images )
- cvReleaseImageHeader( (IplImage**)&hdrs[i] );
- else
- cvReleaseMat( (CvMat**)&hdrs[i] );
+ cvSetData( hdrs[i], 0, 0 );
+ cvRelease( &hdrs[i] );
y += sz.height;
}
}
static void cvTsReleaseSimpleSeq( CvTsSimpleSeq** seq )
{
- cvFree( (void**)seq );
+ cvFree( seq );
}
static void cvTsReleaseSimpleSet( CvTsSimpleSet** set_header )
{
- cvFree( (void**)set_header );
+ cvFree( set_header );
}
if( *graph )
{
cvTsReleaseSimpleSet( &(graph[0]->vtx) );
- cvFree( (void**)graph );
+ cvFree( graph );
}
}
void CxCore_DynStructBaseTest::clear()
{
cvReleaseMemStorage( &storage );
- cvFree( (void**)&cxcore_struct );
- cvFree( (void**)&simple_struct );
+ cvFree( &cxcore_struct );
+ cvFree( &simple_struct );
}
t_flag ^ ((flags & CV_COVAR_NORMAL) != 0) ?
CV_GEMM_A_T : CV_GEMM_B_T );
- cvFree( (void**)&hdr_data );
+ cvFree( &hdr_data );
temp_hdrs.clear();
}
#include <eh.h>
#endif
+#ifdef _MSC_VER
static void cv_seh_translator( unsigned int /*u*/, EXCEPTION_POINTERS* pExp )
{
int code = CvTS::FAIL_EXCEPTION;
}
throw code;
}
-
+#endif
#define CV_TS_TRY_BLOCK_BEGIN \
try {
void cvTsConvert( const CvMat* a, CvMat* b )
{
- int i, j, ncols = ncols = b->cols*CV_MAT_CN(b->type);
+ int i, j, ncols = b->cols*CV_MAT_CN(b->type);
double* buf = 0;
assert( CV_ARE_SIZES_EQ(a,b) && CV_ARE_CNS_EQ(a,b) );
int i = 0, j = 0, k;
int cn, ncols, elem_size;
uchar* b_data;
- double buf[4];
+ union
+ {
+ uchar ptr[4];
+ char c[4];
+ short s[4];
+ ushort w[4];
+ int i[4];
+ float f[4];
+ double d[4];
+ } buf;
cn = CV_MAT_CN(a->type);
elem_size = CV_ELEM_SIZE(a->type);
ncols = a->cols * elem_size;
for( k = 0; k < cn; k++ )
{
int val = cvRound(s.val[k]);
- ((uchar*)buf)[k] = CV_CAST_8U(val);
+ buf.ptr[k] = CV_CAST_8U(val);
}
break;
case CV_8S:
for( k = 0; k < cn; k++ )
{
int val = cvRound(s.val[k]);
- ((char*)buf)[k] = CV_CAST_8S(val);
+ buf.c[k] = CV_CAST_8S(val);
}
break;
case CV_16U:
for( k = 0; k < cn; k++ )
{
int val = cvRound(s.val[k]);
- ((ushort*)buf)[k] = CV_CAST_16U(val);
+ buf.w[k] = CV_CAST_16U(val);
}
break;
case CV_16S:
for( k = 0; k < cn; k++ )
{
int val = cvRound(s.val[k]);
- ((short*)buf)[k] = CV_CAST_16S(val);
+ buf.s[k] = CV_CAST_16S(val);
}
break;
case CV_32S:
for( k = 0; k < cn; k++ )
{
int val = cvRound(s.val[k]);
- ((int*)buf)[k] = CV_CAST_32S(val);
+ buf.i[k] = CV_CAST_32S(val);
}
break;
case CV_32F:
for( k = 0; k < cn; k++ )
{
double val = s.val[k];
- ((float*)buf)[k] = CV_CAST_32F(val);
+ buf.f[k] = CV_CAST_32F(val);
}
break;
case CV_64F:
for( k = 0; k < cn; k++ )
{
double val = s.val[k];
- ((double*)buf)[k] = CV_CAST_64F(val);
+ buf.d[k] = CV_CAST_64F(val);
}
break;
default:
}
for( j = 0; j < ncols; j += elem_size )
- memcpy( b_data + j, buf, elem_size );
+ memcpy( b_data + j, buf.ptr, elem_size );
}
for( i = 0; i < a->rows; i++ )