[R] package colorspace and .WhitePoint question
Achim Zeileis
Ach|m@Ze||e|@ @end|ng |rom u|bk@@c@@t
Mon Jun 4 09:42:42 CEST 2018
Glenn,
currently, this is currently not exposed in "colorspace" AFAICS. You can
modify it by changing .WhitePoint inside colorspace's NAMESPACE, though:
R> assignInNamespace(".WhitePoint", rbind(c(95, 100, 105)),
+ ns = "colorspace")
R> as(XYZ(100, 100, 100), "LAB")
L A B
[1,] 100 8.622384 3.226371
I'll have another look whether this could be exposed easily (cc also
Paul).
Best,
Z
On Mon, 4 Jun 2018, Glenn Davis wrote:
> In colorspace.R I see:
>
> setAs("color", "LAB", function(from)
> LAB(.Call("as_LAB", from using coords, class(from), .WhitePoint, PACKAGE = "
> colorspace"),
> names = dimnames(from using coords)[[1]]))
> ...
> .WhitePoint = NULL
>
> and then in colorspace.c and the function CheckWhite(),
> I see that .WhitePoint = NULL is converted to D65.
>
> I would like to pass a different .WhitePoint to
> as( XYZ( 100,100,100) , "LAB" )
>
>
> I have tried 3 methods:
> as( XYZ( 100,100,100) , "LAB", .WhitePoint=XYZ(95,100,105) )
> .WhitePoint = XYZ(95,100,105)
> assign( ".WhitePoint", XYZ(95,100,105), env=as.environment('package:
> colorspace') )
> but all fail, for different reasons.
>
> How can I transform XYZ to LAB using a whitepoint different than D65 ?
>
> Thanks,
> Glenn Davis
> gdavis using gluonics.com
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list