Creating noise images with Python and OpenGL

  • Context: Python 
  • Thread starter Thread starter Avatrin
  • Start date Start date
  • Tags Tags
    Images Noise Python
Click For Summary

Discussion Overview

The discussion revolves around creating noise images using Python and OpenGL, specifically focusing on generating an nxn noise image as a preliminary step for line integral convolution with a vector field. Participants seek resources, tutorials, and examples related to this topic.

Discussion Character

  • Exploratory, Technical explanation, Homework-related

Main Points Raised

  • One participant inquires about tutorials or books for creating an nxn noise image using OpenGL.
  • Another participant provides a code snippet for generating a 2D array of random values, suggesting that the range of values can be adjusted.
  • A participant expresses that the provided code does not output an image and reiterates the need for a tutorial or book specifically for OpenGL.
  • Participants share links to Stack Overflow posts that demonstrate converting images to and from arrays, but one participant notes that these examples utilize the Pillow library rather than OpenGL.
  • Another participant offers a link to an example that combines Pillow and OpenGL, attempting to address the original request.

Areas of Agreement / Disagreement

There is no consensus on how to create noise images specifically with OpenGL, as participants have differing focuses on using Pillow and the need for OpenGL-specific resources.

Contextual Notes

Participants have not resolved the specific requirements for generating images with OpenGL, and there are limitations in the provided examples regarding their applicability to the original question.

Avatrin
Messages
242
Reaction score
6
Hi

I am learning how to do a line integral convolution with OpenGL given a vector field. So, as a first step, I need to learn how to create an nxn noise image. Are there any good tutorials/books I can use to learn how to do this?
 
Technology news on Phys.org
Here's one way:

Python:
import random
n=3
nxn = [[random.random() for i in range(n)] for j in range(n)]

You can replace random.random() with an expression to magnify the random values as random.random() values vary from 0.0 to 1.0

so 5*randomrandom() will give you a spread of 0.0 to 5.0

and (5*randomrandom()+3) will give you a range of 3.0 to 8.0 as examples.
 
  • Skeptical
Likes   Reactions: Avatrin
Alright, but this doesn't output an image. That's why I am asking for a tutorial or a book; I am not sure a forum post is going to tell me how to create images with OpenGL.
 

Similar threads

Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 17 ·
Replies
17
Views
2K
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
5
Views
2K