Joseph Redmon
2015-06-16 3b864c2254752c252936c9cc14036991686d2c81
width and stuff
4 files modified
18 ■■■■ changed files
Makefile 4 ●●● patch | view | raw | blame | history
src/detection.c 5 ●●●●● patch | view | raw | blame | history
src/image.c 8 ●●●●● patch | view | raw | blame | history
src/image.h 1 ●●●● patch | view | raw | blame | history
Makefile
@@ -42,7 +42,7 @@
OBJS = $(addprefix $(OBJDIR), $(OBJ))
DEPS = $(wildcard src/*.h) Makefile
all: obj $(EXEC)
all: obj results $(EXEC)
$(EXEC): $(OBJS)
    $(CC) $(COMMON) $(CFLAGS) $(LDFLAGS) $^ -o $@
@@ -55,6 +55,8 @@
obj:
    mkdir -p obj
results:
    mkdir -p results
.PHONY: clean
src/detection.c
@@ -20,6 +20,7 @@
            j = (r*side + c) * elems;
            int class = max_index(box+j, classes);
            if(box[j+class] > 0.2){
                int width = box[j+class]*5 + 1;
                printf("%f %s\n", box[j+class], class_names[class]);
                float red = get_color(0,class,classes);
                float green = get_color(1,class,classes);
@@ -39,9 +40,7 @@
                int right = (x+w/2)*im.w;
                int top   = (y-h/2)*im.h;
                int bot   = (y+h/2)*im.h;
                draw_box(im, left, top, right, bot, red, green, blue);
                draw_box(im, left+1, top+1, right+1, bot+1, red, green, blue);
                draw_box(im, left-1, top-1, right-1, bot-1, red, green, blue);
                draw_box_width(im, left, top, right, bot, width, red, green, blue);
            }
        }
    }
src/image.c
@@ -59,6 +59,14 @@
    }
}
void draw_box_width(image a, int x1, int y1, int x2, int y2, int w, float r, float g, float b)
{
    int i;
    for(i = 0; i < w; ++i){
        draw_box(a, x1+i, y1+i, x2-i, y2-i, r, g, b);
    }
}
void flip_image(image a)
{
    int i,j,k;
src/image.h
@@ -23,6 +23,7 @@
float get_color(int c, int x, int max);
void flip_image(image a);
void draw_box(image a, int x1, int y1, int x2, int y2, float r, float g, float b);
void draw_box_width(image a, int x1, int y1, int x2, int y2, int w, float r, float g, float b);
image image_distance(image a, image b);
void scale_image(image m, float s);
image crop_image(image im, int dx, int dy, int w, int h);