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

ZCAM is published #17

Closed
joshuakraemer opened this issue Apr 29, 2021 · 9 comments
Closed

ZCAM is published #17

joshuakraemer opened this issue Apr 29, 2021 · 9 comments

Comments

@joshuakraemer
Copy link

Accessing the ZCAM functions prints the following warning:
WARNING: Z-CAM is as yet unpublished and under development, so parameter values might change! (07 Oct, 2020

But ZCAM has already been published (https://www.osapublishing.org/oe/fulltext.cfm?uri=oe-29-4-6036).

@ksmet1977
Copy link
Owner

Ok. Thanks for letting me know. I'll see if I can update zcam as soon as possible.

@ksmet1977
Copy link
Owner

ksmet1977 commented Apr 29, 2021

I've implemented the published version of ZCAM. However, note that the example values in the supplementary material cannot be exactly replicated. I've checked all parameters, and I think they are correct, but there is already a discrepancy for the XYZ to Jz, az, bz conversion, especially for the bz value. The only reason I can see (assuming I indeed not missed any wrong parameter values, but please check yourself), is that the CAT02 chromatic adaptation transform parameters or more likely the XYZ of the D65 reference white that Safdar et al used in their calculations is different from what one would normally use/get: for XYZw of D65, maybe they used a different, non-standard wavelength range, mistyped, or something else?. In any case, (and I've reported this to the authors months ago), published values of D65 for the CIE 1932 2° observer don't lead to a (az, bz) values of (0,0) which is what one would expect for a stimulus matching the reference white. In addition (also reported to the authors), they report that for Iz the reference is a D65 stimulus of 10000 cd/m², but Iz becomes 1 only for a much higher value! So there is probably something wrong there as well. So for now, I won't put any more time in this until perhaps somebody else can very my findings or point out where I might have made a coding mistaking.

If you want to use the new ZCAM update your luxpy copy from github directly. I'll make another release for pypi later, but I'm working on some other things that I want to incorporate in the new version.

@joshuakraemer
Copy link
Author

That's great, thank you very much!

I've tried to test the worked examples, but it doesn't work as expected. Maybe I'm doing something wrong, but it seems the CAT is not even applied? The following function call gives the same result when I remove the parameter "xyzw".

>>> luxpy.color.cam.zcam(numpy.array([[185, 206, 163]]), xyzw = numpy.array([[256, 264, 202]]), outin = "J,C,h", cieobs = "1931_2", conditions = {"La": 264, "Yb": 100, "surround": "avg", "D": None, "Dtype": "cat02"}, forward = True, mcat = "cat02")
array([[127.7651,   4.7005, 104.3055]])

By the way, it would be good to have az and bz as output parameters for testing.

@ksmet1977
Copy link
Owner

ksmet1977 commented Apr 30, 2021 via email

@ksmet1977
Copy link
Owner

ksmet1977 commented Apr 30, 2021 via email

@joshuakraemer
Copy link
Author

Thank you, it works now. I think a clarification from the authors is necessary. I will try to contact them and ask for a current Matlab implementation.

@joshuakraemer
Copy link
Author

I think I have found a small bug with the ZCAM implementation: Hue quadrature H seems to be interpreted as hue angle h in backwards mode.

>>> luxpy.color.cam.zcam(luxpy.color.cam.zcam(numpy.array([[50, 10, 100]]), outin = "J,C,H", forward = False), outin = "J,C,H", forward = True)
array([[[ 50. ,  10. , 135.5]]])
>>> luxpy.color.cam.zcam(luxpy.color.cam.zcam(numpy.array([[50, 10, 100]]), outin = "J,C,H", forward = False), outin = "J,C,h", forward = True)
array([[[ 50.,  10., 100.]]])

@ksmet1977
Copy link
Owner

ksmet1977 commented May 4, 2021 via email

@joshuakraemer
Copy link
Author

Thanks a lot!

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

2 participants