gpt4 book ai didi

c++ - CImg读取图像异常

转载 作者:行者123 更新时间:2023-11-28 06:40:38 25 4
gpt4 key购买 nike

我正在使用 CImg 读取 .png 文件,如下所示:

// DGT.cpp : Defines the entry point for the console application.

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include "..\CImg\CImg.h"

using namespace std;
using namespace cimg_library;

long ReadImage(char *fileName)
{
CImg<unsigned char> image(fileName); // stackover flow exceptions thrown here.

return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
ReadImage("D:\\Projects\\DGT\\DGT\\shepplogan256.png");
return 0;
}

但是,堆栈溢出异常在CImg<unsigned char> image(fileName);处被抛出尝试加载图像时。图像在那里,所以我想知道我在哪里搞砸了以及如何读取图像?

最佳答案

你需要libpngimagemagick使用 CImg 加载 PNG 文件。

关于c++ - CImg读取图像异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26046581/

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