[英]CImg library not loading image
我已經遵循了CImg 教程 ,並且效果很好。 但是,如果嘗試加載其他圖像(lena.jpg除外),則會出現堆棧溢出錯誤。
例如,這有效:
CImg<float> image;
string filePath = "C:/Users/zzz/Documents/lena.jpg";
image.load(filePath.c_str());
但這給出了一個錯誤:
CImg<float> image;
string filePath = "C:/Users/zzz/Documents/anotherimage.jpg";
image.load(filePath.c_str());
錯誤是:LoadImageTest.exe中0x77bb15de的未處理異常:0xC00000FD:堆棧溢出。
我以為堆棧溢出是由於“ anotherimage.jpg”太大,所以我還嘗試了一個非常小的圖像(16x16像素)。 這導致了同樣的錯誤。
有人對為什么會這樣有什么建議嗎?
完整代碼:
#include "stdafx.h"
#include <iostream>
#include "CImg.h"
using namespace cimg_library;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
CImg<float> image;
// This works...
string filePath = "C:/Users/zzz/Pictures/lena.jpg";
// This doesn't work...
// string filePath = "C:/Users/zzz/Pictures/small.jpg";
image.load(filePath.c_str());
CImgDisplay main_disp(image, "The image");
while (!main_disp.is_closed())
{
main_disp.wait();
}
return 0;
}
看起來很奇怪。 您確定這確實是JPG格式的文件嗎? 它是否使用某些特殊的JPEG格式(黑白,12位?,...)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.