Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
*.mat
*.swp
*.swo

bin/
*.sublime-project
*.sublime-workspace
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ CFLAGS = -std=gnu99 -Wall -Wno-unused-parameter -Wno-unused-function -pthread -I
LDFLAGS = -lpthread -lm

APRILTAG_OBJS = apriltag.o apriltag_quad_thresh.o tag16h5.o tag25h7.o tag25h9.o tag36h10.o tag36h11.o tag36artoolkit.o g2d.o common/zarray.o common/zhash.o common/zmaxheap.o common/unionfind.o common/matd.o common/image_u8.o common/pnm.o common/image_f32.o common/image_u32.o common/workerpool.o common/time_util.o common/svd22.o common/homography.o common/string_util.o common/getopt.o
BIN_DIR = bin

LIBAPRILTAG := libapriltag.a


all: $(LIBAPRILTAG) apriltag_demo


Expand All @@ -17,12 +19,13 @@ $(LIBAPRILTAG): $(APRILTAG_OBJS)

apriltag_demo: apriltag_demo.o
@echo " [$@]"
@$(CC) -o $@ apriltag_demo.o $(APRILTAG_OBJS) $(LDFLAGS)
mkdir $(BIN_DIR)
@$(CC) -o $(BIN_DIR)/$@ apriltag_demo.o $(APRILTAG_OBJS) $(LDFLAGS)

%.o: %.c
@echo " $@"
@$(CC) -o $@ -c $< $(CFLAGS)

.PHONY: clean
clean:
@rm -rf *.o common/*.o $(LIBAPRILTAG) apriltag_demo
@rm -rf *.o common/*.o $(LIBAPRILTAG) bin
13 changes: 13 additions & 0 deletions common/image_u8.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,19 @@ image_u8_t *image_u8_create_from_f32(image_f32_t *fim)
return im;
}

image_u8_t *image_u8_create_from_gray(int w, int h, uint8_t *image_matrix)
{
image_u8_t *im = image_u8_create(w, h);

for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
im->buf[y*im->stride + x] = image_matrix[y*im->stride + x];
}
}

return im;
}


int image_u8_write_pnm(const image_u8_t *im, const char *path)
{
Expand Down
1 change: 1 addition & 0 deletions common/image_u8.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ image_u8_t *image_u8_create(unsigned int width, unsigned int height);
image_u8_t *image_u8_create_alignment(unsigned int width, unsigned int height, unsigned int alignment);
image_u8_t *image_u8_create_from_rgb3(int width, int height, uint8_t *rgb, int stride);
image_u8_t *image_u8_create_from_f32(image_f32_t *fim);
image_u8_t *image_u8_create_from_gray(int w, int h, uint8_t *image_matrix);

image_u8_t *image_u8_create_from_pnm(const char *path);
image_u8_t *image_u8_create_from_pnm_alignment(const char *path, int alignment);
Expand Down