From f996bd59a61338d8d51e2b19482d684f6dd04d0f Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Wed, 23 Sep 2015 21:16:48 +0000
Subject: [PATCH] more writing fixes
---
src/image.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/src/image.c b/src/image.c
index 5209328..861d8a2 100644
--- a/src/image.c
+++ b/src/image.c
@@ -494,6 +494,16 @@
return gray;
}
+image threshold_image(image im, float thresh)
+{
+ int i;
+ image t = make_image(im.w, im.h, im.c);
+ for(i = 0; i < im.w*im.h*im.c; ++i){
+ t.data[i] = im.data[i]>thresh ? 1 : 0;
+ }
+ return t;
+}
+
image blend_image(image fore, image back, float alpha)
{
assert(fore.w == back.w && fore.h == back.h && fore.c == back.c);
@@ -612,7 +622,7 @@
float val = (1-dy) * get_pixel(part, c, iy, k);
set_pixel(resized, c, r, k, val);
}
- if(r == h-1) continue;
+ if(r == h-1 || im.h == 1) continue;
for(c = 0; c < w; ++c){
float val = dy * get_pixel(part, c, iy+1, k);
add_pixel(resized, c, r, k, val);
--
Gitblit v1.10.0