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


C++ Images类代码示例

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


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

示例1: handle_decode

int handle_decode(char **argv, Images &images, int quality, int scale) {
    char *ext = strrchr(argv[1],'.');
    if (!check_compatible_extension(ext)) {
        e_printf("Error: expected \".png\", \".pnm\" or \".pam\" file name extension for output file\n");
        return 1;
    }
    const auto tim0 = high_resolution_clock::now();
    if (!decode_flif(argv, images, quality, scale)) {e_printf("Error: could not decode FLIF file\n"); return 3; }
    const auto tim1 = high_resolution_clock::now();
    printf("decoded in %lld msec\n", duration_cast<milliseconds>(tim1 - tim0).count());
    if (scale>1)
        v_printf(3,"Downscaling output: %ux%u -> %ux%u\n",images[0].cols(),images[0].rows(),images[0].cols()/scale,images[0].rows()/scale);
    if (images.size() == 1) {
        if (!images[0].save(argv[1],scale)) return 2;
    } else {
        int counter=0;
        std::vector<char> vfilename(strlen(argv[1])+6);
        char *filename = &vfilename[0];
        strcpy(filename,argv[1]);
        char *a_ext = strrchr(filename,'.');
        for (Image& image : images) {
            sprintf(a_ext,"-%03d%s",counter++,ext);
            if (!image.save(filename,scale)) return 2;
            v_printf(2,"    (%i/%i)         \r",counter,(int)images.size()); v_printf(4,"\n");
        }
    }
    v_printf(2,"\n");
    return 0;
}
开发者ID:uxn,项目名称:FLIF,代码行数:29,代码来源:flif.cpp

示例2: makeThumbWrapper

static void makeThumbWrapper ( void *state , ThreadEntry *t ) {
	Images *THIS = (Images *)state;
	// control loop
	if ( ! THIS->downloadImages() ) return;
	// all done
	THIS->m_callback ( THIS->m_state );
}
开发者ID:UIKit0,项目名称:open-source-search-engine,代码行数:7,代码来源:Images.cpp

示例3: icon

    QPixmap Addressbook::icon(const QString &uid)
    {

        Images* icons = KonversationApplication::instance()->images();
        QIconSet currentIcon;
        if(!isPresent(uid))
            return QPixmap();

        switch(presenceStatus(uid))
        {
            case 0:                               //Unknown
            case 1:                               //Offline
            case 2:                               //connecting - invalid for us?
                currentIcon = icons->getKimproxyOffline();
                break;
            case 3:                               //Away
                currentIcon = icons->getKimproxyAway();
                break;
            case 4:                               //Online
                currentIcon = icons->getKimproxyOnline();
                break;
            default:
                //error
                kdDebug() << "Unknown status " << uid << endl;
                return QPixmap();
        }

        QPixmap joinedIcon = currentIcon.pixmap(QIconSet::Automatic, QIconSet::Active, QIconSet::On);
        return joinedIcon;
    }
开发者ID:,项目名称:,代码行数:30,代码来源:

示例4: LoadImagesFromDisk

Images LoadImagesFromDisk(const std::string & path)
{
    Images result;
    int exceptionCounter = 0;
    for (int i = 0; i != 100; ++i)
    {
        try 
        {
            result.push_back(Image::fromFile(path + std::to_string(i)));
        }
        catch (boost::exception & exc)
        {
            exc << ProgressTag(i);
            if (const std::string * fileName = boost::get_error_info<FileNameTag>(exc))
            {
                std::cerr << "Failed to load image " << i << "/100: " << *fileName << ". Origin: ";
                const char * file = *boost::get_error_info<boost::throw_file>(exc);
                int line = *boost::get_error_info<boost::throw_line>(exc);
                const char * func = *boost::get_error_info<boost::throw_function>(exc);
                std::cerr << file << ":" << line << ": " << func << std::endl;
                if (++exceptionCounter >= 10)
                {
                    BOOST_THROW_EXCEPTION(TooManyErrors() << InformationTag("Too many exceptions. Bailing out."));
                }
            }
        }
    }
    return result;    
}
开发者ID:CCJY,项目名称:coliru,代码行数:29,代码来源:main.cpp

示例5: handle_decode

int handle_decode(char **argv, Images &images, int quality, int scale) {
    char *ext = strrchr(argv[1],'.');
    if (!check_compatible_extension(ext)) {
        e_printf("Error: expected \".png\", \".pnm\" or \".pam\" file name extension for output file\n");
        return 1;
    }
    if (!decode_flif(argv, images, quality, scale)) return 3;
    if (scale>1)
        v_printf(3,"Downscaling output: %ux%u -> %ux%u\n",images[0].cols(),images[0].rows(),images[0].cols()/scale,images[0].rows()/scale);
    if (images.size() == 1) {
        if (!images[0].save(argv[1],scale)) return 2;
    } else {
        int counter=0;
        std::vector<char> vfilename(strlen(argv[1])+6);
        char *filename = &vfilename[0];
        strcpy(filename,argv[1]);
        char *a_ext = strrchr(filename,'.');
        for (Image& image : images) {
            sprintf(a_ext,"-%03d%s",counter++,ext);
            if (!image.save(filename,scale)) return 2;
            v_printf(2,"    (%i/%i)         \r",counter,(int)images.size()); v_printf(4,"\n");
        }
    }
    v_printf(2,"\n");
    return -1;
}
开发者ID:noshbar,项目名称:FLIF,代码行数:26,代码来源:flif.cpp

示例6: process

 bool process(const ColorRanges *srcRanges, const Images &images) {
     int np=srcRanges->numPlanes();
     nb = images.size();
     seen_before.clear();
     seen_before.resize(nb,-1);
     bool dupes_found=false;
     for (unsigned int fr=1; fr<images.size(); fr++) {
         const Image& image = images[fr];
         for (unsigned int ofr=0; ofr<fr; ofr++) {
           const Image& oimage = images[ofr];
           bool identical=true;
           for (uint32_t r=0; r<image.rows(); r++) {
             for (uint32_t c=0; c<image.cols(); c++) {
                 for (int p=0; p<np; p++) {
                    if(image(p,r,c) != oimage(p,r,c)) { identical=false; break;}
                 }
                 if (!identical) {break;}
             }
             if (!identical) {break;}
           }
           if (identical) {seen_before[fr] = ofr; dupes_found=true; break;}
         }
     }
     return dupes_found;
 }
开发者ID:pages-alex-alex2006hw,项目名称:FLIF,代码行数:25,代码来源:framedup.hpp

示例7: downloadImageWrapper

static void downloadImageWrapper ( void *state ) {
	Images *THIS = (Images *)state;
	// control loop
	if ( ! THIS->downloadImages() ) return;
	// all done
	THIS->m_callback ( THIS->m_state );
}
开发者ID:UIKit0,项目名称:open-source-search-engine,代码行数:7,代码来源:Images.cpp

示例8: makeThumbWrapper

// Use of ThreadEntry parameter is NOT thread safe
static void makeThumbWrapper ( void *state, job_exit_t exit_type ) {
	Images *THIS = (Images *)state;
	// control loop
	if ( ! THIS->downloadImages() ) return;
	// all done
	THIS->m_callback ( THIS->m_state );
}
开发者ID:lemire,项目名称:open-source-search-engine,代码行数:8,代码来源:Images.cpp

示例9: gotImgIpWrapper

static void gotImgIpWrapper ( void *state , long ip ) {
	Images *THIS = (Images *)state;
	// control loop
	if ( ! THIS->downloadImages() ) return;
	// call callback at this point, we are done with the download loop
	THIS->m_callback ( THIS->m_state );
}
开发者ID:UIKit0,项目名称:open-source-search-engine,代码行数:7,代码来源:Images.cpp

示例10: encode_load_input_images

bool encode_load_input_images(int argc, char **argv, Images &images) {
    int nb_input_images = argc-1;
    while(argc>1) {
        Image image;
        v_printf(2,"\r");
        if (!image.load(argv[0])) {
            e_printf("Could not read input file: %s\n", argv[0]);
            return false;
        };
        images.push_back(std::move(image));
        Image& last_image = images.back();
        if (last_image.rows() != images[0].rows() || last_image.cols() != images[0].cols()) {
            e_printf("Dimensions of all input images should be the same!\n");
            e_printf("  First image is %ux%u\n",images[0].cols(),images[0].rows());
            e_printf("  This image is %ux%u: %s\n",last_image.cols(),last_image.rows(),argv[0]);
            return false;
        }
        if (last_image.numPlanes() < images[0].numPlanes()) {
            if (images[0].numPlanes() == 3) last_image.ensure_chroma();
            else if (images[0].numPlanes() == 4) last_image.ensure_alpha();
            else { e_printf("Problem while loading input images, please report this.\n"); return false; }
        } else if (last_image.numPlanes() > images[0].numPlanes()) {
            if (last_image.numPlanes() == 3) { for (Image& i : images) i.ensure_chroma(); }
            else if (last_image.numPlanes() == 4) { for (Image& i : images) i.ensure_alpha(); }
            else { e_printf("Problem while loading input images, please report this.\n"); return false; }
        }
        argc--; argv++;
        if (nb_input_images>1) {v_printf(2,"    (%i/%i)         ",(int)images.size(),nb_input_images); v_printf(4,"\n");}
    }
    v_printf(2,"\n");
    return true;
}
开发者ID:pages-alex-alex2006hw,项目名称:FLIF,代码行数:32,代码来源:flif.cpp

示例11: gotTermListWrapper

// we got a reply
void gotTermListWrapper ( void *state ) {
	Images *THIS = (Images *)state;
	// process/store the reply
	THIS->gotTermList();
	// try to launch more, returns false if it blocks
	if ( ! THIS->launchRequests() ) return;
	// all done
	THIS->m_callback ( THIS->m_state );
}
开发者ID:UIKit0,项目名称:open-source-search-engine,代码行数:10,代码来源:Images.cpp

示例12: runtime_error

/**
 * \brief retrieve the most recent image from the guider
 */
void	guidercommand::image(GuiderWrapper& guider,
		const std::vector<std::string>& arguments) {
	if (arguments.size() < 3) {
		throw std::runtime_error("missing imageid argument");
	}
	std::string	imageid = arguments[2];

	Astro::Image_ptr	image = guider->mostRecentImage();
        Images  images;
        images.assign(imageid, image);
}
开发者ID:felipebetancur,项目名称:AstroPhotography-2,代码行数:14,代码来源:guidercommand.cpp

示例13:

    ~BlendBaton() {
        for (Images::iterator cur = images.begin(); cur != images.end(); cur++) {
            (*cur)->buffer.Dispose();
        }

#if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION <= 4
        ev_unref(EV_DEFAULT_UC);
#endif
        // Note: The result buffer is freed by the node Buffer's free callback

        callback.Dispose();
    }
开发者ID:Open-Source-GIS,项目名称:node-blend,代码行数:12,代码来源:blend.hpp

示例14: analyze

void Enhancer::analyze(void)
{
	for (int i=0; i<p_files->size(); i++) {
		Images *images = p_files->at(i)->load_images();
		for (int idx=0; idx<images->size(); idx++) {
			Image *img = images->at(idx);
			//img->gen_preview();
			//img->gen_thumbnail();
			img->analyse(&m_filterQueue);
			//img->free_pix();
			p_images->push_back(img);
		}
		delete images;
		std::cout << i << std::endl;
	}
}
开发者ID:pejuko,项目名称:scan_enhancer,代码行数:16,代码来源:enhancer.cpp

示例15: flif_decode_scanlines_inner

template<typename Coder> void flif_decode_scanlines_inner(std::vector<Coder> &coders, Images &images, const ColorRanges *ranges)
{

    ColorVal min,max;
    int nump = images[0].numPlanes();
    for (int k=0,i=0; k < 5; k++) {
        int p=PLANE_ORDERING[k];
        if (p>=nump) continue;
        i++;
        Properties properties((nump>3?NB_PROPERTIES_scanlinesA[p]:NB_PROPERTIES_scanlines[p]));
        v_printf(2,"\r%i%% done [%i/%i] DEC[%ux%u]    ",(int)(100*pixels_done/pixels_todo),i,nump,images[0].cols(),images[0].rows());
        v_printf(4,"\n");
        pixels_done += images[0].cols()*images[0].rows();
        if (ranges->min(p) >= ranges->max(p)) continue;
        for (uint32_t r = 0; r < images[0].rows(); r++) {
            for (int fr=0; fr< (int)images.size(); fr++) {
              Image& image = images[fr];
              uint32_t begin=image.col_begin[r], end=image.col_end[r];
              if (image.seen_before >= 0) { for(uint32_t c=0; c<image.cols(); c++) image.set(p,r,c,images[image.seen_before](p,r,c)); continue; }
              if (fr>0) {
                for (uint32_t c = 0; c < begin; c++)
                   if (nump>3 && p<3 && image(3,r,c) == 0) image.set(p,r,c,predict_and_calcProps_scanlines(properties,ranges,image,p,r,c,min,max));
                   else if (p !=4 ) image.set(p,r,c,images[fr-1](p,r,c));
                   /*
                   else if (nump>4 && p<4 && image(4,r,c) > 0) image.set(p,r,c,images[fr-image(4,r,c)](p,r,c));
                   else {
                     int oldframe=fr-1;  image.set(p,r,c,images[oldframe](p,r,c));
                     while(p == 4 && image(p,r,c) > 0) {oldframe -= image(p,r,c); assert(oldframe>=0); image.set(p,r,c,images[oldframe](p,r,c));}
                   }
                   */
              } else {
                if (nump>3 && p<3) { begin=0; end=image.cols(); }
              }
              for (uint32_t c = begin; c < end; c++) {
                ColorVal guess = predict_and_calcProps_scanlines(properties,ranges,image,p,r,c,min,max);
                if (p==4 && max > fr) max = fr;
                if (nump>3 && p<3 && image(3,r,c) == 0) {image.set(p,r,c,guess); continue;}
                if (nump>4 && p<4 && image(4,r,c) > 0) {image.set(p,r,c,images[fr-image(4,r,c)](p,r,c)); continue;}
                ColorVal curr = coders[p].read_int(properties, min - guess, max - guess) + guess;
                image.set(p,r,c, curr);
              }
              if (fr>0) {
                for (uint32_t c = end; c < image.cols(); c++)
                   if (nump>3 && p<3 && image(3,r,c) == 0) image.set(p,r,c,predict_and_calcProps_scanlines(properties,ranges,image,p,r,c,min,max));
                   else if (p !=4 ) image.set(p,r,c,images[fr-1](p,r,c));
/*                   else if (nump>4 && p<4 && image(4,r,c) > 0) image.set(p,r,c,images[fr-image(4,r,c)](p,r,c));
                   else {
                     int oldframe=fr-1;  image.set(p,r,c,images[oldframe](p,r,c));
                     while(p == 4 && image(p,r,c) > 0) {oldframe -= image(p,r,c); assert(oldframe>=0); image.set(p,r,c,images[oldframe](p,r,c));}
                   }*/
              }
            }
        }
    }
}
开发者ID:noshbar,项目名称:FLIF,代码行数:55,代码来源:flif-dec.cpp


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