gpt4 book ai didi

c - 使用 Cimg 库读取 jpeg 图像时出现堆栈溢出错误

转载 作者:太空宇宙 更新时间:2023-11-04 04:49:44 30 4
gpt4 key购买 nike

当我尝试使用 Cimg 库读取 jpg 文件而其他格式的 bmp 文件正在工作时,我遇到堆栈溢出错误。

我该如何解决?

    #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++;
}
}

最佳答案

很抱歉回答晚了,但你必须有 convert.exe来自 ImageMagick打包在与程序执行位置相同的目录中,以便读取/写入 jpeg 图像。

关于c - 使用 Cimg 库读取 jpeg 图像时出现堆栈溢出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16864709/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com