Troubleshooting MagickCore on iOS

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
maronnax
Posts: 1
Joined: 2014-04-21T16:04:23-07:00
Authentication code: 6789

Troubleshooting MagickCore on iOS

Post by maronnax »

I have code that preprocesses images using ImageCore for which I have working code that I can compile and run successfully on my laptop. However, when I try to run the code on iOS it doesn't work.

Basically, I get the image, resize it, apply a DoG convolution morphology to the image, negate it and then ContrastStretch it. Everything here works except the DoG convolution, shown below:

Code: Select all

 KernelInfo* kernel =  AcquireKernelInfo("DoG:20,100,0");
 my_image = MorphologyImage(my_image, ConvolveMorphology, 1, kernel, exception);
When these two lines are commented out, the code performs exactly as expected. However when I attempt to run the code above as part of the process, an 843 byte jpg is produced that is 100% white (for a 200x200 image). No exceptions are produced and the code is run successfully according to MagickCore. Once again, this is the exact same code I'm running on my laptop and which runs successfully there (although it is linked against different versions of the library).

I'm using the compiled libraries for iOS produced by Claudio Marforio at https://github.com/marforic/imagemagick_lib_iphone. Unless this is somehow a known issue, I'm not really expecting it to be solved based on the info I'm providing here, but I am looking to help generate a strategy for troubleshooting and tracking this down. About the only idea I've got is to try compiling the libraries myself, which I'm happy to do if appropriate, but am guessing this may take a little time and won't be likely to get a good result.

So I suppose my questions are: 1) to knowledgable people, does this result suggest something I should look at or something that may be going on. 2) for those who have been there before with ImageMagick, especially with mobile development experience, how would you begin trouble shooting this; what should I be looking for?

And of course, I'm happy to provide more info as needed. I'm just nervous about a very deep rabbit hole for code I admittedly don't understand as well as I'd like; any guidance or suggestions for how to start tackling this would be appreciated.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Troubleshooting MagickCore on iOS

Post by fmw42 »

First you may be using an older version of IM that was before -moprhology was developed.

Second, I suspect your syntax is wrong. See http://www.imagemagick.org/Usage/convolve/#dog where it says:

DoG:{radius},{sigma1}[,{sigma2}]

Typically, you can leave the radius=0 and just supply sigma1 and sigma2 and IM will find the best radius to use, where sigma1<sigma2. I also think your values are too large. I do not know the syntax for the ImageCore command, but I would guess that the ordering of the arguments would be the same as in the command line.

If that is correct, then try

KernelInfo* kernel = AcquireKernelInfo("DoG:0,1,2");

and see if that works.

Otherwise, if they have the radius last, then try

KernelInfo* kernel = AcquireKernelInfo("DoG:1,2,0");
Post Reply