YCbCr.frink

View or download YCbCr.frink in plain text format

// Demonstration and test of solving systems of equations.

use Solver.frink
symbolicMode[true]
showApproximations[false]

// Inverting the YCbCr equations.  (Luminance/Chrominance.)
// http://en.wikipedia.org/wiki/YCbCr
ycbcr = new Solver[[ Y === 0.299 R + 0.587 G + 0.114 B,
                     Cr === 0.500 R - 0.419 G - 0.081 B,
                     Cb === -0.169 R - 0.331 G + 0.500 B],
                    []]

println["All solutions:"]
println[join["\n", ycbcr.solveAll[]]]
println[join["\n", ycbcr.solveFor["R"]]]
println[join["\n", ycbcr.solveFor["G"]]]
println[join["\n", ycbcr.solveFor["B"]]]


View or download YCbCr.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17649 days, 5 hours, 43 minutes ago.