Skip to content

Matlab crash after using 'noise' (poisson) on a simple test image #83

@tmtenbrink

Description

@tmtenbrink

Component
DIPimage (DIPlib 3.0.0 release, https://github.com/DIPlib/diplib/releases/tag/3.0.0), compiled from source

Describe the bug
I am testing some Matlab code for Fourier Ring Correlation, but when attempting to use the noise function with 'poisson' as noise_type on a simple test image, Matlab itself crashes. Guassian does seem to work, so it seems to be a specific problem with poisson. When the function is executed, Matlab freezes and a Microsoft Visual C++ Runtime Library error window pops up, describing some additional details. It seems like an invalid mean is passed to the random poisson function. See the image below.

Screenshot 2021-09-13 143149

The buttons are not clickable as Matlab crashes and exits after a few seconds.

To Reproduce

  1. Create a simple test image a = (yy('corner'))*sin((xx('corner'))^2/300);
  2. Run the poisson noise function on it a1 = noise(a,'poisson',1); %shotnoise 1

I also tested this by importing a TIFF image, which fails in the same way.

System information:

  • What OS do you have? Windows 10
  • If DIPimage, what version of MATLAB do you have? MATLAB Version: 9.10.0.1739362 (R2021a) Update 5
  • If compiled from sources, what compiler and version did you use? I used CMake 3.21.2 with Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29915 for x64 (Microsoft Visual Studio 16 2019)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions