Page 1 of 1

UnrecognizedPixelMap Exception when creating Image

Posted: 2013-01-11T04:30:47-07:00
by criskross
Hello,

I get the following exception when I try to create an instance of Image:

Code: Select all

try {
    Image mgk(iplImage->width, iplImage->height, "BGR", CharPixel, (char*)iplImage->imageData );	
    return mgk;
} catch (Error e) {
    cout << e.what() << endl;
}
UnrecognizedPixelMap ` ¶BGR' @ error/pixel.c/ImportImagePixels/3713"

I'm using Windows 7 with MSVC2010. Do I have to change any settings withi MSVC?

I already tried c_str() and also string

Re: UnrecognizedPixelMap Exception when creating Image

Posted: 2013-01-11T05:00:51-07:00
by magick
It looks like a structure skew which can come from incorrect compile settings. To start with a sane workspace, go to c:\Program Files\ImageMagick-6.8.1-Q16/Magick++_demos and click on the button workspace, build and execute. If all goes well, you can use that workspace as a template for your own custom codeset.

Re: UnrecognizedPixelMap Exception when creating Image

Posted: 2013-01-11T06:05:51-07:00
by criskross
Ok same answer again.

Somewhere is the problem. Don't you know which setting to change? I am using CMake and I don't want to use button as a template.

I checked your solution but the executable crashes...

Re: UnrecognizedPixelMap Exception when creating Image

Posted: 2013-01-11T06:32:20-07:00
by magick
Not sure why its failing for you, we did a fresh install on 3 Windows systems of ImageMagick-6.8.1-9-Q16 and compiled and ran the button workspace. It compiled and ran without complaint.

Re: UnrecognizedPixelMap Exception when creating Image

Posted: 2013-01-11T06:54:37-07:00
by criskross
I think there is a bug in your function. I enter a string with three chars "BGR" and the errormessage returns ` ¶BGR' ? There is definitively something wrong.

For the future: I think u better should use enums for cases like this....

Of course the exception is right but I didn't commited a string like the exception says

Re: UnrecognizedPixelMap Exception when creating Image

Posted: 2013-01-11T06:57:22-07:00
by magick
That indicates a mismatch on the function stack which can be caused by improper compile / linking parameters. On our system, we get "BGR" as expected.

Re: UnrecognizedPixelMap Exception when creating Image

Posted: 2013-01-13T11:42:13-07:00
by criskross
OK, for those who had the same problem. I think i found the solution.

If u use CMake as a buildtool and try to find ImageMagick there only will be linked the release libraries. That was the problem when I run my program MSVC used the release dll instead of the debug dll in debug mode. So I modified the FindImageMagick.cmake to also search for debug libraries.