A High-Dynamic-Range 2D image. This class has 3 members:
Width | number (int) of columns in the 2D matrix of colors |
Height | number (int) of rows in the 2D matrix of colors |
Pixel | the 2D matrix (array of Color ), represented as a 1D array |
More...
|
| HdrImage (int WidthConstr, int HeightConstr, Color[]? pixels=null) |
| Constructor, empty or with pixels. More...
|
|
bool | ValidCoord (int x, int y) |
| Check that given coordinates have values between 0 and the number of rows / columns. More...
|
|
void | SetPixel (int x, int y, Color newCol) |
| Sets the color of a pixel of given coordinates. More...
|
|
Color | GetPixel (int x, int y) |
| Given a pair of coordinates, it returns the color of the corresponding pixel. More...
|
|
HdrImage | ReadPFMFile (Stream input) |
| Function that reads a PFM file and writes the content to a new HDR image. More...
|
|
string | ReadLine (Stream input) |
| Reads a line of a stream. More...
|
|
int[] | ParseImgSize (string str) |
| Image size reading function. More...
|
|
int | ParseEndianness (string input) |
| Reads the endianness and returns if it is little or big. More...
|
|
void | WritePFMFile (Stream output, Endianness endian) |
| Function that writes a PFM file from an HDR image. More...
|
|
float | AverageLum (double delta=1e-10) |
| Returns the average brightness of the image. The delta parameter is used to prevent numerical problems for underilluminated pixels. More...
|
|
void | NormalizeImage (float factor, float? luminosity=null) |
| Calculate the average brightness of an image according to the axRi / <l> formula. More...
|
|
float | ClampFloat (float x) |
| Maps a float from [0, + inf) to [0,1]. More...
|
|
void | ClampImage () |
| Apply correction for bright spots.
|
|
void | WriteLdrImage (String output, String format, float gamma=1.0f) |
| Convert an HDR image to LDR format. Before calling this function, you should apply a tone-mapping algorithm to the image and be sure that the R, G, and B values of the colors in the image are all in the range [0, 1]. Use HdrImage.NormalizeImage and HdrImage.ClampImage to do this. More...
|
|
|
static float | ReadFloat (Stream input, Endianness end) |
| Reads a 32-bit sequence from a stream and converts it to a floating-point number. More...
|
|
|
int | Width |
|
int | Height |
|
Color[] | Pixels |
|
|
int | PixelOffset (int x, int y) |
| Given a pair of coordinates, it returns the position of the pixel in the storage vector. More...
|
|
|
static void | WriteFloat (Stream outputStream, float value, Endianness end) |
| Method of writing a 32-bit floating-point number in binary. More...
|
|
A High-Dynamic-Range 2D image. This class has 3 members:
Width | number (int) of columns in the 2D matrix of colors |
Height | number (int) of rows in the 2D matrix of colors |
Pixel | the 2D matrix (array of Color ), represented as a 1D array |
◆ HdrImage()
PGENLib.HdrImage.HdrImage |
( |
int |
WidthConstr, |
|
|
int |
HeightConstr, |
|
|
Color?[] |
pixels = null |
|
) |
| |
Constructor, empty or with pixels.
- Parameters
-
WidthConstr | |
HeightConstr | |
pixels | |
◆ AverageLum()
float PGENLib.HdrImage.AverageLum |
( |
double |
delta = 1e-10 | ) |
|
Returns the average brightness of the image. The delta
parameter is used to prevent numerical problems for underilluminated pixels.
- Parameters
-
- Returns
◆ ClampFloat()
float PGENLib.HdrImage.ClampFloat |
( |
float |
x | ) |
|
Maps a float from [0, + inf) to [0,1].
- Parameters
-
- Returns
◆ GetPixel()
Color PGENLib.HdrImage.GetPixel |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Given a pair of coordinates, it returns the color of the corresponding pixel.
- Parameters
-
- Returns
- Pixel's Color in coordinates (x,y)
◆ NormalizeImage()
void PGENLib.HdrImage.NormalizeImage |
( |
float |
factor, |
|
|
float? |
luminosity = null |
|
) |
| |
Calculate the average brightness of an image according to the axRi / <l> formula.
- Parameters
-
◆ ParseEndianness()
int PGENLib.HdrImage.ParseEndianness |
( |
string |
input | ) |
|
Reads the endianness and returns if it is little or big.
- Parameters
-
- Returns
- +1 if endianness=big or -1 if endianness=small
◆ ParseImgSize()
int[] PGENLib.HdrImage.ParseImgSize |
( |
string |
str | ) |
|
Image size reading function.
- Parameters
-
- Returns
- int[2] containing Width and Height
◆ PixelOffset()
int PGENLib.HdrImage.PixelOffset |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
private |
Given a pair of coordinates, it returns the position of the pixel in the storage vector.
- Parameters
-
- Returns
- the position in the 1D array of the specified pixel
◆ ReadFloat()
static float PGENLib.HdrImage.ReadFloat |
( |
Stream |
input, |
|
|
Endianness |
end |
|
) |
| |
|
static |
Reads a 32-bit sequence from a stream and converts it to a floating-point number.
- Parameters
-
input | Stream |
end | Endianness |
- Returns
- float
◆ ReadLine()
string PGENLib.HdrImage.ReadLine |
( |
Stream |
input | ) |
|
Reads a line of a stream.
- Parameters
-
- Returns
- String containing the line of the input stream
◆ ReadPFMFile()
HdrImage PGENLib.HdrImage.ReadPFMFile |
( |
Stream |
input | ) |
|
Function that reads a PFM file and writes the content to a new HDR image.
- Parameters
-
- Returns
- a
HdrImage
object containing the image. If an error occurs, raise a InvalidPfmFileFormat
exception.
◆ SetPixel()
void PGENLib.HdrImage.SetPixel |
( |
int |
x, |
|
|
int |
y, |
|
|
Color |
newCol |
|
) |
| |
Sets the color of a pixel of given coordinates.
- Parameters
-
x | type int |
y | type int |
newCol | type Color |
◆ ValidCoord()
bool PGENLib.HdrImage.ValidCoord |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Check that given coordinates have values between 0 and the number of rows / columns.
- Parameters
-
- Returns
- True if
(x, y)
are coordinates within the 2D matrix
◆ WriteFloat()
static void PGENLib.HdrImage.WriteFloat |
( |
Stream |
outputStream, |
|
|
float |
value, |
|
|
Endianness |
end |
|
) |
| |
|
staticprivate |
Method of writing a 32-bit floating-point number in binary.
- Parameters
-
◆ WriteLdrImage()
void PGENLib.HdrImage.WriteLdrImage |
( |
String |
output, |
|
|
String |
format, |
|
|
float |
gamma = 1.0f |
|
) |
| |
Convert an HDR image to LDR format. Before calling this function, you should apply a tone-mapping algorithm to the image and be sure that the R, G, and B values of the colors in the image are all in the range [0, 1]. Use HdrImage.NormalizeImage
and HdrImage.ClampImage
to do this.
- Parameters
-
◆ WritePFMFile()
void PGENLib.HdrImage.WritePFMFile |
( |
Stream |
output, |
|
|
Endianness |
endian |
|
) |
| |
Function that writes a PFM file from an HDR image.
- Parameters
-
The documentation for this class was generated from the following file:
- /Users/fra/Documenti/Università/Magistrale/SNIF/PhotoGENius/PGENLib/HdrImage.cs