Page 2 of 2
Re: -fx in Magick++
Posted: 2013-11-20T03:21:51-07:00
by smajler
I'm trying to do as you said using composite, 50% of script is done, now i have a problem with adding noise. I've found there is function:
Code: Select all
Image.addNoise(MagickCore::NoiseType)
but i'd like to add my own noise like noise=1. Is there any function to add specified noise?
Re: -fx in Magick++
Posted: 2013-11-20T05:00:04-07:00
by dlemstra
What do you mean by noise=1? Maybe you are better off modifying the pixels yourself. You can use the Pixels class to read/write the pixels of your image.
Re: -fx in Magick++
Posted: 2013-11-20T06:13:09-07:00
by smajler
Code: Select all
noise=1
convert convolve_kernel.png -roll -64-64 -fft ( -clone 0 -crop 1x1+64+64 +repage -scale 128x128 -clone 0 -compose
divide -composite ) -swap 0 +delete ( cameraman_convolve_2.png -fft ) ( -clone 0 -evaluate add noise -clone 2 -
compose divide -composite ) ( -clone 1,3 -compose subtract -background gray50 -flatten ) -delete 0--3 -ift
cameraman_deconvolve_2.png
Adding noise like here to avoid dividing by 0. Yes i can add 1 to every pixel channel but it would be slow and i thought there is a function to do this.
Re: -fx in Magick++
Posted: 2013-11-20T10:57:01-07:00
by fmw42
with deconvolution such as this the noise value estimate will more likely be a very small fraction such 0.0001. You need to adjust the value by factors of about 5 to 10 to find which value gives you the best results.
Re: -fx in Magick++
Posted: 2013-12-02T05:23:00-07:00
by smajler
Can anybody tell me how to write this line in cpp?
Code: Select all
-clone 1,3 -compose subtract -background gray50 -flatten
I can to a subtract:
Code: Select all
Image img1;
Image img2;
img1.composite(img2,0,0,ModulusSubtractCompositeOp);
but how to do a rest o line: