From 24f563ce7165c2c44486fe8d0a2caea8d7c5a887 Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Thu, 17 May 2018 23:26:55 +0300 Subject: [PATCH] Example of usage cv2.imread() in the darknet.py --- build/darknet/x64/darknet.py | 6 ++++-- build/darknet/x64/darknet_python.cmd | 2 ++ darknet.py | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/build/darknet/x64/darknet.py b/build/darknet/x64/darknet.py index 9888c229..b290a358 100644 --- a/build/darknet/x64/darknet.py +++ b/build/darknet/x64/darknet.py @@ -222,9 +222,11 @@ def detect(net, meta, image, thresh=.5, hier_thresh=.5, nms=.45, debug= False): """ #pylint: disable= C0321 im = load_image(image, 0, 0) + #import cv2 + #custom_image = cv2.imread(image) # use: detect(,,imagePath,) #import scipy.misc - #sci_image = scipy.misc.imread(image) - #im, arr = array_to_image(sci_image) # you should comment line below: free_image(im) + #custom_image = scipy.misc.imread(image) + #im, arr = array_to_image(custom_image) # you should comment line below: free_image(im) if debug: print("Loaded image") num = c_int(0) if debug: print("Assigned num") diff --git a/build/darknet/x64/darknet_python.cmd b/build/darknet/x64/darknet_python.cmd index 2c9243c6..d64fe364 100644 --- a/build/darknet/x64/darknet_python.cmd +++ b/build/darknet/x64/darknet_python.cmd @@ -2,6 +2,7 @@ rem download Python 2.7.14 from: https://www.python.org/downloads/release/python rem C:\Python27\Scripts\pip install numpy rem C:\Python27\Scripts\pip install scikit-image rem C:\Python27\Scripts\pip install scipy +rem C:\Python27\Scripts\pip install opencv-python C:\Python27\python.exe darknet.py @@ -11,6 +12,7 @@ rem Python 3.6 rem C:\Users\Alex\AppData\Local\Programs\Python\Python36\Scripts\pip install numpy rem C:\Users\Alex\AppData\Local\Programs\Python\Python36\Scripts\pip install scikit-image rem C:\Users\Alex\AppData\Local\Programs\Python\Python36\Scripts\pip install scipy +rem C:\Users\Alex\AppData\Local\Programs\Python\Python36\Scripts\pip install opencv-python rem C:\Users\Alex\AppData\Local\Programs\Python\Python36\python.exe darknet.py diff --git a/darknet.py b/darknet.py index 9888c229..b290a358 100644 --- a/darknet.py +++ b/darknet.py @@ -222,9 +222,11 @@ def detect(net, meta, image, thresh=.5, hier_thresh=.5, nms=.45, debug= False): """ #pylint: disable= C0321 im = load_image(image, 0, 0) + #import cv2 + #custom_image = cv2.imread(image) # use: detect(,,imagePath,) #import scipy.misc - #sci_image = scipy.misc.imread(image) - #im, arr = array_to_image(sci_image) # you should comment line below: free_image(im) + #custom_image = scipy.misc.imread(image) + #im, arr = array_to_image(custom_image) # you should comment line below: free_image(im) if debug: print("Loaded image") num = c_int(0) if debug: print("Assigned num")