tcmpt->numstepsizes = tcmpt->numbands;
assert(tcmpt->numstepsizes <= JPC_MAXBANDS);
- memset(tcmpt->stepsizes, 0, sizeof(tcmpt->numstepsizes *
- sizeof(uint_fast16_t)));
+ memset(tcmpt->stepsizes, 0, tcmpt->numstepsizes *
+ sizeof(uint_fast16_t));
/* Retrieve information about the various bands. */
jpc_tsfb_getbands(tcmpt->tsfb, jas_seq2d_xstart(tcmpt->data),
::computeNormals(octree, vtx, normals, mask, normalRadius, minNeighbors);
}
-void cv::Mesh3D::writeAsVrml(const String& file, const vector<Scalar>& colors) const
+void cv::Mesh3D::writeAsVrml(const String& file, const vector<Scalar>& _colors) const
{
ofstream ofs(file.c_str());
ofs << "]" << endl; //point[
ofs << "}" << endl; //Coordinate{
- if (vtx.size() == colors.size())
+ if (vtx.size() == _colors.size())
{
ofs << "color Color" << endl << "{" << endl;
ofs << "color[" << endl;
- for(size_t i = 0; i < colors.size(); ++i)
- ofs << (float)colors[i][2] << " " << (float)colors[i][1] << " " << (float)colors[i][0] << endl;
+ for(size_t i = 0; i < _colors.size(); ++i)
+ ofs << (float)_colors[i][2] << " " << (float)_colors[i][1] << " " << (float)_colors[i][0] << endl;
ofs << "]" << endl; //color[
ofs << "}" << endl; //color Color{
break;
std::transform(left.begin(), left.end(), buf_beg, WgcHelper(group, groupingMat));
- size_t minInd = min_element(buf_beg, buf_beg + left_size) - buf_beg;
+ int minInd = min_element(buf_beg, buf_beg + left_size) - buf_beg;
if (buf[minInd] < model.T_GroupingCorespondances) /* can add corespondance to group */
{
uchar* tmp_buf = 0;
int dptr_offset = 0;
int dst_full_len = len*elem_size;
- int _flags = inv + (src.channels() != dst.channels() ?
+ int _flags = (int)inv + (src.channels() != dst.channels() ?
DFT_COMPLEX_INPUT_OR_OUTPUT : 0);
if( use_buf )
{
_dst.create( src.rows, src.cols, type );
Mat dst = _dst.getMat();
- DCTFunc dct_func = dct_tbl[inv + (depth == CV_64F)*2];
+ DCTFunc dct_func = dct_tbl[(int)inv + (depth == CV_64F)*2];
if( (flags & DFT_ROWS) || src.rows == 1 ||
(src.cols == 1 && (src.isContinuous() && dst.isContinuous())))
typedef typename Distance::ResultType DistanceType;
int n = nn + skip;
- int* match = new int[n];
- DistanceType* dists = new DistanceType[n];
+ std::vector<int> match(n);
+ std::vector<DistanceType> dists(n);
dists[0] = distance(dataset[0], query, dataset.cols);
match[0] = 0;
for (int i=0; i<nn; ++i) {
matches[i] = match[i+skip];
}
-
- delete[] match;
- delete[] dists;
}
KNNResultSet<DistanceType> resultSet(nn+skipMatches);
SearchParams searchParams(checks);
- int* indices = new int[nn+skipMatches];
- DistanceType* dists = new DistanceType[nn+skipMatches];
- int* neighbors = indices + skipMatches;
+ std::vector<int> indices(nn+skipMatches);
+ std::vector<DistanceType> dists(nn+skipMatches);
+ int* neighbors = &indices[skipMatches];
int correct = 0;
DistanceType distR = 0;
correct = 0;
distR = 0;
for (size_t i = 0; i < testData.rows; i++) {
- resultSet.init(indices, dists);
+ resultSet.init(&indices[0], &dists[0]);
index.findNeighbors(resultSet, testData[i], searchParams);
correct += countCorrectMatches(neighbors,matches[i], nn);
}
time = float(t.value/repeats);
- delete[] indices;
- delete[] dists;
-
float precicion = (float)correct/(nn*testData.rows);
dist = distR/(testData.rows*nn);
}
delete[] centers_idx;
- DistanceType* radiuses = new DistanceType[branching];
+ std::vector<DistanceType> radiuses(branching);
int* count = new int[branching];
for (int i=0; i<branching; ++i) {
radiuses[i] = 0;
delete[] dcenters.data;
delete[] centers;
- delete[] radiuses;
delete[] count;
delete[] belongs_to;
}
------------------
Displays a text on a window image as an overlay for a specified duration.
-.. ocv:function:: void displayOverlay(const string& name, const string& text, int delayms CV_DEFAULT(0))
+.. ocv:function:: void displayOverlay(const string& name, const string& text, int delayms = 0)
-.. ocv:cfunction:: void cvDisplayOverlay(const char* name, const char* text, int delayms CV_DEFAULT(0))
+.. ocv:cfunction:: void cvDisplayOverlay(const char* name, const char* text, int delayms = 0)
:param name: Name of the window.
:param text: Overlay text to write on a window image.
- :param delayms: The period (in milliseconds), during which the overlay text is displayed. If this function is called before the previous overlay text timed out, the timer is restarted and the text is updated. If this value is zero, the text never disappears. Optional - default 0.
+ :param delayms: The period (in milliseconds), during which the overlay text is displayed. If this function is called before the previous overlay text timed out, the timer is restarted and the text is updated. If this value is zero, the text never disappears.
The function ``displayOverlay`` displays useful information/tips on top of the window for a certain amount of time *delayms*. The function does not modify the image, displayed in the window, that is, after the specified delay the original content of the window is restored.
--------------------
Displays a text on the window statusbar during the specified period of time.
-.. ocv:function:: void displayStatusBar(const string& name, const string& text, int delayms CV_DEFAULT(0))
+.. ocv:function:: void displayStatusBar(const string& name, const string& text, int delayms = 0)
-.. ocv:cfunction:: void cvDisplayStatusBar(const char* name, const char* text, int delayms CV_DEFAULT(0))
+.. ocv:cfunction:: void cvDisplayStatusBar(const char* name, const char* text, int delayms = 0)
:param name: Name of the window.
:param text: Text to write on the window statusbar.
- :param delayms: Duration (in milliseconds) to display the text. If this function is called before the previous text timed out, the timer is restarted and the text is updated. If this value is zero, the text never disappears. Optional - default 0.
+ :param delayms: Duration (in milliseconds) to display the text. If this function is called before the previous text timed out, the timer is restarted and the text is updated. If this value is zero, the text never disappears.
The function ``displayOverlay`` displays useful information/tips on top of the window for a certain amount of time
*delayms*
bool is2d = points.checkVector(2) >= 0;
CV_Assert( (is2d || is3d) && (points.depth() == CV_32F || points.depth() == CV_32S) );
- CvMat _cpoints = points.reshape(2 + is3d);
+ CvMat _cpoints = points.reshape(2 + (int)is3d);
float line[6];
cvFitLine(&_cpoints, distType, param, reps, aeps, &line[0]);
{
const int cn = 3;
const int MAX_LEVELS = 8;
- cv::Mat* src_pyramid = new cv::Mat[MAX_LEVELS+1];
- cv::Mat* dst_pyramid = new cv::Mat[MAX_LEVELS+1];
+
+ if( (unsigned)max_level > (unsigned)MAX_LEVELS )
+ CV_Error( CV_StsOutOfRange, "The number of pyramid levels is too large or negative" );
+
+ std::vector<cv::Mat> src_pyramid(max_level+1);
+ std::vector<cv::Mat> dst_pyramid(max_level+1);
cv::Mat mask0;
int i, j, level;
//uchar* submask = 0;
if( src0.size() != dst0.size() )
CV_Error( CV_StsUnmatchedSizes, "The input and output images must have the same size" );
- if( (unsigned)max_level > (unsigned)MAX_LEVELS )
- CV_Error( CV_StsOutOfRange, "The number of pyramid levels is too large or negative" );
-
if( !(termcrit.type & CV_TERMCRIT_ITER) )
termcrit.max_iter = 5;
termcrit.max_iter = MAX(termcrit.max_iter,1);
}
}
}
- delete[] src_pyramid;
- delete[] dst_pyramid;
}
void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
virtual void SetFileName(char* DataBaseName)
{
if(m_HistMat.m_Volume!=m_HistVolumeSaved)SaveHist();
- m_DataFileName[0] = 0;
+ m_DataFileName[0] = m_DataFileName[1000] = 0;
if(DataBaseName)
{
virtual void SetFileName(char* DataBaseName)
{
if(m_pTrainData)SaveStatModel();
- m_DataFileName[0] = 0;
+ m_DataFileName[0] = m_DataFileName[1000] = 0;
if(DataBaseName)
{
strncpy(m_DataFileName,DataBaseName,1000);
virtual void SetFileName(char* DataBaseName)
{
- m_DataFileName[0] = 0;
+ m_DataFileName[0] = m_DataFileName[1000] = 0;
if(DataBaseName)
{
strncpy(m_DataFileName,DataBaseName,1000);
void FaceDetection::FindCandidats()
{
bool bFound1 = false;
- MouthFaceTemplate * lpFaceTemplate1;
- RFace * lpFace1;
+ MouthFaceTemplate * lpFaceTemplate1 = 0;
+ RFace * lpFace1 = 0;
bool bInvalidRect1 = false;
CvRect * lpRect1 = NULL;
- for (int i = 0; i < m_seqRects->total; i++)
+ try
{
- CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, i);
- CvRect rect = pRect->r;
- if (rect.width >= 2*rect.height)
+ for (int i = 0; i < m_seqRects->total; i++)
{
+ CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, i);
+ CvRect rect = pRect->r;
+ if (rect.width >= 2*rect.height)
+ {
- lpFaceTemplate1 = new MouthFaceTemplate(3,rect,3*(double)rect.width/(double)4,
- 3*(double)rect.width/(double)4,
- (double)rect.width/(double)2,
- (double)rect.width/(double)2);
+ lpFaceTemplate1 = new MouthFaceTemplate(3,rect,3*(double)rect.width/(double)4,
+ 3*(double)rect.width/(double)4,
+ (double)rect.width/(double)2,
+ (double)rect.width/(double)2);
- lpFace1 = new RFace(lpFaceTemplate1);
+ lpFace1 = new RFace(lpFaceTemplate1);
- for (int j = 0; j < m_seqRects->total; j++)
- {
- CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, j);
-
- if ( !bInvalidRect1 )
+ for (int j = 0; j < m_seqRects->total; j++)
{
- lpRect1 = NULL;
- lpRect1 = new CvRect();
- *lpRect1 = pRect->r;
- }else
- {
- delete lpRect1;
- lpRect1 = new CvRect();
- *lpRect1 = pRect->r;
- }
+ CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, j);
+ if ( !bInvalidRect1 )
+ {
+ lpRect1 = NULL;
+ lpRect1 = new CvRect();
+ *lpRect1 = pRect->r;
+ }else
+ {
+ delete lpRect1;
+ lpRect1 = new CvRect();
+ *lpRect1 = pRect->r;
+ }
- if ( lpFace1->isFeature(lpRect1) )
- {
- bFound1 = true;
- bInvalidRect1 = false;
- }else
- bInvalidRect1 = true;
+
+ if ( lpFace1->isFeature(lpRect1) )
+ {
+ bFound1 = true;
+ bInvalidRect1 = false;
+ }else
+ bInvalidRect1 = true;
- }
+ }
- if (bFound1)
- {
- m_pFaceList->AddElem(lpFace1);
- bFound1 = false;
- lpFace1 = NULL;
- }else
- {
- delete lpFace1;
- lpFace1 = NULL;
- }
+ if (bFound1)
+ {
+ m_pFaceList->AddElem(lpFace1);
+ bFound1 = false;
+ lpFace1 = NULL;
+ }else
+ {
+ delete lpFace1;
+ lpFace1 = NULL;
+ }
- delete lpFaceTemplate1;
- }
+ delete lpFaceTemplate1;
+ }
+ }
+ }
+ catch(...)
+ {
+ delete lpFaceTemplate1;
+ delete lpFace1;
+ throw;
}
-
}
void FaceDetection::PostBoostingFindCandidats(IplImage * FaceImage)
{
- BoostingFaceTemplate * lpFaceTemplate1;
- RFace * lpFace1;
+ BoostingFaceTemplate * lpFaceTemplate1 = 0;
+ RFace * lpFace1 = 0;
bool bInvalidRect1 = false;
CvRect * lpRect1 = NULL;
- if ( ( !FaceImage->roi ) )
- lpFaceTemplate1 = new BoostingFaceTemplate(3,cvRect(0,0,FaceImage->width,FaceImage->height));
- else
- lpFaceTemplate1 = new BoostingFaceTemplate(3,cvRect(FaceImage->roi->xOffset,FaceImage->roi->yOffset,
- FaceImage->roi->width,FaceImage->roi->height));
+ try
+ {
+ if ( ( !FaceImage->roi ) )
+ lpFaceTemplate1 = new BoostingFaceTemplate(3,cvRect(0,0,FaceImage->width,FaceImage->height));
+ else
+ lpFaceTemplate1 = new BoostingFaceTemplate(3,cvRect(FaceImage->roi->xOffset,FaceImage->roi->yOffset,
+ FaceImage->roi->width,FaceImage->roi->height));
- lpFace1 = new RFace(lpFaceTemplate1);
+ lpFace1 = new RFace(lpFaceTemplate1);
- for (int i = 0; i < m_seqRects->total; i++)
- {
- CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, i);
-
- if ( !bInvalidRect1 )
- {
- lpRect1 = NULL;
- lpRect1 = new CvRect();
- *lpRect1 = pRect->r;
- }else
+ for (int i = 0; i < m_seqRects->total; i++)
{
- delete lpRect1;
- lpRect1 = new CvRect();
- *lpRect1 = pRect->r;
- }
+ CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, i);
+
+ if ( !bInvalidRect1 )
+ {
+ lpRect1 = NULL;
+ lpRect1 = new CvRect();
+ *lpRect1 = pRect->r;
+ }else
+ {
+ delete lpRect1;
+ lpRect1 = new CvRect();
+ *lpRect1 = pRect->r;
+ }
- if ( lpFace1->isFeature(lpRect1) )
- {
- //bFound1 = true;
- bInvalidRect1 = false;
- }else
- bInvalidRect1 = true;
+ if ( lpFace1->isFeature(lpRect1) )
+ {
+ //bFound1 = true;
+ bInvalidRect1 = false;
+ }else
+ bInvalidRect1 = true;
- }
+ }
- m_pFaceList->AddElem(lpFace1);
+ m_pFaceList->AddElem(lpFace1);
+ lpFace1 = NULL;
- delete lpFaceTemplate1;
-
+ delete lpFaceTemplate1;
+ }
+ catch(...)
+ {
+ delete lpFace1;
+ delete lpFaceTemplate1;
+ throw;
+ }
}//void FaceDetection::PostBoostingFindCandidats(IplImage * FaceImage)
/////////////////////////
CvSet *NewSiteSeq = NULL,*CurrNewSiteSeq = NULL, *PrevNewSiteSeq = NULL;;
CvSeqWriter SiteWriter;
- CvVoronoiSite2D NewSite = {{0,0},{0,0},{0,0}},NewSite_prev;
+ CvVoronoiSite2D NewSite = {{0,0},{0,0},{0,0}},NewSite_prev = {{0,0},{0,0},{0,0}};
CvVoronoiSite2D *pNewSite, *pNewSite_prev = &NewSite_prev;
pCvVoronoiSite pSite,pFirstSite;
CvSet *NewSiteSeq = NULL,*CurrNewSiteSeq = NULL, *PrevNewSiteSeq = NULL;;
CvSeqWriter SiteWriter;
- CvVoronoiSite2D NewSite = {{0,0},{0,0},{0,0}},NewSite_prev;
+ CvVoronoiSite2D NewSite = {{0,0},{0,0},{0,0}},NewSite_prev = {{0,0},{0,0},{0,0}};
CvVoronoiSite2D *pNewSite, *pNewSite_prev = &NewSite_prev;
pCvVoronoiSite pSite,pFirstSite;
if (type != CV_32FC1 && type != CV_64FC1)
CV_Error(CV_StsUnsupportedFormat, "vectors must be either CV_32FC1 or CV_64FC1");
lsh = new CvLSH;
- lsh->type = type;
- switch (type) {
- case CV_32FC1: lsh->u.lsh_32f = new lsh_pstable_l2_32f(ops, d, L, k, r, rng); break;
- case CV_64FC1: lsh->u.lsh_64f = new lsh_pstable_l2_64f(ops, d, L, k, r, rng); break;
+ try
+ {
+ lsh->type = type;
+ switch (type) {
+ case CV_32FC1: lsh->u.lsh_32f = new lsh_pstable_l2_32f(ops, d, L, k, r, rng); break;
+ case CV_64FC1: lsh->u.lsh_64f = new lsh_pstable_l2_64f(ops, d, L, k, r, rng); break;
+ }
+ }
+ catch(...)
+ {
+ delete lsh;
+ throw;
}
return lsh;
char str[1000];
sprintf(str, "<cvsubdiv2dedge(");
char *d = str + strlen(str);
- sprintf(d, "%zx.%d", m & ~3, (int)(m & 3));
+ sprintf(d, "%lux.%d", (unsigned long)(m & ~3), (int)(m & 3));
d += strlen(d);
sprintf(d, ")>");
return PyString_FromString(str);