Пример #1
0
void Complex::add(int num)                                      //           добавление объекта Complex
{
    if (counter+1==arrSize)                                     // проверка на необходимость увеличения
        reSize();                                               //                              массива
    arrPtr[num] = new Complex();
    return;
}
Пример #2
0
void DVector::reDim(int newdim)
{
   assert(memsize >= 0);

   if ( newdim > memsize )
      reSize(int(newdim + 0.2 * memsize));
   // Seems lint is wrong here. Replace with memset anyway.
   for (int i = dimen; i < newdim; i++)
      mem[i] = 0;
   dimen = newdim;
}
bool SurfFaceDetection::CalculateSurfSumImg(const Mat &_grayImg)
{
	CV_Assert(_grayImg.type() == CV_8U && !_grayImg.empty());
	imgOrg = _grayImg;
	Mat img;
	if(_grayImg.size().width > maxImgSize.width || _grayImg.size().height > maxImgSize.height)
	{
		double scale = cv::min( (double)maxImgSize.height / _grayImg.size().height, (double)maxImgSize.width / _grayImg.size().width);
		srcScale = scale;
		Size reSize((int)(_grayImg.size().width * scale + 0.5), (int)(_grayImg.size().height * scale + 0.5));
		resize(_grayImg, img, reSize);
	}else
	{
		img = _grayImg;
		srcScale = 1.0;
	}

	imgSize = img.size();

	cv::Mat rowImg(img.size(), CV_16SC1);
	cv::Mat colImg(img.size(), CV_16SC1);

	rowFilter->apply(img, rowImg);
	colFilter->apply(img, colImg);

	std::vector<cv::Mat> splitImg(8);

	cv::Mat mergeImg(img.size(), CV_32SC(8));
	//Mat sumImg(img.size() + Size(1,1), CV_64FC(8), sumCache.ptr(0,0));
	Mat sumImg(sumCache,Rect(0,0,imgSize.width+1, imgSize.height+1));

	cv::Mat dyM = cv::Mat_<short>((colImg < 0) / 255);
	cv::Mat dxM = cv::Mat_<short>((rowImg < 0) / 255);

	splitImg[0] = rowImg.mul(dyM);    //dx when dy<0
	splitImg[1] = rowImg.mul(1 - dyM); //dx when dy>=0
	splitImg[2] = cv::abs(rowImg).mul(dyM); //abs(dx) when dy<0
	splitImg[3] = cv::abs(rowImg).mul(1-dyM); //abs(dx) when dy>=0

	splitImg[4] = colImg.mul(dxM);   //dy when dx<0
	splitImg[5] = colImg.mul(1 - dxM); //dy when dx>=0
	splitImg[6] = cv::abs(colImg).mul(dxM); //abs(dy) when dx<0
	splitImg[7] = cv::abs(colImg).mul(1 - dxM); //abs(dy) when dx>=0

	cv::merge(splitImg, mergeImg);
	mergeImg = cv::Mat_<cv::Vec<float,8>>(mergeImg);

	
	cv::integral(mergeImg, sumImg);
	
	return true;
}
Пример #4
0
void DVector_exact::reDim(int newdim)
{
   assert(memsize >= 0);

   if( newdim > memsize )
   {
      reSize(int(newdim + 0.2 * memsize));
   }

   for( int i = dimen; i < newdim; i++ )
      mem[i] = 0;

   dimen = newdim;
}
Пример #5
0
/* MemChunk::write
 * Writes the given data at the current position. Expands the memory
 * chunk if necessary.
 *******************************************************************/
bool MemChunk::write(const void* data, uint32_t size)
{
	// Check pointers
	if (!data)
		return false;

	// If we're trying to write past the end of the memory chunk,
	// resize it so we can write at this point
	if (cur_ptr + size > this->size)
		reSize(cur_ptr + size, true);

	// Write the data and move to the byte after what was written
	memcpy(this->data + cur_ptr, data, size);
	cur_ptr += size;

	// Success
	return true;
}
Пример #6
0
void Element::rePosPoints() {
	reSize();
	rePosPointsWOsize();
}
Пример #7
0
void DVector_exact::reSize(int newsize)
{
   reSize(newsize, dim());
}
Пример #8
0
void DXFrame::resetDev(HWND& hWnd,HINSTANCE& hInsts) {
	reSize(hWnd,hInsts,m_bFullScreen);
}
Пример #9
0
PaletteItem *PaletteItem::add(PaletteItem *item) {
	items.push_back(item);
	item->parentItem = this;
	reSize();
	return item;
}
Пример #10
0
// Constructors and destructor
Array2D::Array2D() {
  arr = 0;
  reSize(0, 0);
}
Пример #11
0
void Array2D::copy(const Array2D &other) {
  reSize(other.wdth, other.hght);
  memcpy(arr, other.arr, hght*sizeof(int *));
  memcpy(arr[0], other.arr[0], wdth*hght*sizeof(int));
}
Пример #12
0
Array2D::Array2D(const Array2D &other) {
  arr = 0;
  reSize(other.wdth, other.hght);
  copy(other);
}
Пример #13
0
Array2D::Array2D(int w, int h) {
  arr = 0;
  reSize(w, h);
}
Пример #14
0
//-----------------------------------------------------------------------------
void DatPanel::toolLeft(QBoxLayout *l)
{
	QAction *a;
	QMenu *o;
	QToolButton *bb;

	// size menu
	o = menu->addMenu(tr("Sizes"));
	a = new QAction(QPixmap(":/png/document-new.png"), tr("Create new"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(create()));
	a->setToolTip(tr("Recreate the data with new sizes and fill it by zeros (Ctrl+Shift+N)."));
	a->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_N);	o->addAction(a);
	bb = new QToolButton(this);	l->addWidget(bb);	bb->setDefaultAction(a);

	a = new QAction(QPixmap(size_xpm), tr("Resize"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(reSize()));
	a->setToolTip(tr("Resize (interpolate) the data to specified sizes (Ctrl+Shift+R)."));
	a->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_R);	o->addAction(a);
	bb = new QToolButton(this);	l->addWidget(bb);	bb->setDefaultAction(a);

	a = new QAction(QPixmap(squize_xpm), tr("Squeeze"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(squize()));
	a->setToolTip(tr("Keep only each n-th element of the data array."));
	o->addAction(a);
	bb = new QToolButton(this);	l->addWidget(bb);	bb->setDefaultAction(a);

	a = new QAction(QPixmap(crop_xpm), tr("Cro&p"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(crop()));
	a->setToolTip(tr("Crop the data edges. Useful to cut off the zero-filled area."));
	o->addAction(a);
	bb = new QToolButton(this);	l->addWidget(bb);	bb->setDefaultAction(a);

	a = new QAction(QPixmap(oper_of_xpm), tr("Transform"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(newdat()));
	a->setToolTip(tr("Transform data along dimension(s) (Ctrl+Shift+T)."));
	a->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_T);	o->addAction(a);
	bb = new QToolButton(this);	l->addWidget(bb);	bb->setDefaultAction(a);

	a = new QAction(QPixmap(oper_dir_xpm), tr("Make new (Ctrl+Shift+M)"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(oper()));
	a->setToolTip(tr("Make another data."));
	a->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_M);	o->addAction(a);
	bb = new QToolButton(this);	l->addWidget(bb);	bb->setDefaultAction(a);

	a = new QAction(QPixmap(hist_xpm), tr("Histogram (Ctrl+Shift+H)"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(hist()));
	a->setToolTip(tr("Find histogram of data."));
	a->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_H);	o->addAction(a);
	bb = new QToolButton(this);	l->addWidget(bb);	bb->setDefaultAction(a);

/*	a = new QAction(QPixmap(":/png/view-refresh.png"), tr("Refresh"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(refresh()));
	a->setToolTip(tr("Refresh data values."));
	o->addAction(a);
	bb = new QToolButton(this);	l->addWidget(bb);	bb->setDefaultAction(a);*/

/*	a = new QAction(tr("Rearrange"), this);	// TODO: move in generalized dialog
	connect(a, SIGNAL(triggered()), this, SLOT(rearrange()));
	a->setToolTip(tr("Rearrange data sizes without changing data values."));
	o->addAction(a);
	a = new QAction(tr("Fill in range"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(inrange()));
	a->setToolTip(tr("Fill data equidistantly from one value to another."));
	o->addAction(a);
	a = new QAction(tr("Normalize"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(norm()));
	a->setToolTip(tr("Normalize data so that its minimal\nand maximal values be in specified range."));
	o->addAction(a);
	a = new QAction(tr("Norm. slices"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(normsl()));
	a->setToolTip(tr("Normalize each data slice perpendicular to some direction\nso that its minimal and maximal values be in specified range."));
	o->addAction(a);*/

	l->addStretch(1);

	a = new QAction(QPixmap(":/png/tab-close.png"), tr("Close tab"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(close()));
	a->setToolTip(tr("Close this data tab."));
	bb = new QToolButton(this);	l->addWidget(bb);	bb->setDefaultAction(a);
}