Go to the documentation of this file.
39 #define DEFAULT_ALIGNMENT_U8X4 64
50 if ((stride % alignment) != 0)
51 stride += alignment - (stride % alignment);
53 uint8_t *buf = calloc(height*stride,
sizeof(uint8_t));
56 image_u8x4_t tmp = { .
width = width, .height = height, .stride = stride, .buf = buf };
65 uint8_t *buf = malloc(in->
height*in->
stride*
sizeof(uint8_t));
96 for (
int x = 0; x <
pam->
width; x++) {
103 for (
int x = 0; x <
pam->
width; x++) {
139 for (
int y = 0; y < im.
height; y++) {
140 for (
int x = 0; x < im.
width; x++) {
159 for (
int y = 0; y < im.
height; y++) {
160 for (
int x = 0; x < im.
width; x++) {
186 FILE *f = fopen(path,
"wb");
195 fprintf(f,
"P6\n%d %d\n255\n", im.
width, im.
height);
197 for (
int y = im.
height-1; y >= 0; y--) {
198 for (
int x = 0; x < im.
width; x++) {
200 uint8_t r = im.
buf[y*im.
stride + 4*x + 0];
201 uint8_t g = im.
buf[y*im.
stride + 4*x + 1];
202 uint8_t b = im.
buf[y*im.
stride + 4*x + 2];
219 FILE *f = fopen(path,
"w");
221 fprintf(f,
"WIDTH %d\n", im->
width);
222 fprintf(f,
"HEIGHT %d\n", im->
height);
223 fprintf(f,
"DEPTH 4\n");
224 fprintf(f,
"MAXVAL 255\n");
225 fprintf(f,
"TUPLTYPE RGB_ALPHA\n");
226 fprintf(f,
"ENDHDR\n");
228 for (
int y = 0; y < im->
height; y++)
void image_u8x4_destroy(image_u8x4_t *im)
image_u8x4_t * image_u8x4_create_from_pnm(const char *path)
pam_t * pam_create_from_file(const char *inpath)
image_u8x4_t * image_u8x4_copy(const image_u8x4_t *in)
image_u8x4_t * image_u8x4_create_alignment(unsigned int width, unsigned int height, unsigned int alignment)
image_u8x4_t * image_u8x4_create(unsigned int width, unsigned int height)
pnm_t * pnm_create_from_file(const char *path)
void pnm_destroy(pnm_t *pnm)
image_u8x4_t * image_u8x4_create_from_pam(const char *inpath)
void pam_destroy(pam_t *pam)
int image_u8x4_write_pnm(const image_u8x4_t *imp, const char *path)
#define DEFAULT_ALIGNMENT_U8X4
void image_u8x4_write_pam(const image_u8x4_t *im, const char *path)
apriltag
Author(s): Edwin Olson
, Max Krogius
autogenerated on Sun Apr 20 2025 02:08:19