comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to add 5% possion noise for a image in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to add 5% possion noise for a image in IDL [message #83996 is a reply to message #83995] Fri, 12 April 2013 04:29 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Friday, April 12, 2013 4:59:10 AM UTC-4, huiqian...@gmail.com wrote:
> Thank you for replying.

If you use poidev, adapted from Numerical Recipes,
(http://idlastro.gsfc.nasa.gov/ftp/pro/math/poidev.pro ) then you can simply write

im = im + 0.05*poidev(im)

The problem with using the POISSON keyword to RANDOMU is that it only accepts a scalar Poisson mean. So one has to iterate over each value in the image, and compute the Poisson random deviate for that value. Here is some quick (not well tested) code to do this:

function addpoisson,im, seed = seed
; return an image with each value replaced by a Poisson deviate
h = histogram(im, min=0, reverse=rr)
newim = im

for i = 0,N_elements(h)-1 do begin
if h[i] NE 0 then begin
sub = rr[rr[i]:rr[i+1]-1] ;Get subscripts
newim[sub] = randomu(seed,poisson=i)
endif
endfor

return, newim
end

--Wayne
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: plotting vertical lines
Next Topic: Spaces in Mac file names

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 08:37:17 PDT 2025

Total time taken to generate the page: 0.16104 seconds