Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use function, ValueError: Input image doesn't have all values between 0 and 1. #6

Open
nrsprs opened this issue Aug 20, 2024 · 0 comments

Comments

@nrsprs
Copy link

nrsprs commented Aug 20, 2024

Issue:
Unable to prepare image to pass float 1-0 check without destroying image on write.

Expectation:
Convert to float and div by max(img), which is 255.0, to pass the np.all check in the beginning of the remove_reflection. Convert back to uint8 colorspace and write image.

Problem:
The image space divided by 255.0 is black. I'm trying to restore the image to the 0-255 colorspace, but that also doesn't seem to have an impact when writing to file; viewing inside of the imshow window shows the results as expected.

img = cv.imread("/Users/nick/Desktop/test.png")
if img is None:
    print("did not read")
    exit()

img = img.astype(np.float16)/float(img.max())

frrAlgo = FastReflectionRemoval(h = 0.14)
dereflected_img = frrAlgo.remove_reflection(img)

output = dereflected_img*255.0
output = output.astype(np.uint8)
cv.imshow("Output", output)
cv.waitKey(0)
cv.imwrite("/Users/nick/Desktop/output.png", dereflected_img)

I'm not sure what the best method for preparing images for is when using this function, or how they're supposed to be handled after processing. Would like to use this project since it seems very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant