Comments (4)
Is there a reason to not want to overload inv?
From ?inv
, it is required to satisfy inv(x) * x == x * inv(x) == one(x)
so clearly that inv(x::Real) = one(x) - x
doesn't satisfy this property. Hence we can't overload Base.inv
function. We might introduce a new function, e.g., invert_color
.
I was trying to mess around with some of the common filters like inverting the colors, and it seems this would be well defined.
This concept is more like a "mirror" operation and might only be well defined for "linear" color space such as RGB
, XYZ
. For non-linear color space such as Lab
, I don't know, it might be sufficient to only invert the L
channel.
from colors.jl.
FYI, you can use ColorVectorSpace.complement
(formerly Images.complement
) for AbstractRGB
.
See also the second half of JuliaGraphics/ColorVectorSpace.jl#125 (comment).
from colors.jl.
Thanks, yes I was worried about the roundoff error. This is helpful, I know really little about color spaces. Is there a type specifically for the Linear spaces so that invert_color could be extended?
julia> dump(inv(inv(purp)) - purp)
RGB{Float64}
r: Float64 0.0
g: Float64 -2.7755575615628914e-17
b: Float64 0.0
It's not a big deal to not have this, since it is so easy to write. I was mainly just curious
from colors.jl.
Anyway, since inv
is no longer a topic of this discussion, I think it would be better to change the subject of this issue or open a new issue.
I have no objection to adding the functionality to get the complementary "color" (not "numbers"), but I don't think we should introduce our own definition for it. We should refer to papers or well-known tools on color science or image processing.
from colors.jl.
Related Issues (20)
- Not work on Ubuntu 2004 HOT 5
- RGB -> XTerm256 approximation? HOT 13
- move storage type conversion trait from ImageCore to Colors HOT 6
- Optimizing the types used for intermediate calculations HOT 5
- Source of the YIQ transform matrix HOT 1
- Fatal performance degradation due to precompilation or inference bugs HOT 8
- MethodError: no method matching coloralpha(::Type{RGB24}) HOT 1
- What should `default_brettel_neutral` be? HOT 1
- Ambiguity with AbstractTrees
- 'Render' colours in REPL HOT 15
- in the README, put a link on the home page HOT 2
- colorwheel generator HOT 1
- add colorwheel generator HOT 1
- Release v0.13? HOT 2
- Ambiguous show method for `Union{}[]` HOT 3
- colormap("<Color>", maxcount; w=<Int>, logscale=<Bool>) stackoverflows HOT 7
- oklab/oklch for CSS4 and cheap deltaE HOT 1
- BGR interpreted as RGB HOT 1
- Luv and LCHuv gives incorrect color values for low lightness cyan HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from colors.jl.