本文整理汇总了C++中image::set方法的典型用法代码示例。如果您正苦于以下问题:C++ image::set方法的具体用法?C++ image::set怎么用?C++ image::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void stateBaseWave::paint()
{
trackDocument * doc = trackDocument::get();
static image viewImage;//画面表示用画像
viewImage.topdown = false;
viewImage.create( doc->baseWave.w, doc->baseWave.h );
pixel p( 0, 0, 0, 255 );
for ( int x = 0; x < viewImage.width; ++x ) {
int maxValue = doc->maxValues[x];
for ( int y = 0; y < viewImage.height; ++y ) {
p.r = p.g = p.b = static_cast<unsigned char>( clamp<int>( 0, double( doc->baseWave( x, y ) ) / maxValue * 255, 255 ) );
viewImage.setInternal( x, y, p );
}
}
array<int>::iterator it( doc->wave );
pixel c( 0, 255, 255, 255 );
pixel baseColor( 255, 0, 255, 255 );
for ( int x = 0; x < viewImage.width && it; ++x, ++it ) {
int y = doc->waveBias + it();
if ( x == doc->baseIndex ) {
viewImage.set( x, y, blend( viewImage.get( x, y ), baseColor ) );
} else {
viewImage.set( x, y, blend( viewImage.get( x, y ), c ) );
}
}
stateDocument::paint( viewImage );
}
示例2: nlfilter
void nlfilter(image& img, std::size_t w, std::size_t h,
std::function<image::pixel_t(const ublas::matrix<image::pixel_t>&)> f)
{
auto iw = img.width();
auto ih = img.height();
// The number of rows above/aside the center element
auto top = static_cast<std::size_t>(std::floor(h / 2.0));
auto left = static_cast<std::size_t>(std::floor(w / 2.0));
// We must store the result and set the image to it after we have processed
// the image as subsequent regions may need to use the unchanged pixel at
// a location we have already modified.
ublas::matrix<image::pixel_t> result(iw, ih);
for(decltype(iw) x = 0; x < iw; ++x) {
for(decltype(ih) y = 0; y < ih; ++y) {
// img.region works from the top left of the region so we must
// offset it so that (x, y) is at the center.
result(x, y) = f(img.region(x - left, y - top, w, h));
}
}
img.set(0, 0, result);
}