def applyPredThresh(pixels):
    # zero removal for quantile computation
    nonzp = pixels[np.any(pixels, 1)]        
    counts = {c:np.bincount(nonzp[:,c], minlength=256) for c in colors}
    qs     = {c : 
              countQuantiles(counts[c], iles) for c in colors}

    # clunky:
    qDict = {"R8D": qs[R][0], "R9D": qs[R][1],
             "G8D": qs[G][0], "G9D": qs[G][1],
             "B8D": qs[B][0], "B9D": qs[B][1]}

    predictedThreshes = \
             dict((c, applyCurrentLM(qDict, c)) for c in colorNames)
    # print ",".join("%5.4f" % t for t in predictedThresholds.values())
    thresholdNDArray(pixels, predictedThreshes, dropSaturated=True)
Beispiel #2
0
def applyPredThresh(pixels):
    # zero removal for quantile computation
    nonzp = pixels[np.any(pixels, 1)]
    counts = {c: np.bincount(nonzp[:, c], minlength=256) for c in colors}
    qs = {c: countQuantiles(counts[c], iles) for c in colors}

    # clunky:
    qDict = {
        "R8D": qs[R][0],
        "R9D": qs[R][1],
        "G8D": qs[G][0],
        "G9D": qs[G][1],
        "B8D": qs[B][0],
        "B9D": qs[B][1]
    }

    predictedThreshes = \
             dict((c, applyCurrentLM(qDict, c)) for c in colorNames)
    # print ",".join("%5.4f" % t for t in predictedThresholds.values())
    thresholdNDArray(pixels, predictedThreshes, dropSaturated=True)
            {"15m60xendser301.TIF",
             "15m60xendser301.TIF",
             "15m60xendser301.TIF",
             "120m60xac17ser24.TIF",
             "120m60xac17ser27.TIF"}:
            print ".....skipping:"
            continue
        
        currentImage = Image.open(imageDataPath+exampleFilename)
        pixels = fromimage(currentImage).reshape((numImagePoints,3))        
        # zero removal
        if REMOVE_ZEROS:
            pixels = pixels[np.any(pixels, 1)]        
        counts = {c:np.bincount(pixels[:,c], minlength=256) for c in colors}
        qs     = {c : 
                  countQuantiles(counts[c], iles) for c in colors}
        # import pdb; pdb.set_trace()
        
        # clunky:
        qDict = {"R8D": qs[R][0], "R9D": qs[R][1],
                 "G8D": qs[G][0], "G9D": qs[G][1],
                 "B8D": qs[B][0], "B9D": qs[B][1]}

        predictedThresholds = \
                 dict((c, applyCurrentLM(qDict, c)) for c in colorNames)
        print ",".join("%5.4f" % t for t in predictedThresholds.values())
        thresholdNDArray(pixels, predictedThresholds)

        stackArray = np.concatenate((stackArray, pixels))
        
Beispiel #4
0
        if exampleFilename.rsplit("/",1)[1] in \
            {"15m60xendser301.TIF",
             "15m60xendser301.TIF",
             "15m60xendser301.TIF",
             "120m60xac17ser24.TIF",
             "120m60xac17ser27.TIF"}:
            print ".....skipping:"
            continue

        currentImage = Image.open(imageDataPath + exampleFilename)
        pixels = fromimage(currentImage).reshape((numImagePoints, 3))
        # zero removal
        if REMOVE_ZEROS:
            pixels = pixels[np.any(pixels, 1)]
        counts = {c: np.bincount(pixels[:, c], minlength=256) for c in colors}
        qs = {c: countQuantiles(counts[c], iles) for c in colors}
        # import pdb; pdb.set_trace()

        # clunky:
        qDict = {
            "R8D": qs[R][0],
            "R9D": qs[R][1],
            "G8D": qs[G][0],
            "G9D": qs[G][1],
            "B8D": qs[B][0],
            "B9D": qs[B][1]
        }

        predictedThresholds = \
                 dict((c, applyCurrentLM(qDict, c)) for c in colorNames)
        print ",".join("%5.4f" % t for t in predictedThresholds.values())