Generating Clouds

Prerequisites

Open Simplex Noise To Mat Show

Generating a Linear Gradient Show

Fractal Open Simplex Noise To Mat Show

recoloring noise Show

Generating Clouds

Introduction

  • Generates clouds by using fractal open simplex noise, and recolors it using openCV/EmguCV

Code

static void Main(string[] args)
{
    Color lightBlue = Color.FromArgb(67, 150, 228);
    Color darkBlue = Color.FromArgb(53, 120, 182);
    Mat sky = CreateLinearGradient(500, lightBlue, darkBlue);
    
    //convert from a single row to a single column
    CvInvoke.Transpose(sky, sky);

    CvInvoke.Resize(sky, sky, new Size(500, 500));

    Mat clouds = GetFractalOpenSimplexNoise(500, 500, 1 / 128f, 3, 0.5f);

    //sharpen
    CvInvoke.AddWeighted(clouds, 1, clouds, 0.5, -255 * 0.5, clouds);

    //recolor
    SetToWithAlphaMask(sky, sky, new MCvScalar(255, 255, 255), clouds);
    
    CvInvoke.Imshow("test", sky);
    CvInvoke.WaitKey(0);
}

Output