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

Visible clipping artifacts in highlights with Malvar (2004) and Menon (2007). #7

Closed
jiawen opened this issue Jan 24, 2018 · 6 comments

Comments

@jiawen
Copy link

jiawen commented Jan 24, 2018

My apologies ahead of time for not posting images as I am uncertain whether I have the appropriate rights.

I just tried demosaicing_CFA_Bayer_Malvar2004() and demosaicing_CFA_Bayer_Menon2007() on the standard MATLAB test image "mandi.tif" (see https://www.mathworks.com/help/images/ref/demosaic.html).

With the Malvar method, I see distinctive speckles of pure red and blue in the output near highlights. Besides that, the results are basically identical to that of MATLAB.

With the Menon method, there are pure red, green, and blue everywhere.

I suspect these are some bugs in the way overflow and underflow are handled.

@KelSolaar
Copy link
Member

Hi @jiawen,

I could not reproduce the issue:

import colour
import colour_demosaicing

RGB = colour_demosaicing.demosaicing_CFA_Bayer_Menon2007(
    colour.read_image('mandi.tif'), 'BGGR')

colour.write_image(RGB, 'mandi_Menon2007.jpg')

Malvar (2004)
image

Menon (2007)
image

How are you invoking the function(s)?

@KelSolaar KelSolaar changed the title Visible clipping artifacts in highlights with Malvar and Menon Visible clipping artifacts in highlights with Malvar (2004) and Menon (2007). Jan 25, 2018
@jiawen
Copy link
Author

jiawen commented Feb 1, 2018

My apologies for the delay as I got distracted by other stuff at work. Maybe it's because I'm reading the input using skimage.io.imread() instead of colour.read_image()?

Anyway, here's the IPython notebook I was using, and this is the output from Malvar.

@jiawen
Copy link
Author

jiawen commented Feb 1, 2018

I'm using colour-demosaicing 0.1.2 installed from pip on Python 3.6.

I'm not using colour.read_image() mainly because I have no idea how to easily install OpenImageIO into Anaconda without installing it system-wide.

@jiawen
Copy link
Author

jiawen commented Feb 1, 2018

Output from Menon

@KelSolaar
Copy link
Member

@jiawen : I will try to look at that over the weekend, by the mean time can you try converting the array you get from skimage.io.imread to float and maybe divide it by 255 or 65535 before passing it to demosaicing_CFA_Bayer_Menon2007?

Cheers,

Thomas

@KelSolaar
Copy link
Member

Hi @jiawen,

I'm closing this for now, feel free to continue the discussion though.

Cheers,

Thomas

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

No branches or pull requests

2 participants