How to cache noise?

I am working on a project that loops through every pixel in an image, and performs two noise functions in each iterations of the loop. It does this every frame. As you may to able to imagine, this is quite slow.
I am looking for a way to speed this process up, so it can work more similarly to real time. One of the solutions that seems to be recommended while going through forum posts is caching the noise. But I am unsure of how exactly to go down that route. Are there any good examples of how to do something like this?

I get the general idea I think. I am able take my current noise functions and create a 2D image representation of it.
Than I read that instead of using a noise function in my project.
Right?
But the details are not clear. How do I make reading a noise image work similarly to how a noise function works?

Any examples are greatly appreciated. Or maybe caching isn’t the right route?

You’re on the right path. Since you have the noise image, you get its pixels, they are the noise values.

Something like float noiseImg(float xin, float yin, float outmin, float outmax) { ofColor c = img.get((int)xin,(int)yin); return ofMap(c.g, 0, 255, outmin, outmax); } outh to do the trick

Hello I have an example of writing noise to an image here https://github.com/petewerner/generative/blob/master/noise1/src/testApp.cpp

Perlin noise scales very well, so you can render your noise image a lot smaller than your apps render size.

For reading, you need to map your apps x/y to the noise image x/y. If they are the same size this is easy, otherwise you can scale them with something like

int noisex = ofMap(x, 0, render_w, 0,  noise_w) 
int noisey = ofMap(y, 0, render_h, 0, noise_h) 
float noiseval = noiseImg.getPixels()[noisex + noisey * noise_h]

or something like that it’s been a while since ive done it.

If you want the noise to be changing every frame you can rebuild the noise image every frame (scaled down helps), or theres a bunch of ways you can do it but they are a bit more involved.

Thanks for the replies guys! Its steered me in a good direction.
Tomorrow Ill try to implement it, and let you know how it goes.