本文整理汇总了C++中FloatImage::row方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatImage::row方法的具体用法?C++ FloatImage::row怎么用?C++ FloatImage::row使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatImage
的用法示例。
在下文中一共展示了FloatImage::row方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stdImg
NiblackBinaryImage::NiblackBinaryImage(const GreyLevelImage& anImg,
const int aLowThres,
const int aHighThres,
const int aMaskSize,
const float aK,
const float aPostThres)
: BinaryImage(anImg.width(), anImg.height())
{
// Pointer to mean image
FloatImage* pMeanImg = 0;
// Compute standard deviation and mean
StandardDeviationImage stdImg(FloatImage(anImg), pMeanImg, aMaskSize);
// Rows to exchange data
GreyLevelImage::pointer bRow = new GreyLevelImage::value_type [_width];
GreyLevelImage::pointer gRow = new GreyLevelImage::value_type [_width];
float* mRow = new float [_width];
float* sRow = new float [_width];
// Binarize
for (int i = 0 ; i < _height ; ++i)
{
// Read means
pMeanImg->row(i, mRow);
// Read deviations
stdImg.row(i, sRow);
// Read original
anImg.row(i, gRow);
// Pointers
float* m = mRow;
float* s = sRow;
GreyLevelImage::pointer g = gRow;
GreyLevelImage::pointer b = bRow;
// Dynamic thresholding
for (int j = 0 ; j < _width ; ++j, ++b, ++g)
{
if (*g < aLowThres)
{
*b = 1;
}
else if (*g > aHighThres)
{
*b = 0;
}
else if (*g < (GreyLevelImage::value_type) (*m++ + aK * *s++))
{
*b = 1;
}
else
{
*b = 0;
}
}
// Save line
setRow(i, bRow);
}
// Post-processing
if (aPostThres > 0)
{
// Copy reference image
BinaryImage* contours = new BinaryImage(*this);
// Extract connected components
ConnectedComponents* compConnexes = new ConnectedComponents(*contours);
// Prepare tables
int labCnt = compConnexes->componentCnt();
// Tables for the sums of the means of the gradient
float* gsum = new float [labCnt];
qgFill(gsum, labCnt, 0.f);
// Tables for the numbers of points -- for the mean
int* psum = new int [labCnt];
qgFill(psum, labCnt, 0);
// Table of labels
Component::label_type* labRow = new Component::label_type[_width];
// By construction, first and last pixels are always WHITE
labRow[1] = 0;
labRow[_width - 1] = 0;
// Compute the module of Canny gradient
CannyGradientImage* gradImg = new CannyGradientImage(anImg);
GradientModuleImage gradModImg(*gradImg);
delete gradImg;
// Construct the image of the contours of the black components
// which thus includes the interesting pixels
ErodedBinaryImage* eroImg = new ErodedBinaryImage(*contours);
(*contours) -= (*eroImg);
delete eroImg;
// Create a line of floats
//.........这里部分代码省略.........