Skip to content

Issue with stretchVector #3

Description

@shz9

Hi,

I think there's an issue with the stretchVector function defined in preprocess_images.py:

def stretchVector(vec, lowerPercentile, upperPercentile):
    minVal = np.percentile(vec, lowerPercentile)
    maxVal = np.percentile(vec, upperPercentile)
    vec[vec > maxVal] = maxVal
    vec = vec - minVal
    if (maxVal-minVal)>1.:
        vec = vec / (maxVal - minVal)

    return vec

The function as it's currently implemented doesn't cap the color channel value to be >= 0.0. And, in cases where vec contains values that are less than minVal, we'll have negative numbers in there. I encountered this issue with some of the images in the dataset.

This should be easy to fix by adding the following line after vec = vec - minVal:

vec[vec < 0.0] = 0.0

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions