CWO++library  0.32
 All Classes Functions Variables Groups
simple_diffraction.cpp

This code is to calculate diffraction using the angular spectrum method.

lena512x512_diffract.jpg
#include "cwo.h"
int main()
{
CWO a;
a.Load("sample.bmp"); //Load image file
a.Diffract(0.1, CWO_ANGULAR); //Calculate diffraction from the image using the angular spectrum method
a.Intensity(); //Calculate the light intensity from the diffracted result
a.Scale(255); // Convert the intensity to 255-steps data
a.Save("diffract.bmp"); //Save the intensity as bitmap file
}