当前位置: 首页>>代码示例>>C++>>正文


C++ AContainer::size方法代码示例

本文整理汇总了C++中AContainer::size方法的典型用法代码示例。如果您正苦于以下问题:C++ AContainer::size方法的具体用法?C++ AContainer::size怎么用?C++ AContainer::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AContainer的用法示例。


在下文中一共展示了AContainer::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: renderPlane

Plane PlaneRender::renderPlane( const AContainer& aligner, int plane, AProcessWatcher* watcher ) const{
    auto scale = aligner.image( 0 )[plane].getSize().to<double>() / aligner.image( 0 )[0].getSize().to<double>();
    
    //Create output plane
    Plane out( (Point<>( aligner.size().size ) * scale).round() );
    out.fill( color::BLACK );
    
    //Initialize PlaneItInfos
    vector<PlaneItInfo> info;
    info.emplace_back( out, (aligner.size().pos * scale).round() );
    
    for( auto align : aligner )
        info.emplace_back( const_cast<Plane&>( align.image()[plane] ), (align.pos() * scale).round() );
        //TODO: FIX!!!
    
    //Execute
    MultiPlaneIterator it( info );
    it.data = data();
    it.iterate_all();
    it.for_all_pixels( pixel(), watcher, 1000 * plane );
    
    return out;
}
开发者ID:spillerrec,项目名称:Overmix,代码行数:23,代码来源:PlaneRender.cpp

示例2: render

ImageEx DiffRender::render( const AContainer& aligner, unsigned max_count, AProcessWatcher* watcher ) const{
    if( max_count > aligner.count() )
        max_count = aligner.count();
    
    //Normal render
    ImageEx avg = SimpleRender( SimpleRender::FOR_MERGING ).render( aligner, max_count );
    
    //Find the smallest shared size
    QSize size = aligner.size().size(); //No image is larger than the final result
    for( unsigned i=0; i<max_count; i++ ){
        size.setWidth( min( (unsigned)size.width(), aligner.image(i).get_width() ) );
        size.setHeight( min( (unsigned)size.height(), aligner.image(i).get_height() ) );
    }
    
    //Create final output image based on the smallest size
    ImageEx img( ImageEx::GRAY );
    img.create( size.width(), size.height() );
    Plane& output = img[0];
    
    if( watcher )
        watcher->setTotal( 1000 );
    
    //Iterate over each pixel in the output image
    for( unsigned iy=0; iy<output.get_height(); iy++ ){
        if( watcher )
            watcher->setCurrent( iy * 1000 / output.get_height() );
        
        color_type* out = output.scan_line( iy );
        for( unsigned ix=0; ix<output.get_width(); ix++ ){
            //Set the pixel to the static difference of all the images until max_count
            StaticDiff diff( aligner, avg, ix, iy );
            
            for( unsigned j=0; j<max_count; j++ )
                diff.add_image( j );
            
            out[ix] = diff.result();
        }
    }
    
    img.apply( &Plane::normalize );
    return img;
}
开发者ID:imclab,项目名称:Overmix,代码行数:42,代码来源:DiffRender.cpp

示例3: render

ImageEx AverageRender::render( const AContainer& aligner, AProcessWatcher* watcher ) const{
    Timer t( "AverageRender::render()" );
    
    //Abort if no images
    if( aligner.count() == 0 ){
        qWarning( "No images to render!" );
        return ImageEx();
    }
    unsigned planes_amount = for_merging ? 1 : aligner.image(0).size();
    ProgressWrapper( watcher ).setTotal( aligner.count() * planes_amount );
    
    //Determine if we need to care about alpha per plane
    bool use_plane_alpha = false;
    for( unsigned i=0; i<aligner.count(); ++i )
        if( aligner.alpha( i ) || aligner.imageMask( i ) >= 0 ){
            use_plane_alpha = true;
            break;
        }
    //Check for movement in both direction
    auto movement = aligner.hasMovement();
    if( movement.first && movement.second )
        use_plane_alpha = true;
    
    auto color_space = aligner.image(0).getColorSpace();
    ImageEx img( for_merging ? color_space.changed( Transform::GRAY ) : color_space );
    
    AlphaScales masks;
    for( unsigned c=0; c<planes_amount; c++ ){
        auto scale = upscale_chroma ? Point<double>(1,1)
            : aligner.image( 0 )[c].getSize().to<double>() / aligner.image( 0 )[0].getSize().to<double>();
        masks.addScale( aligner, scale );
    }
    
    auto min_point = aligner.minPoint();
    auto full = aligner.size().size;
    for( unsigned c=0; c<planes_amount; c++ ){
        //Determine local size
        auto scale = upscale_chroma ? Point<double>(1,1)
            : aligner.image( 0 )[c].getSize().to<double>() / aligner.image( 0 )[0].getSize().to<double>();
        
        
        //TODO: something is wrong with the rounding, chroma-channels are slightly off
        SumPlane sum( (scale * full).ceil() );
        sum.spacing = spacing;
        sum.offset  = offset;
        
        for( unsigned j=0; j<aligner.count(); j++ ){
            auto& image = aligner.image( j );
            auto pos = (scale * (aligner.pos(j) - min_point)).round();
            auto plane = getScaled( image[c], (scale * image[0].getSize()).round() );
            
            const Plane& alpha_plane = masks.getAlpha( c, aligner.imageMask( j ), aligner.alpha( j ) );
            if( use_plane_alpha && alpha_plane.valid() )
                sum.addAlphaPlane( plane(), alpha_plane, pos );
            else
                sum.addPlane( plane(), pos );
            
            ProgressWrapper( watcher ).add();
        }
        
        img.addPlane( sum.average() );
        
        if( c == 0 && use_plane_alpha )
            img.alpha_plane() = sum.alpha();
            //TODO: what to do about the rest? We should try to fill in the gaps?
    }
    
    return img;
}
开发者ID:,项目名称:,代码行数:69,代码来源:

示例4: aligner

        StaticDiff( const AContainer& aligner, const ImageEx& ref, unsigned x, unsigned y )
            : aligner(aligner), reference(ref) {
            offset = QPoint( x, y );
            absolute = aligner.size().topLeft();
        }
开发者ID:imclab,项目名称:Overmix,代码行数:5,代码来源:DiffRender.cpp


注:本文中的AContainer::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。