Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter/addPoissonNoise hangs up with large pixel values #641

Open
bthoughton opened this issue Feb 15, 2022 · 0 comments
Open

filter/addPoissonNoise hangs up with large pixel values #641

bthoughton opened this issue Feb 15, 2022 · 0 comments

Comments

@bthoughton
Copy link

Hello,

I have been working on a project for the NIH that uses pyimagej to run ImageJ ops from python. Yesterday I was working on developing a plugin which calls the filter-addpoissonnoise op. During testing I determined that the op would hang up seemingly doing nothing when the input images had large pixel values. I believe this problem can be summarized as a precision/underflow problem when very large lambda values (expected number of successes in a given interval) are introduced to the Knuth algorithm. This has been documented before in wiki's Generating Poisson-distributed random variables section. As lambda becomes large exp(-lambda) approaches 0 and becomes so small it is evaluated as exactly 0. This value is checked in a while loop against another value which is never less than 0: while p >= L: do stuff where L = 0 and p is never less than 0. Therefore the loop runs forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant