Accessing multi-frame image in Magick++

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
blackhaz

Re: Accessing multi-frame image in Magick++

Post by blackhaz »

Hi Magick. Built 6.6.4-3. Two issues:

1) When compiling my app:
/usr/local/include/ImageMagick/Magick++/STL.h: In instantiation of 'void Magick::forwardFourierTransformImage(Container*, const Magick::Image&, bool) [with Container = std::list<Magick::Image, std::allocator<Magick::Image> >]':
../DStation/dstation.cpp:502: instantiated from here
502th line of dstation.cpp:
forwardFourierTransformImage(&FFTContainer,inputImage,false);

2) /usr/local/include/ImageMagick/Magick++/STL.h:2229: warning: unused parameter 'magnitude_'
From v6.6.4-3 STL.h:

Code: Select all

// Build image list
    MagickCore::Image* images = ForwardFourierTransformImage(
      image_.constImage(), MagickTrue, &exceptionInfo);
Looks like we are building only magnitude and phase versions and are not using the magnitude_ boolean?

I assume we shall use the following construction to use magnitude_:
magnitude_ == true ? MagickTrue : MagickFalse

UPD: I applied this construction to STL.h, rebuilt, and this fixes both warnings. Here is how the correct function looks like in STL.h:

Code: Select all

template <class Container >
  void forwardFourierTransformImage( Container *fourierImages_,
    const Image &image_, const bool magnitude_ ) {
    MagickCore::ExceptionInfo exceptionInfo;
    MagickCore::GetExceptionInfo( &exceptionInfo );

    // Build image list
    MagickCore::Image* images = ForwardFourierTransformImage(
      image_.constImage(), magnitude_ == true ? MagickTrue : MagickFalse, &exceptionInfo);

    // Ensure container is empty
    fourierImages_->clear();

    // Move images to container
    insertImages( fourierImages_, images );

    // Report any error
    throwException( exceptionInfo );
    (void) MagickCore::DestroyExceptionInfo( &exceptionInfo );
  }
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Accessing multi-frame image in Magick++

Post by magick »

Doh! A copy / paste error. Fixed in the latest 6.6.4-3 available later this evening.
blackhaz

Re: Accessing multi-frame image in Magick++

Post by blackhaz »

6.6.4-3 started to behave badly. App crashes sporadically. Looks like RelinquishMagickMemory is the problem. I wonder, does it have any relationship with the container? Deconvolution process went fine and it looks crashes *may* occur whenever the calling function exits. Any ideas? Thank you!

Here's the log:

Process: DStation [81656]
Path: /-Astro/DStation/DStation-build-desktop/DStation.app/Contents/MacOS/DStation
Identifier: com.yourcompany.DStation
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: launchd [91]

Date/Time: 2010-09-18 00:16:06.942 +0200
OS Version: Mac OS X 10.6.4 (10F569)
Report Version: 6

Interval Since Last Report: 87583 sec
Crashes Since Last Report: 1
Per-App Interval Since Last Report: 7486 sec
Per-App Crashes Since Last Report: 1
Anonymous UUID: 5DDD85FE-05E5-4AF7-ABF7-433AD689C9C9

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Application Specific Information:
abort() called

Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libSystem.B.dylib 0x00007fff8320e3d6 __kill + 10
1 libSystem.B.dylib 0x00007fff832ae972 abort + 83
2 libSystem.B.dylib 0x00007fff831c6615 free + 128
3 libMagickCore.4.dylib 0x00000001001f16bf RelinquishMagickMemory + 15 (memory.c:792)
4 libMagickCore.4.dylib 0x0000000100258682 DestroySplayTree + 194 (splay-tree.c:709)
5 libMagickCore.4.dylib 0x000000010020d23a DestroyImageProperties + 58 (property.c:290)
6 libMagickCore.4.dylib 0x00000001001dbf30 DestroyImage + 272 (image.c:1246)
7 libMagickCore.4.dylib 0x00000001001e94a8 DestroyImageList + 56 (list.c:450)
8 libMagick++.4.dylib 0x0000000100079d03 Magick::ImageRef::image(MagickCore::_Image*) + 35 (ImageRef.cpp:84)
9 libMagick++.4.dylib 0x00000001000711e8 Magick::Image::replaceImage(MagickCore::_Image*) + 184 (Image.cpp:4172)
10 libMagick++.4.dylib 0x00000001000764a0 Magick::Image::crop(Magick::Geometry const&) + 80 (Image.cpp:738)
11 com.yourcompany.DStation 0x000000010000c8f2 DStation::deconvolve() + 10756 (dstation.cpp:609)
12 com.yourcompany.DStation 0x000000010000da53 DStation::on_deconvolveButton_clicked() + 21 (dstation.cpp:298)
13 com.yourcompany.DStation 0x00000001000304d9 DStation::qt_metacall(QMetaObject::Call, int, void**) + 841 (moc_dstation.cpp:176)
14 QtCore 0x00000001012e9c1b QMetaObject::activate(QObject*, QMetaObject const*, int, void**) + 603
15 QtGui 0x0000000100d18b61 QAbstractButton::clicked(bool) + 49
16 QtGui 0x0000000100a54770 QAbstractButtonPrivate::emitClicked() + 64
17 QtGui 0x0000000100a559aa QAbstractButtonPrivate::click() + 154
18 QtGui 0x0000000100a55c01 QAbstractButton::mouseReleaseEvent(QMouseEvent*) + 113
19 QtGui 0x0000000100b1e6a2 QToolButton::mouseReleaseEvent(QMouseEvent*) + 18
20 QtGui 0x000000010074b1a1 QWidget::event(QEvent*) + 2369
21 QtGui 0x0000000100a54aa8 QAbstractButton::event(QEvent*) + 40
22 QtGui 0x0000000100b2049f QToolButton::event(QEvent*) + 63
23 QtGui 0x00000001006f18cd QApplicationPrivate::notify_helper(QObject*, QEvent*) + 189
24 QtGui 0x00000001006f8190 QApplication::notify(QObject*, QEvent*) + 7824
25 QtCore 0x00000001012e386c QCoreApplication::notifyInternal(QObject*, QEvent*) + 124
26 QtGui 0x00000001006f1b3c qt_sendSpontaneousEvent(QObject*, QEvent*) + 44
27 QtGui 0x00000001006aa5c0 qt_mac_handleMouseEvent(void*, void*, QEvent::Type, Qt::MouseButton) + 1328
28 QtGui 0x000000010069d7e6 -[QCocoaView mouseUp:] + 22
29 com.apple.AppKit 0x00007fff876f87ed -[NSWindow sendEvent:] + 5547
30 QtGui 0x00000001006a3ffe -[QCocoaWindow sendEvent:] + 206
31 com.apple.AppKit 0x00007fff8762dee2 -[NSApplication sendEvent:] + 4719
32 com.apple.AppKit 0x00007fff875c4922 -[NSApplication run] + 474
33 QtGui 0x00000001006afb55 QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 1493
34 QtCore 0x00000001013b9574 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 68
35 QtCore 0x00000001013b9884 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 180
36 QtCore 0x00000001013bae9c QCoreApplication::exec() + 188
37 com.yourcompany.DStation 0x0000000100002955 main + 168 (main.cpp:14)
38 com.yourcompany.DStation 0x0000000100002774 start + 52
...
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Accessing multi-frame image in Magick++

Post by magick »

If you haven't already done so, type
  • cd ImageMagick-6.6.4-3
    make
    make install
    make check
Do the validation tests pass? In particular does the Magick++ tests run without complaint?
blackhaz

Re: Accessing multi-frame image in Magick++

Post by blackhaz »

Here are failed tests:

test 447: PICT/Undefined/PaletteMatte/8-bits... fail (with distortion 1.85372e+42).
test 448: PICT/Undefined/PaletteBilevelMatte/8-bits... fail (with distortion 2.81555e+43).

---


FAIL: Magick++/tests/attributes.sh (exit: 1)
============================================

Line: 160, backgroundColor default (#000000000000000000000000) is incorrect
Line: 180, backgroundColor (#0000000000000000FFFFFF00) is incorrect
Line: 200, backgroundColor (#00000000AAAAAB0000000000) is incorrect
Line: 266, baseFilename (xc:#FFFFFF000000000000000000) is incorrect
Testing throwing and catching exceptions. A program crash or a message
that the exception was not caught indicates a test failure. A properly
formatted exception message indicates success:
Caught exception, good!:
"attributes: no decode delegate for this image format `foo' @ error/constitute.c/ReadImage/532"
Line: 1295, signature (bc272b75794971f4a3ade1bf524c0aee375765e9fb15d65278a8b9452b551ea6) is incorrect
5 failures

---

FAIL: Magick++/tests/color.sh (exit: 1)
=======================================

Line: 63 Color("red") is #FFFFFF000000000000000000 rather than #000000000000000000000000
Line: 63 Color("green") is #000000008080800000000000 rather than #000000008080810000000000
Line: 63 Color("blue") is #0000000000000000FFFFFF00 rather than #000000000000000000000000
Line: 63 Color("white") is #FFFFFF00FFFFFF00FFFFFF00 rather than #000000000000000000000000
Line: 63 Color("cyan") is #00000000FFFFFF00FFFFFF00 rather than #000000000000000000000000
Line: 63 Color("magenta") is #FFFFFF0000000000FFFFFF00 rather than #000000000000000000000000
Line: 63 Color("yellow") is #FFFFFF00FFFFFF0000000000 rather than #000000000000000000000000
Line: 102 Conversion from #ABC is #AAAAAB00BBBBBC00CCCCCD00 rather than #AAAAAAAABBBBBBBBCCCCCCCC
Line: 102 Conversion from #AABBCC is #AAAAAB00BBBBBC00CCCCCD00 rather than #AAAAAAAABBBBBBBBCCCCCCCC
Line: 102 Conversion from #AAAABBBBCCCC is #AAAAAB00BBBBBC00CCCCCD00 rather than #AAAAAAAABBBBBBBBCCCCCCCC
Line: 128 shade is 0.0079 rather than nominal0.0079
Line: 128 shade is 0.008 rather than nominal0.008
.. lots of similar lines about shade.

Here are the scripts that failed:

FAIL: tests/validate-formats-on-disk.sh
FAIL: Magick++/tests/attributes.sh
FAIL: Magick++/tests/color.sh
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Accessing multi-frame image in Magick++

Post by magick »

We just ran the validation test on our Intel Mac Pro and they all passed without complaint. We're not sure why its failing for you.
blackhaz

Re: Accessing multi-frame image in Magick++

Post by blackhaz »

Could it because I am compiling Q32 HDRI mode?
Post Reply