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
SUMMARY

This discussion focuses on creating nxn noise images using Python and OpenGL, specifically for implementing line integral convolution with a vector field. The user shares a code snippet utilizing the random module to generate a 2D array of random values, emphasizing the need for further resources to convert this array into an image using OpenGL. Key references include Stack Overflow links for converting images to and from arrays using the Pillow library, although the user seeks OpenGL-specific methods for image generation.

PREREQUISITES
  • Python programming proficiency
  • Understanding of OpenGL for rendering graphics
  • Familiarity with the Pillow library for image manipulation
  • Basic knowledge of 2D arrays and random number generation
NEXT STEPS
  • Research "OpenGL texture mapping" for applying noise images in OpenGL
  • Learn "Pillow image processing" for converting arrays to images
  • Explore "PyOpenGL documentation" for OpenGL functions related to image rendering
  • Study "line integral convolution" techniques in computer graphics
USEFUL FOR

This discussion is beneficial for Python developers, graphics programmers, and anyone interested in generating procedural textures using OpenGL.

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
3K
  • · 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