使用CIMG图书馆看书JPEG图像时堆栈溢出错误 [英] Stack overflow error when reading jpeg image using Cimg library

查看:278
本文介绍了使用CIMG图书馆看书JPEG图像时堆栈溢出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到堆栈溢出错误,当我试图使用 CIMG 库,而其他格式,bmp是工作文件的读取JPG文件。

我该如何解决呢?

 的#includeCImg.h
    #包括LT&;&stdio.h中GT;
    使用命名空间cimg_library;
    诠释的main()
    {
            CIMG< unsigned char型> SRC(D:\\\\ sidimg.jpg);
            INT宽度= src.width();
            INT高度= src.height();
            无符号字符* PTR = src.data(0,0);
            诠释计数= 0;
              而(计数!=宽*高)
                {                   的printf(%d个,* PTR);
                   PTR ++;
                   算上++;
                }
   }


解决方案

对不起,我回答晚了,但你必须要有的 CONVERT.EXE ImageMagick的包相同的目录中,其中程序以读取/写入JPEG图像执行。

I'm getting stack overflow error when I'm trying to read jpg file using Cimg library while other format bmp is working file .

How can i resolve it?

    #include"CImg.h"
    #include<stdio.h>
    using namespace cimg_library;
    int main()
    {
            CImg<unsigned char> src("d:\\sidimg.jpg");
            int width = src.width();
            int height = src.height();
            unsigned char* ptr = src.data(0,0);
            int count=0;
              while(count!= width*height)
                {

                   printf("%d",*ptr);
                   ptr++;
                   count++;
                }
   }

解决方案

Sorry for the late answer, but you have to have convert.exe from the ImageMagick package in the same directory as where the program is executing in order to read/write jpeg images.

这篇关于使用CIMG图书馆看书JPEG图像时堆栈溢出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆