if not os.path.isfile(filename): sys.exit("filename " + filename + " does not exist") # Read image img = cv2.imread(filename) # 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
# putText(img, text, textOrg, fontFace, fontScale, # Scalar::all(255), thickness, 8); #cv2.putText(resized, str(percentColor)+'%', (20, 20), cv2.putText(issimg.image, str(percentColor)+'%', (20, 80), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1) # Put name of file, focal length, sun elevation text on the image issimg.put_text() # Show images if desired if (showImages) : # show the frame and the binary image # USE THE ISSIMAGE TO SHOW THE ORIGINAL IMAGE ******* #cv2.imshow(imagePath, resized) issimg.show() cv2.imshow("filtered",filtered) if doOpening: cv2.imshow("opening",opened) # show the smoothed, thresholded image cv2.imshow("Binary", block.binary) cv2.waitKey(0) # plot this histogram #plot_color_hist(image) cv2.destroyAllWindows()