Skip to content

Why does the pixel value of a stored binary image change during reading at a value of 255? #894

@SmallWhiteGZ

Description

@SmallWhiteGZ
binary =cv2.adaptiveThreshold(cut, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 35, 10)

# kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (6, 6))
binary_close = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel) 

cv2.imwrite('roi_{}.jpg'.format(i), binary_close)
read_binary = cv2.imread('roi_{}.jpg'.format(i))

The values in binary_close are only 255 and 0, however, some smaller values in read_binary such as 254.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions