From e36182cd8c5dd5c6d0aa1f77cf5cdca87e8bb1f0 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Fri, 21 Nov 2014 23:35:19 +0000
Subject: [PATCH] cleaned up data parsing a lot. probably nothing broken?

---
 src/image.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/image.c b/src/image.c
index e2c451b..15b1523 100644
--- a/src/image.c
+++ b/src/image.c
@@ -138,7 +138,7 @@
     }
     free_image(copy);
     if(disp->height < 500 || disp->width < 500 || disp->height > 1000){
-        int w = 1500;
+        int w = 500;
         int h = w*p.h/p.w;
         if(h > 1000){
             h = 1000;
@@ -369,7 +369,6 @@
         // Will do a scaled image resize with the correct aspect ratio.
         outImg = resizeImage(croppedImg, newHeight, newWidth, 0);
         cvReleaseImage( &croppedImg );
-
     }
     else {
 
@@ -415,6 +414,25 @@
     return out;
 }
 
+image load_image_color(char *filename, int h, int w)
+{
+    IplImage* src = 0;
+    if( (src = cvLoadImage(filename, 1)) == 0 )
+    {
+        printf("Cannot load file image %s\n", filename);
+        exit(0);
+    }
+    if(h && w && (src->height != h || src->width != w)){
+        //printf("Resized!\n");
+        IplImage *resized = resizeImage(src, h, w, 1);
+        cvReleaseImage(&src);
+        src = resized;
+    }
+    image out = ipl_to_image(src);
+    cvReleaseImage(&src);
+    return out;
+}
+
 image load_image(char *filename, int h, int w)
 {
     IplImage* src = 0;

--
Gitblit v1.10.0