Example #1
0
    if len(sys.argv) > 3:
        try:
            options_play_music = str_to_bool(sys.argv[1])
            options_verbose = str_to_bool(sys.argv[2])

            imagePath = sys.argv[3]
        except:
            print("Wrong parameters")
    else :
        options_play_music = True
        options_verbose = True
        imagePath = path + '/images/landscape_see_blue_sand.jpg'

    # Extraction informations
    img = cv2.imread(imagePath)
    histo_tool = HistogramAnalyzer(img)

    colorAverage = HSBColor(histo_tool.get_hue_average(),
                     histo_tool.get_saturation_average(),
                     histo_tool.get_brigthness_average())
    
    if options_verbose:
        print("### Average : ")
        print(colorAverage)
        print "Temperature : %2f" % colorAverage.temperature()
        print "Brightness : %2f" % colorAverage.brightness()

    colorMax = HSBColor(histo_tool.get_hue_max(),
                     histo_tool.get_saturation_max(),
                     histo_tool.get_brigthness_max())
from HistogramAnalyzer import HistogramAnalyzer
import cv2

if __name__ == "__main__":
    img = cv2.imread('../images/sunset_orange.jpg')
    #cv2.imshow('original', img)
    
    histo_tool = HistogramAnalyzer(img)
    
    #histo_tool.show_rgb_hist()
    
    #histo_tool.show_hsv()
    histo_tool.show_hsv_hist()
    print(histo_tool.get_hue_max())
    print(histo_tool.get_saturation_max())
    print(histo_tool.get_brigthness_max())

    #histo_tool.show_rgb()
    #histo_tool.show_rgb_hist()

    cv2.waitKey(0)
    cv2.destroyAllWindows()