# compute which pixels are in the wanted range
        cv.cvInRangeS (hsv, hsv_min, hsv_max, mask)

        # extract the hue from the hsv array
        cv.cvSplit (hsv, hue, None, None, None)

        # select the rectangle of interest in the hue/mask arrays
        hue_roi = cv.cvGetSubRect (hue, selection)
        mask_roi = cv.cvGetSubRect (mask, selection)

        # it's time to compute the histogram
        cv.cvCalcHist (hue_roi, hist, 0, mask_roi)

        # extract the min and max value of the histogram
        min_val, max_val = cv.cvGetMinMaxHistValue (hist, None, None)

        # compute the scale factor
        if max_val > 0:
            scale = 255. / max_val
        else:
            scale = 0.

        # scale the histograms
        cv.cvConvertScale (hist.bins, hist.bins, scale, 0)

        # clear the histogram image
        cv.cvSetZero (histimg)

        # compute the width for each bin do display
        bin_w = histimg.width / hdims
Exemple #2
0
        # compute which pixels are in the wanted range
        cv.cvInRangeS (hsv, hsv_min, hsv_max, mask)

        # extract the hue from the hsv array
        cv.cvSplit (hsv, hue, None, None, None)

        # select the rectangle of interest in the hue/mask arrays
        hue_roi = cv.cvGetSubRect (hue, selection)
        mask_roi = cv.cvGetSubRect (mask, selection)

        # it's time to compute the histogram
        cv.cvCalcHist (hue_roi, hist, 0, mask_roi)

        # extract the min and max value of the histogram
        min_val, max_val, min_idx, max_idx = cv.cvGetMinMaxHistValue (hist)

        # compute the scale factor
        if max_val > 0:
            scale = 255. / max_val
        else:
            scale = 0.

        # scale the histograms
        cv.cvConvertScale (hist.bins, hist.bins, scale, 0)

        # clear the histogram image
        cv.cvSetZero (histimg)

        # compute the width for each bin do display
        bin_w = histimg.width / hdims
Exemple #3
0
        # compute which pixels are in the wanted range
        cv.cvInRangeS(hsv, hsv_min, hsv_max, mask)

        # extract the hue from the hsv array
        cv.cvSplit(hsv, hue, None, None, None)

        # select the rectangle of interest in the hue/mask arrays
        hue_roi = cv.cvGetSubRect(hue, selection)
        mask_roi = cv.cvGetSubRect(mask, selection)

        # it's time to compute the histogram
        cv.cvCalcHist(hue_roi, hist, 0, mask_roi)

        # extract the min and max value of the histogram
        min_val, max_val, min_idx, max_idx = cv.cvGetMinMaxHistValue(hist)

        # compute the scale factor
        if max_val > 0:
            scale = 255. / max_val
        else:
            scale = 0.

        # scale the histograms
        cv.cvConvertScale(hist.bins, hist.bins, scale, 0)

        # clear the histogram image
        cv.cvSetZero(histimg)

        # compute the width for each bin do display
        bin_w = histimg.width / hdims
Exemple #4
0
        # compute which pixels are in the wanted range
        cv.cvInRangeS(hsv, hsv_min, hsv_max, mask)

        # extract the hue from the hsv array
        cv.cvSplit(hsv, hue, None, None, None)

        # select the rectangle of interest in the hue/mask arrays
        hue_roi = cv.cvGetSubRect(hue, selection)
        mask_roi = cv.cvGetSubRect(mask, selection)

        # it's time to compute the histogram
        cv.cvCalcHist(hue_roi, hist, 0, mask_roi)

        # extract the min and max value of the histogram
        min_val, max_val = cv.cvGetMinMaxHistValue(hist, None, None)

        # compute the scale factor
        if max_val > 0:
            scale = 255. / max_val
        else:
            scale = 0.

        # scale the histograms
        cv.cvConvertScale(hist.bins, hist.bins, scale, 0)

        # clear the histogram image
        cv.cvSetZero(histimg)

        # compute the width for each bin do display
        bin_w = histimg.width / hdims