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

More generalized noise #35

Open
hughesadam87 opened this issue Feb 17, 2014 · 1 comment
Open

More generalized noise #35

hughesadam87 opened this issue Feb 17, 2014 · 1 comment

Comments

@hughesadam87
Copy link
Owner

There are several generalizations to improve noise.

First, the "multicolor" and the "color" are just numpy.random distributions applied to gray and rgb images. They could be consolidated into a single call if you build a general function for mapping a numpy distribution to a rgb and gray image. This is partially done in "normal".

In this new framework, normal and "color (maybe rename random)" would just be promotions of 2 most common noises. Normal has some keywords that make calling the numpy API more intuitive, but in general, any distribution should be accessible with "size" being the only keyword auto-set. Just need a general parser for 1-channel and 3-channel. The _parse_intensity is ok for single intensities, but it would be better if the distribution returned the desired array, then we just masked based on xmin, xmax (see the normal() function for this step) so that nosie doesn't exceed the datatypes allowed.

@hughesadam87
Copy link
Owner Author

Thinking about this a big more, should also optionally be able to return just noise. Maybe I scrap passing the image directly and just return noise based on dimensions of an image.

noise = normal_noisy(img.shape, blah)
noisyimg = img + noise

How bout this, if I pass in img, noise added to img. If I pass in shape, noise returned.

Maybe noise should always be rgb, but I can specify type conversion

normal_noisy(img.shape, 'gray')

I dunno...

Then maybe a nice interface would be for canvas to have an add_noise() feature that wraps function calls and stores noise separatly.

canvas.add_noise('gaussian', **kwargs)

Ya, probably this is the best way, then just refactor notebooks. In the notebooks that use noise, I need to extract the noise anyway, and that just turns out to be a pain in the ass.

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

No branches or pull requests

1 participant