Closed m0ose closed 7 years ago
Hi,
It might be hard to debug without more information, do you have the file to test?
I think it was my fault.
I found a workaround. It turns out the input data was in uint8 and stringIO was expecting values between 0 and 255. The demosaicing algorithm produced several values that were bigger than 255, which I think got converted into zeros somewhere(probably in stringIO).
# This is a way to output a good demosaiced uint8, from uint8 input
m = m.astype('float32')
m = colour_demosaicing.demosaicing_CFA_Bayer_Menon2007(m)
print 'negative count:', (m < 0).sum(), ', bigger than 255: ' , (m > 255).sum()
m = m.clip(0,255)
m = m.astype('uint8')
Here is a test image, if you are still interested.
and the messed up version:
and a version that used the floats workaround:
Hi,
I was suspecting something along those lines!
Please be aware that the algorithms were tested with floating point images in [0, 1] domain, not integer [0, 255], integer [0, 65535] or any integer representation. You might want to divide your input to the functions by bit_depth - 1
.
I am using this with a point grey camera, and I get some weird artifacts while using the demosaicing_CFA_Bayer_DDFAPD, demosaicing_CFA_Bayer_Malvar2004, and demosaicing_CFA_Bayer_Menon2007 methods. The method demosaicing_CFA_Bayer_bilinear doesn't seem to have that problem.
They look like these blue dots. I am thinking that the colors are overflowing the byte.