# resize the image # def resize(image, width = None, height = None, inter = cv2.INTER_AREA) resized = resize(img, width=500) # initialize ISSIMAGE class for setting up the image xx = ISSIMAGE(filename) xx.resize() xx.show() # ---------------------- # Get the sun elevation # ---------------------- sunElev = xx.get_sun_elev() logging.debug("Sun elevation = %s", sunElev) # ---------------------- # Get the focal length # ---------------------- focalLength = xx.get_focal_length() logging.debug("Focal length = %s", focalLength) # ----------------- # convert to gray # ----------------- gray = cv2.cvtColor(resized, cv2.COLOR_BGR2GRAY) # ------------------------------------------------------ # Smooth the image
#-------------------------------------------- # Loop over images in the query data set : #-------------------------------------------- with open(resultsName, 'wb') as csvfile: # -------------------------------------- # Loop over the input dataset of images # -------------------------------------- for filename in imagePaths: # for imagePath2 in imagePaths2: # # Grab the image and classify it # # Set up the ISSIMAGE object issimg = ISSIMAGE(filename) """Only look at images with sun elevation > minSunElev""" if issimg.get_sun_elev() > minSunElev: continue filename = os.path.basename(filename) # read the image - lrm logging.info("Reading test file %s", filename) image = cv2.imread(filename) # describe the image features = desc.describe(issimg.image) # Run model prediction on the features prediction = model.predict(features) logging.info("Prediction is %s", prediction) result = "\n{},{}".format(filename, prediction) logging.info(result)