imagemagick - MagickWand for C, error when calling DestroyPixelWands -
I am starting to use the ImageMagic and Magicwand API in a simple program. Right now, as a test, I'm looking for black pixels in just one frame here. My code is:
int find_black_pixel (MagickWand * wand) {int res = 0; Pixeliterator * iterator = new pixelitter (rod); Size_t width = Maggiegeimagewidth (rod); Size_t height = maggiegmegehight (rod); Pixelwand ** pixel; Unsigned long X, Y; Unsigned integer alpha; Unsigned int red, green, blue; // printf ("width:% d, height:% d \ n", (integer) width, (integer) height); For (y = 0; y & lt; height; y ++) {pixels = PixelGetNextIteratorRow (iterator, and width); {Alpha = (unsigned integer) (255 * pixelgate elf (pixels [x]) for (x = 0; x and lt; width; x ++); If (alpha == 0) will continue; Red = (unsigned integer) (255 * pixelgatered (pixels [x]); Green = (unsigned integer) (255 × pixelgategreen (pixels [x]); Blue = (unsigned integer) (255 × pixelgate (pixels [x]); // printf ("% 04ld,% 04ld, alpha:% D, RGB:% d,% d,% d \ n", x, y, alpha, red, green, blue); If ((red == 0) || (green == 0) || (blue == 0)) {res = 1; // destroyed PixelWands (pixels, width); Goto_find_black_pixel; }} // DestroyPixelWands (pixels, (size_t) width); } Finished_find_black_pixel: Delete pixel itater (iterator); Return ridge; } If I reduce any of the DestroyPixelWands calls, I get an argument: Test: wand / pixel-wand. C: 283: Destruction Pixelwandes: assurance `(* stick) - & gt; Signature == 0xabacadabUL 'failed. Any thoughts on why this is happening?
Edit:
More debugging ... even Blast Pixelweng (pixels [0]); Fails it the same way ...
I suspect that pixels is not a separate vandalable object (it's just an indicator in the original wand object) and that your code to delete pixels without any help The code is fine.
Comments
Post a Comment