-
Notifications
You must be signed in to change notification settings - Fork 47
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
Conversion methods should be organized #354
Comments
I am not quite sure what type of complexity you are referring to: there are several candidates! The conversion methods in ColorTypes are "trivial" in the sense that they don't change color spaces, only representations in the same color space. They are also insanely complicated from the dispatch perspective because of handling stuff like For whitepoint, you know more than I do, so let me ask: would it make more sense to specify the whitepoint as part of the type itself? That is to say, "convert convert(WhitePoint{RGB{N0f8}}(wp), c) Another alternative would be a keyword argument. Again, these are far faster (still not cost-free, but pretty close) than they were when this package was originally designed. I suppose a third sense of complexity might be the question of whether you have direct C1->C2 conversions or always go through C0, C1->C0->C2. The latter requires |
Well, I'm never a color expert, and the experts may say different things on their standpoints in different fields(e.g. colormetry, color management, graphic design, psychology, neurology, illuminating engineering, television, ...). For white point, I think The relationship between color types and white points is not simple. The color spaces can be roughly divided into two, i.e. "absolute" and "non-absolute". Well, "what does absolute mean?", the experts may ask. It is not simple, too. Such being the case, we can formally convert colors from CIELAB (D65) to sRGB (D65) via CIEXYZ. Yes, the Even though defining new concrete types of RGB (e.g Let's suppose we can solve the problem of the chromatic adaptation. We still have another problem with the gamut. Sometimes a color which is included in the source gamut is not in the destination gamut. Perhaps someone may want to specify the rendering intent (e.g. perceptual, absolute, saturation), and the person would like to specify the black point. I feel I said too much negatively, but the color conversion is a profound matter. Let's wait for someone to create |
Sorry for ranting. In conclusion, I'm not so pessimistic about the issues of context (e.g. white points) needed for the conversion. The reasons are as follows.
So, the type of complexity which I'm mainly referring is related to the tests and benchmarks. (Of course, the other aspects are also important as long as we are on track.) I think the Lines 328 to 360 in d64fb1a
(I do not intend to examine the individual reasons here.) It is relatively easy to find out which methods are called by |
The following is the outline of # DOT language
digraph "cnvt" {
graph [layout=neato overlap=false nodesep=0.08 bgcolor=transparent]
edge [color=dimgray]
node [width=1 height=0.5 shape=oval style=filled fillcolor="#f0f0f0" color=lightgray]
subgraph "hint" {
edge [style=invis]
HSV->HSL->HSI; YIQ->YCbCr; LCHab->LCHuv; DIN99->DIN99d
}
RGB, Lab, Luv [fillcolor="#f8f8f8"]
XYZ [fillcolor="#ffffff"]
{HSV, HSL, HSI, YIQ, YCbCr}->RGB
LCHab->Lab /*->XYZ->RGB */ [color=goldenrod]
LCHuv->Luv /*->XYZ->RGB */ [color=goldenrod]
/* Color3->*/ XYZ->RGB [color=steelblue style="bold"]
/* Color3->*/ RGB->HSV [color=steelblue style="bold"]
/* Color3->*/ RGB->HSL [color=steelblue style="bold"]
/* Color3->*/ RGB->HSI [color=steelblue style="bold"]
{RGB, xyY, Lab, Luv, DIN99d, LMS}->XYZ
{HSV, HSL, HSI, YIQ, YCbCr}->RGB->XYZ [color=brown]
{LCHab, DIN99, DIN99o}->Lab->XYZ [color=brown]
LCHuv->Luv->XYZ [color=brown]
/* Color3->*/ XYZ->xyY [color=steelblue style="bold"]
{LCHab, DIN99, DIN99o}->Lab
RGB->XYZ /*->Lab*/ [color=goldenrod]
HSV->RGB /*->XYZ->Lab*/ [color=goldenrod]
HSL->RGB /*->XYZ->Lab*/ [color=goldenrod]
/* Color3->*/ XYZ->Lab [color=steelblue style="bold"]
LCHuv->Luv
RGB->XYZ /*->Luv*/ [color=goldenrod]
HSV->RGB /*->XYZ->Luv*/ [color=goldenrod]
HSL->RGB /*->XYZ->Luv*/ [color=goldenrod]
/* Color3->*/ XYZ->Luv [color=steelblue style="bold"]
/* Color3->*/ Luv->LCHuv [color=steelblue style="bold"]
/* Color3->*/ Lab->LCHab [color=steelblue style="bold"]
/* Color3->*/ Lab->DIN99 [color=steelblue style="bold"]
/* Color3->*/ XYZ->DIN99d [color=steelblue style="bold"]
/* Color3->*/ Lab->DIN99o [color=steelblue style="bold"]
/* Color3->*/ XYZ->LMS [color=steelblue style="bold"]
/* Color3->*/ RGB->YIQ [color=steelblue style="bold"]
/* Color3->*/ RGB->YCbCr [color=steelblue style="bold"]
} Since there is no loop, the conversion path is uniquely determined by source and destination types. The conversions where the destination is Lines 168 to 169 in d64fb1a
Lines 417 to 419 in d64fb1a
Lines 517 to 519 in d64fb1a
Although further check is required, the tests were passed even when I eliminated the methods. |
An error occurs when converting an julia> convert(Gray, RGB24(1,0,0))
ERROR: type RGB24 has no field r Lines 783 to 787 in d64fb1a
This may not be an important issue, but this is a good example to show the importance of the unveiling. BTW, I think there is no need for the Edit: julia> convert(Gray24, RGB())
ERROR: StackOverflowError: |
I think the conversion methods should be organized, but that may not actually be true. I will report separate issues for the bugs, and I will close this issue. |
I understand that the issue report is not my diary, but.... I wanted to incorporate the opinions of many developers and users for major renovations (cf. #278). However, I realized that this method took too long. I think the issue reports which lost their freshness are obstacles to development, and the issues written on the second or subsequent pages on GitHub are especially not good. I thought it would be more beneficial to fix individual defects than to spoil the issue reports for a pie in the sky. So, I decided to close this issue and #278. In that context, the PR #380 is exactly what I wanted, and I have no reason to refuse it. However, its code is going the opposite of what I was aiming for. To be honest, as an engineer, I am not confident in this decision. |
In what way is it going in the opposite direction? (A link is fine if you've already explained it once or more than once.) EDIT: let me guess, you mean because it goes through the bottleneck of RGB? I think we should fix the bug without that getting in the way of a more ambitious overhaul. |
My concern is that the gray conversions are out of the Of course, the bug fixes are nice. 👍 |
I think the set of conversion methods in
src/conversions.jl
is too complicated. What makes matter more complicated is that they work together with the conversion methods in ColorTypes.jl.One of the problems is that there are at least two stray methods which are not called by
convert()
(cf. PR #352). The codecov suggests that this have also strayed.I think it is a more serious issue that very few maintainers know the entire structure of conversions. Of course, I do not know! I have a plan to add a optional argument
wp
(white point) toconvert()
(cf. issue #278 and PR #340), but I don't know what it really means.However, I have no clear solution. It would be better to make the coding guideline and refactor the codes.
What should we do?
The text was updated successfully, but these errors were encountered: