From 3b864c2254752c252936c9cc14036991686d2c81 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Fri, 10 Jul 2015 23:36:08 +0000
Subject: [PATCH] width and stuff
---
src/image.c | 8 ++++++++
src/detection.c | 5 ++---
Makefile | 4 +++-
src/image.h | 1 +
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 214621e..19bff32 100644
--- a/Makefile
+++ b/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
diff --git a/src/detection.c b/src/detection.c
index dc3d9a4..94d3700 100644
--- a/src/detection.c
+++ b/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);
}
}
}
diff --git a/src/image.c b/src/image.c
index 2e5d756..657db68 100644
--- a/src/image.c
+++ b/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;
diff --git a/src/image.h b/src/image.h
index af6682e..1806574 100644
--- a/src/image.h
+++ b/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);
--
Gitblit v1.10.0