c # – Wonky perlin noise

I am quite new to the wonderful world of "Procedural textures," and I am trying to create a double precision noise perlin algorithm.

I'm almost done, except for the fact that the coordinates seem to be off, any idea what I've done wrong? Here is the code:

``````
public static class Noise {
static int() p = new int(Convert.ToInt32(Math.Pow(2,16)));
public static vector2dDouble v1i;
public static vector2dDouble v2i;
public static vector2dDouble v3i;
public static vector2dDouble v4i;

public static double(,) GenerateNoiseMap(int mapWidth, int mapHeight, int seed, float scale, int octaves, float persistance, float lacunarity, Vector3 offset) {
double(,) noiseMap = new double(mapWidth, mapHeight);

System.Random prng = new System.Random(seed);
Vector2() octaveOffsets = new Vector2(octaves);
for (int i = 0; i < octaves; i++) {
float offsetX = prng.Next(-100000, 100000) + offset.x;
float offsetY = prng.Next(-100000, 100000) + offset.z;
octaveOffsets(i) = new Vector2(offsetX, offsetY);
}

if (scale <= 0) {
scale = 0.0001f;
}

float maxNoiseHeight = float.MinValue;
float minNoiseHeight = float.MaxValue;

float halfWidth = mapWidth / 2f;
float halfHeight = mapHeight / 2f;

for (int y = 0; y < mapHeight; y++) {
for (int x = 0; x < mapWidth; x++) {

float amplitude = 1;
float frequency = 1;
double noiseHeight = 0;

for (int i = 0; i < octaves; i++) {
double sampleX = (double)(x - halfWidth) / scale * frequency + octaveOffsets(i).x + 0.001;
double sampleY = (double)(y - halfHeight) / scale * frequency + octaveOffsets(i).y + 0.001;

double perlinValue = Noise2d(sampleX, sampleY);
noiseHeight += perlinValue * amplitude;
//Debug.Log(perlinValue);

amplitude *= persistance;
frequency *= lacunarity;
}

if (noiseHeight > maxNoiseHeight) {
maxNoiseHeight = (float)noiseHeight;
}
else if (noiseHeight < minNoiseHeight) {
minNoiseHeight = (float)noiseHeight;
}
noiseMap(x, y) = noiseHeight;
}
}

for (int y = 0; y < noiseMap.GetLength(1); y++) {
for (int x = 0; x < noiseMap.GetLength(0); x++) {
noiseMap(x, y) = (double)Mathf.InverseLerp(minNoiseHeight, maxNoiseHeight, (float)noiseMap(x, y));
}
}

(!(enter image description here)(1))(1)
return noiseMap;
}

public static void init(int seed) {
}

public static int() createGradients(int() p, int seed) {
System.Random prng = new System.Random(seed);
for (int i = 0; i < p.GetLength(0) / 2; i++) {
p(i) = prng.Next(0, 256);
p(i + ((int)p.GetLength(0) / 2)) = p(i);
}

return p;
}

int hash = val & 3;
switch (hash) {
case 0:
return new vector2dDouble(1.0, 1.0);
case 1:
return new vector2dDouble(-1.0, 1.0);
case 2:
return new vector2dDouble(-1.0, -1.0);
case 3:
return new vector2dDouble(1.0, -1.0);
default: return new vector2dDouble(0, 0);
}
}

static double Noise2d(double x, double y) {

int ix = Convert.ToInt32(Math.Floor(x)) & (p.GetLength(0) / 2 - 1);
int iy = Convert.ToInt32(Math.Floor(y)) & (p.GetLength(0) / 2 - 1);

x -= Math.Floor(x);
y -= Math.Floor(y);

vector2dDouble v1 = new vector2dDouble(x - 1, y),
v2 = new vector2dDouble(x - 1, y - 1),
v3 = new vector2dDouble(x, y),
v4 = new vector2dDouble(x, y - 1);

int g1 = p(p(ix + 1) + iy + 1),
g2 = p(p(ix) + iy + 1),
g3 = p(p(ix + 1) + iy),
g4 = p(p(ix)  + iy);

return lerp(u, lerp(v, f2, f4), lerp(v ,f1, f3));
}

static double lerp(double t, double argc, double argv) { return argc + t * (argv - argc); }

static double fade(double t) { return t * t * t * (t * (t * 6 - 15) + 10); }
}

(System.Serializable)
public struct vector2dDouble {
public double x, y;

public vector2dDouble(double argx, double argy) {
x = argx;
y = argy;
}

public double dot(vector2dDouble argc) {
argc.x *= x;
argc.y *= y;

return argc.x + argc.y;
}

public void print() {
Debug.Log(x + "," + y);
}
}

``````

procedure generation: how to generate a softer Perlin noise?

So, recently I have been learning things of procedure generation (specifically Perlin noise) and I have run into a wall.

This is the result that I have seen everyone, but this is what I am getting,

This is my code, (I am using python):

``````import random
import math
import PIL.Image

class Noise:

def __init__(self, x, y):
self.x = x
self.y = y

def lerp(self, start, stop, t):
return start*(1-t) + (stop*t)

def smoothstep(self, t):
return 3*(t**2) - 2*(t**3)

for _ in range(4):
x = random.randrange(0, 361)
y = random.randrange(0, 361)

def cvectors(self):
botleft = (self.x, self.y)
botright = (self.x-1, self.y)
topleft = (self.x, self.y-1)
topright = (self.x-1, self.y-1)
cvecs = (botleft, botright, topleft, topright)
return cvecs

def makenoise(self):
dot = ()
cvecs = self.cvectors()
for i in range(4):
(x, y) = cvecs(i)
dot.append((x*a)+(y*b))
st = self.lerp(dot(0), dot(1), self.smoothstep(x))
uv = self.lerp(dot(2), dot(3), self.smoothstep(x))
stuv = self.lerp(st, uv, self.smoothstep(self.y))
return stuv

size = 128
img = PIL.Image.new('L', (size, size))
for x in range(size):
for y in range(size):
perlin = Noise(random.uniform(0, 1), random.uniform(0, 1))
img.putpixel(tuple((x, y)), perlin.makenoise())
img.save("nois.png")
``````

This is only an assumption, but I feel it is a problem of scale. Thanks in advance and apologies also for the horrible code.

Stochastic integrals: how to demonstrate this identity related to random noise

I find this identity but I can't understand it. Can anyone help me prove it or at least give a heuristic explanation?

$$E_ xi ( exp { { int_a ^ b xi (t) v (t) dt }}) = exp { { frac {D} {2} int_a ^ bv ^ 2 ( t) dt }}$$ where $$xi (t)$$ is the random noise with $$E_ xi ( xi (t_1) xi (t_2)) = D delta (t_1-t_2)$$ Y $$v$$ It is soft enough.

It seems to be a standard result, and should have appeared (I suppose) in some textbooks. I would appreciate if someone can recommend me a book (or introductory paper). In fact, I am reading an introductory document on the theory of random matrices and I get stuck here.

hard drive: click noise on the laptop's internal hard drive

I have a Lenovo Legion Y520 purchased 1.5 years ago and it contains a 256GB SSD and a 2TB HDD. Random click noises were noticed on the laptop that stopped after a few minutes. I also noticed that any startup after shutdown used to take much longer. I only noticed today that my laptop's 2TB hard drive was not being detected at all.

I tried to restart the laptop, but despite leaving it for 15 minutes, I got nothing. Turning it off and on works, but it still takes more than 3 minutes and makes a lot of clicking noises (which stop after a while).

I tried plugging my external HDD today and noticed click errors from the HDD too!

How much ISO noise can be eliminated in the publication?

I was experimenting with taking pictures of the moon using a 1000mm MTO-11ca lens and I thought I should get even closer by adding a teleconverter (Kenko Pro 300 3x). The image quality is not clear, but by using a very high ISO (25,000) and a fast shutter speed 1/2500 I was able to get rid of the worst blur (I was shooting on a tripod but I think the atmospheric effects moved the moon inside and out of focus).

As expected, the images where VERY noisy links bellowed. Usually, I only go up to ISO 1600 reluctantly (Canon 5D Mark II).

Full size JPG
RAW full size

How much can be saved with such noisy images? I was testing both Digikam and RawTherapee, but I didn't find any noise elimination algorithm that made any difference. I would have expected the noise removal to at least stain the image and kill the noise even if it didn't recover the details.

What is the best that can be done in these cases?

How can I calculate the frequencies of the sinusoidal signal from a sinusoidal signal + noise and its Fourier transform graphs?

I want to calculate the frequency of the two sinusoidal peaks in the following graph, but I really don't know how to do it.

So far I just know that the signal is $$f (k) = sin (k) + n (k)$$ of the description and that the duration of the signal is 255 seconds with 255 discrete values. How can I calculate the peaks from the right side (that is, the frequency of this sine wave should be a little less than 50 from the left peak)

By the way, the frequencies on the right are changed to (0.255) instead of (-128.127) just to avoid confusion

signal processing – Channel noise – An inappropriate name?

I was discussing with a colleague with experience in communication about the noise of the Gaussian white channel (WG). He said the channel does not add noise and that it is just an inappropriate name. The receiver adds the noise, which is thermal noise. The channel will only introduce fading, not noise. I was surprised, since I studied in many textbooks that the channel adds WG noise to the transmitted signal. Is this correct? Please help me understand this.

noise related to quantum cryptography

How would you define noise when talking about quantum cryptography?

Is it correct to say that, since quantum states are susceptible to interaction with the environment, there may be errors in the generation process and in the orientation of the base states?

If that's right (if that's really noise), can Eva (listen) take advantage of that … I mean, because of the noise?

Thanks a lot

raw – How do cameras convert colorful noise into colorless?

Modern phones have amazing data processing from their cameras. For example, the raw image following a sculpture in a park after sunset (demonstrated with the IGV method in RawTherapee and developed in the "Neutral" profile) has a colorful noise, which is completely colorless in the JPEG shot of the same scene with the same parameters (shots made with RAW + JPEG mode in OpenCamera). The photos were taken with Samsung Galaxy A320F / DS with f / 1.9 aperture, 1 / 16s shutter and ISO 2149. I have also seen similar processing on the Raspberry Pi V2.1 camera (Sony IMX219), and many of the modern DSLRs . It seems that it also lacks any colorful noise in its JPEG files, even having colorless noise.

I wonder, what algorithms are used to achieve such conversion of colorful to colorless noise? Is it a demonstration of high optimized ISO? Or is it a special noise elimination algorithm applied after the demonstration? Or something else?

Raw:

JPEG:

noise – loud sky with Nikon d600

I have a question about the shot I attached. I tried to take a picture of this landscape, but no matter how I played with the iso, reaching as low as 400, the sky looks really grainy if it expands even a little.
Also, the hill feels a bit out of focus even though it was what I was really focusing on, since the camera didn't focus on the sky. What did I blatantly wrong?