noise

Issue with Perlin Noise in Java

廉价感情. 提交于 2019-12-06 07:36:44
问题 So I'm trying to generate perlin noise and save it to an image file. I've got the image being saved correctly but the noise doesn't really look like perlin noise. Here's my code: package com.egs.survivalsim.util; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import com.egs.survivalsim.MainComponent; public class Noise { MainComponent main; public double noise(int x,int y){ x = x + y * 57; x = ((x <<

Adding poisson noise to an image

无人久伴 提交于 2019-12-06 07:33:14
问题 I have some images that I need to add incremental amounts of Poisson noise to in order to more thoroughly analyze them. I know you can do this in MATLAB, but how do you go about doing it in Python? Searches have yielded nothing so far. 回答1: If numpy/scipy are available to you, then the following should help. I recommend that you cast the arrays to float for intermediate computations then cast back to uint8 for output/display purposes. As poisson noise is all >=0, you will need to decide how

Calculate SNR in single image in MATLAB

不想你离开。 提交于 2019-12-06 07:22:21
I have this image: I want to calculate SNR in it. For this i used code: img=imread('noicy.JPG'); img=double(img(:)); ima=max(img(:)); imi=min(img(:)); ims=std(img(:)); snr=20*log10((ima-imi)./ims) Is that correct code to calculate SNR? The definition of SNR can be found here or here : Both the standard and the industry definition can be used ( 10log(x) and 20log(x) ). check this now, the signal is equal to the mean of the pixel values ( mean(img(:)) ) and the noise is the standard deviation or error value of the pixel values ( std(img(:)) ). You may use either the ratio or the SNR=10*log10

Per-Vertex Normals from perlin noise?

谁说胖子不能爱 提交于 2019-12-05 22:13:03
问题 I'm generating terrain in Opengl geometry shader and am having trouble calculating normals for lighting. I'm generating the terrain dynamically each frame with a perlin noise function implemented in the geometry shader. Because of this, I need an efficient way to calculate normals per-vertex based on the noise function (no texture or anything). I am able to take cross product of 2 side to get face normals, but they are generated dynamically with the geometry so I cannot then go back and

How to plot blurred points in Matplotlib

和自甴很熟 提交于 2019-12-05 03:27:15
As the question says, I'm looking for a way to plot blurred points using Matplotlib. I don't want to plot a set of points and then apply a filter to blurry the whole image. Instead of it, I would like to plot a set of points, each of them with an associated level of blur. Thank you in advance. Here's another work around. You can display an image at each location instead of a marker using a BboxImage . That way you can blur or manipulate the image any way you want. This tutorial has more about BboxImages . import matplotlib.pyplot as plt from scipy import ndimage from matplotlib.image import

How to add and remove noise from an image

折月煮酒 提交于 2019-12-04 19:38:59
I want to add gaussian noise to a 256x256 greyscale image and then remove it. I tried doing using the following code but all I get is an image which has noise alone. Is it possible to completely remove the noise from the image? And if not to what extent can gaussian noise be reduced? P =0; %mean Q =0.01; %variance R = imnoise(L,'gaussian',P,Q); %L-image subplot(2,1,1); imshow(R); title('Gaussian Noise'); U = conv2(double(R), ones(3)/9, 'same'); U1=uint8(U); subplot(2,1,2); imshow(U1); title('Median Filtered Image'); I'm planning to implement addition and removal of Poisson noise and Salt and

Per-Vertex Normals from perlin noise?

假如想象 提交于 2019-12-04 03:12:48
I'm generating terrain in Opengl geometry shader and am having trouble calculating normals for lighting. I'm generating the terrain dynamically each frame with a perlin noise function implemented in the geometry shader. Because of this, I need an efficient way to calculate normals per-vertex based on the noise function (no texture or anything). I am able to take cross product of 2 side to get face normals, but they are generated dynamically with the geometry so I cannot then go back and smooth the face normals for vertex normals. How can I get vertex normals on the fly just using the noise

2D Perlin Noise

橙三吉。 提交于 2019-12-03 11:42:49
问题 I have fully mastered the art of Perlin Noise in 3D, and now I'm trying to use my same implementation for a 2D algorithm. The problem seems to be in picking my gradient directions. In 3D I use 16 gradients in evenly distributed directions and this works great. In 2D I figured I'd use 8 gradients. up, down, left, right, and the four diagonal directions. Here is what I get: The general look of the noise is always correct, but the edges of the squares don't quite match up. I have also tried

Query noise level in Android

妖精的绣舞 提交于 2019-12-03 07:44:02
问题 I want to develop a small Android app to measure the current noise level (probablyin dB). But I have no idea what to look for in the libs. I don't want to record the noise. Can someone give me a pointer what classes to look at? 回答1: I recommend looking in these classes: android.media.AudioFormat android.media.AudioManager android.media.AudioTrack We used them in the Blinkendroid audio package a short while ago. 回答2: For me ' maxAmplitude ' was not helpful. After day of researching I

Generating 3D noise quickly in python

痞子三分冷 提交于 2019-12-03 06:30:24
I need a method to generate 3D simplex noise in python rather quickly. What methods are there out there to solve this problem? $ pip install noise http://pypi.python.org/pypi/noise/ This package is designed to give you simple to use, fast functions for generating Perlin noise in your Python programs. Perlin noise is famously called the "salt" of procedural generation, as it adds considerable flavor in its application. Noise is commonly used for imparting realism in textures, animation and other procedural content generation -- placement of hairs, heights of mountains, density of forests,