Exemplo n.º 1
0
Mat CmSaliencyGC::GetSalFromGMMs(vecD &val, bool bNormlize)
{
	ReScale(val);
	Mat binSal = Mat::zeros(_HistBinSalCi1f[0].size(), CV_32F);
	int num = (int)_HistBinSalCi1f.size(), type = _HistBinSalCi1f[0].type();
	for (int c = 0; c < num; c++){
		Mat tmp;
		_HistBinSalCi1f[c].convertTo(tmp, type, val[c]);
		add(binSal, tmp, binSal);
	}
	normalize(binSal, binSal, -4, 4, NORM_MINMAX);
	float *bVal = binSal.ptr<float>(0);
	for(int i = 0; i < binSal.cols; i++)
		bVal[i] = 1 / (1 + exp(-bVal[i])); // Sigmoid
	if (bNormlize)
		normalize(binSal, binSal, 0, 1, NORM_MINMAX);
	Mat salMat(_HistBinIdx1i.size(), CV_32F);
	float* binSalVal = (float*)(binSal.data);
#pragma omp parallel for
	for (int r = 0; r < _HistBinIdx1i.rows; r++){
		const int* idx = _HistBinIdx1i.ptr<int>(r);
		float* sal = salMat.ptr<float>(r);
		for (int c = 0; c < _HistBinIdx1i.cols; c++)
			sal[c] = binSalVal[idx[c]];
	}
	blur(salMat, salMat, Size(3, 3));
	normalize(salMat, salMat, 0, 1, NORM_MINMAX);
	return salMat;
}
Exemplo n.º 2
0
/// Sets the DC's window x- and y-extents to the given extent values. The previous
/// extents are saved in oldExtent. Returns nonzero if the call is successful;
/// otherwise, returns 0. The extent value determines the amount of stretching or
/// compression needed in the logical coordinate system to fit the device coordinate
/// system. extent also determines the relative orientation of the two coordinate
/// systems.
//
bool
TPrintPreviewDC::SetWindowExt(const TSize& extent, TSize * oldExtent)
{
  bool result = PrnDC.SetWindowExt(extent, oldExtent);
  ReScale();
  return result;
}
Exemplo n.º 3
0
//
/// Sets the current window mapping mode of this DC to mode. Returns the previous
/// mapping mode value. The mapping mode defines how logical coordinates are mapped
/// to device coordinates. It also controls the orientation of the device's x- and
/// y-axes.
//
int
TPrintPreviewDC::SetMapMode(int mode)
{
  int result = PrnDC.SetMapMode(mode);
  ReScale();
  return result;
}
Exemplo n.º 4
0
//
/// Modifies this DC's window extents relative to the current values. The new
/// extents are derived as follows:
/// \code
/// xNewWE = (xOldWE * xNum)/ xDenom
/// yNewWE = (yOldWE * yNum)/ yDenom
/// \endcode
/// The previous extents are saved in oldExtent. Returns nonzero if the call is
/// successful; otherwise returns 0.
//
bool
TPrintPreviewDC::ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom,
                                TSize * oldExtent)
{
  bool result = PrnDC.ScaleWindowExt(xNum, xDenom, yNum, yDenom, oldExtent);
  ReScale();
  return result;
}