|
From: Daniel J S. <dan...@ie...> - 2017-11-14 22:12:20
|
On 11/14/2017 03:19 PM, Ethan A Merritt wrote: > On Tuesday, November 14, 2017 12:03:09 PM PST Daniel J Sebald wrote: >> On 11/14/2017 12:27 PM, Ethan A Merritt wrote: >>> There are no "rgb axes". >>> And no, it does not make sense to autoscale RGB components of an image. >>> Suppose you are displaying a photograph that for whatever reason does >>> not contain any regions with Green==0. Rescaling the Green component >>> would distort all the colors everywhere, leaching the green out of things >>> that really are green. The _representation_ requires the range to run >>> [0:255] even if this particular image doesn't happen to contain pixels >>> with small Green component values. >> >> rgb components aren't necessarily treated independently. This code >> >> - image[i_sub_image++] = cb2gray( points[i_image].CRD_R ); >> - image[i_sub_image++] = cb2gray( points[i_image].CRD_G ); >> - image[i_sub_image++] = cb2gray( points[i_image].CRD_B ); >> >> was combining all component values into one. > > You lost me. > That code, which no longer exists, was copying the R G and B components > sequentially. They were all being scaled by the same range from the > palette definition, which was weird since they are not palette colors. > There was no "combine into one". Right, I'm pointing that out. All were scaled with the same formula. You initially gave a counter example saying that if the Green channel is an all zero channel it is going to leach across color channels in some way. There's nothing weird about the use of cb2range. The palette didn't apply, not until someone wanted to combine palettes and images. The cb2gray() is just a linear transformation using the parameters cbaxis->min and cbaxis->max. Call the function something more generalized, linearmap(), whatever. And if the code were more object-oriented, the linearmap() routine could be applied to xyz-axis, colorbar, alpha channel, rgb, i.e., code reuse. In terms of syntatx, it's more confusing to not continue the paradigm from one axis type to another. Dan |