Image related functions. More...
#include <math.h>
#include <stdlib.h>
#include "mightymandel.h"
#include "image.h"
#include "texture.h"
Go to the source code of this file.
Functions | |
int | cmp_pixel (const void *a, const void *b) |
Compare pixel iteration counts and error counts. | |
float * | image_get_glitched (int width, int height) |
Download image glitch flags from OpenGL. | |
float * | image_get_iterations (int width, int height) |
Download image iteration counts from OpenGL. | |
unsigned char * | image_erode (const unsigned char *data, int width, int height) |
Erode a binary image. | |
struct pixel * | image_find_peak_glitches (const float *glitched, const float *iterations, int width, int height, int *count) |
Find the highest iteration count glitched pixels. | |
enum result_t | image_result (int width, int height, double *iterations, double *exterior, double *interior, double *glitch) |
Image related functions.
Definition in file image.c.
int cmp_pixel | ( | const void * | a, |
const void * | b | ||
) |
Compare pixel iteration counts and error counts.
For use in qsort()
, larger iteration counts compare earlier, same iteration count has larger error count comparing earlier.
a | The first pixel. |
b | The second pixel. |
Definition at line 28 of file image.c.
References pixel::e, and pixel::n.
Referenced by image_find_peak_glitches().
unsigned char* image_erode | ( | const unsigned char * | data, |
int | width, | ||
int | height | ||
) |
Erode a binary image.
See https://en.wikipedia.org/wiki/Erosion_%28morphology%29. The result should be free()
d when no longer needed.
data | The input image. |
width | The image width. |
height | The image height. |
|
read |
Find the highest iteration count glitched pixels.
The result should be free()
d when no longer needed.
glitched | The glitch count image. |
iterations | The iteration count image. |
width | The image width. |
height | The image height. |
count | The number of glitched pixels is stored here. |
Definition at line 140 of file image.c.
References cmp_pixel(), pixel::e, pixel::i, pixel::j, and pixel::n.
float* image_get_glitched | ( | int | width, |
int | height | ||
) |
Download image glitch flags from OpenGL.
Uses the currently bound texture, assumes glitch is in alpha. The result should be free()
d when no longer needed.
width | The width of the texture. |
height | The height of the texture. |
Definition at line 49 of file image.c.
References pixel::i, pixel::j, and TEX_RAW.
Referenced by find_ref().
float* image_get_iterations | ( | int | width, |
int | height | ||
) |
Download image iteration counts from OpenGL.
Uses the currently bound textures, assumes iteration count is in red. The result should be free()
d when no longer needed.
width | The width of the texture. |
height | The height of the texture. |
enum result_t image_result | ( | int | width, |
int | height, | ||
double * | iterations, | ||
double * | exterior, | ||
double * | interior, | ||
double * | glitch | ||
) |
Definition at line 161 of file image.c.
References pixel::i, pixel::j, result_glitch, result_ok, and TEX_RAW.
Referenced by collect_metadata_to_string(), and render_display().