本文整理汇总了C++中image::Image::fill方法的典型用法代码示例。如果您正苦于以下问题:C++ Image::fill方法的具体用法?C++ Image::fill怎么用?C++ Image::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image::Image
的用法示例。
在下文中一共展示了Image::fill方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeMask
/**
* Fill mask from corresponding points (each point pictured by a disk of radius _radius)
*
* \param[out] maskLeft Mask of the left image (initialized to corresponding image size).
* \param[out] maskRight Mask of the right image (initialized to corresponding image size).
*
* \return True if some pixel have been set to true.
*/
virtual bool computeMask( image::Image< unsigned char > & maskLeft, image::Image< unsigned char > & maskRight )
{
maskLeft.fill(0);
maskRight.fill(0);
for( std::vector< matching::IndMatch >::const_iterator
iter_putativeMatches = _vec_PutativeMatches.begin();
iter_putativeMatches != _vec_PutativeMatches.end();
++iter_putativeMatches )
{
const features::SIOPointFeature & L = _vec_featsL[ iter_putativeMatches->i_ ];
const features::SIOPointFeature & R = _vec_featsR[ iter_putativeMatches->j_ ];
image::FilledCircle( L.x(), L.y(), ( int )_radius, ( unsigned char ) 255, &maskLeft );
image::FilledCircle( R.x(), R.y(), ( int )_radius, ( unsigned char ) 255, &maskRight );
}
return _vec_PutativeMatches.size() > 0;
}
示例2: computeMask
/**
* Put masks to white, images are conserved
*
* \param[out] maskLeft Mask of the left image (initialized to corresponding image size).
* \param[out] maskRight Mask of the right image (initialized to corresponding image size).
*
* \return True.
*/
virtual bool computeMask(
image::Image< unsigned char > & maskLeft,
image::Image< unsigned char > & maskRight )
{
std::vector< matching::IndMatch > vec_KVLDMatches;
image::Image< unsigned char > imageL, imageR;
image::ReadImage( _sLeftImage.c_str(), &imageL );
image::ReadImage( _sRightImage.c_str(), &imageR );
image::Image< float > imgA ( imageL.GetMat().cast< float >() );
image::Image< float > imgB(imageR.GetMat().cast< float >());
std::vector< Pair > matchesFiltered, matchesPair;
for( std::vector< matching::IndMatch >::const_iterator iter_match = _vec_PutativeMatches.begin();
iter_match != _vec_PutativeMatches.end();
++iter_match )
{
matchesPair.push_back( std::make_pair( iter_match->i_, iter_match->j_ ) );
}
std::vector< double > vec_score;
//In order to illustrate the gvld(or vld)-consistant neighbors, the following two parameters has been externalized as inputs of the function KVLD.
openMVG::Mat E = openMVG::Mat::Ones( _vec_PutativeMatches.size(), _vec_PutativeMatches.size() ) * ( -1 );
// gvld-consistancy matrix, intitialized to -1, >0 consistancy value, -1=unknow, -2=false
std::vector< bool > valide( _vec_PutativeMatches.size(), true );// indices of match in the initial matches, if true at the end of KVLD, a match is kept.
size_t it_num = 0;
KvldParameters kvldparameters;//initial parameters of KVLD
//kvldparameters.K = 5;
while (
it_num < 5 &&
kvldparameters.inlierRate >
KVLD(
imgA, imgB,
_vec_featsL, _vec_featsR,
matchesPair, matchesFiltered,
vec_score, E, valide, kvldparameters ) )
{
kvldparameters.inlierRate /= 2;
std::cout<<"low inlier rate, re-select matches with new rate="<<kvldparameters.inlierRate<<std::endl;
kvldparameters.K = 2;
it_num++;
}
bool bOk = false;
if( !matchesPair.empty())
{
// Get mask
getKVLDMask(
&maskLeft, &maskRight,
_vec_featsL, _vec_featsR,
matchesPair,
valide,
E);
bOk = true;
}
else{
maskLeft.fill( 0 );
maskRight.fill( 0 );
}
return bOk;
}
示例3: computeMask
/**
* Put masks to white, all image is considered as valid pixel selection
*
* \param[out] maskLeft Mask of the left image (initialized to corresponding image size).
* \param[out] maskRight Mask of the right image (initialized to corresponding image size).
*
* \return True.
*/
bool computeMask( image::Image< unsigned char > & maskLeft, image::Image< unsigned char > & maskRight ) override
{
maskLeft.fill( image::WHITE );
maskRight.fill( image::WHITE );
return true;
}