How can we mix colors with hex codes? For example yellow+blue=green ffff00+0000ff=00ff00. Whats algorithm for this?
What language are you using?
In most languages, we can mask out the R, G, B components and do addition and clipping (fitting to range [0, 255]) separately.
There may be libraries on the particular language that can do the addition for you.
Related
I have this kind of images (255 exactly):
Example of delineation
I have to generate a mask for each of them automatically. For example, set all pixels in the bleu outline to zeros and set the others to one.
Does someone know a useful python's tool to achieve this task? Knowing that I know the exact position of the blue outline of the image above.
Thank you for your help!
I have to Implement fonts for more languages for SenseHat.jl
The current set of fonts available within the SenseHat library are limited to English/Latin characters.
I gotta implement font shapes for other languages.
Current font definitions for English are here
I can't seem to understand in which encoding these characters are represented. Can someone tell that ? Also, where can I find/generate such Boolean representations of Greek Characters.
Thanks.
According to the docs for the SenseHat add in board for Raspberry Pi, the board has an LED display grid which is 8X8 pixels in area. Since the blank char is all zeros in the first line of your table, the table is a table of the states of the grid to light the LED display in order to display a character.
You may need a sheet of graph paper to rough out what your Greek alphabet will look like if reduced to displaying on an 8x8 pixel grid. If you can find an 8x8 Unicode font, you can look at the Greek alphabet Unicode pages for hints. For example, https://docs.rs/font8x8/0.1.1/font8x8/constant.GREEK.html, and translate the integers to bit arrays:
bits = UInt8.(digits(integer, base=2))
Wikipedia and plethora of online resources provide detailed and abundant help with various color space conversions from/to RGB. What I need is a straight YUV->HSL/HSV conversion.
In fact what I need is just the Hue (don't care much for the Saturation or the brightness Lightness/Value). In other words I just need to calculate the "color angle" for a given YUV color.
Code in any language would suffice, though my preference is C-style syntax.
Note that by YUV I mean specifically Y′UV, a.k.a. YCbCr (if that makes any difference).
While YUV->RGB colorspace conversion is linear (same as "can be expressed as a matrix operation") the RGB->HSL is not. Thus it is not possible to combine the two into a single operation.
Thank you Kel Solaar for confirming this for me.
For reference:
YUV(YCbCr)->RGB conversion
RGB->HSL conversion
Note that mathematically the calculation for Hue is written piecewise as the "base angle" depends on which sector the color is in and the "major color" is driven by the max(R, G, B) expression.
I think they are from the different worlds of interest. Here is a google patent
https://patents.google.com/patent/CN105847775A/en
I have a color specified in the CIE Lab* color space which is outside the range that standard sRGB monitors can display. I'd like to display an approximation of the given color (at the same luminance/L value as specified), but the maths is pretty gnarly and involves finding intersections between piecewise functions and so on.
Is there any reference code for this, or should I forge ahead with the maths?
To clarify: given a point a,b that is NOT within the shape below, I would like to find the nearest a,b that IS within the shape.
Here is an example using mat lab:
http://www.mathworks.com/matlabcentral/fileexchange/24009
Also there is a thread on the reverse function over here that mentions a site that has many programming examples for the conversion.
You could combine "CIE-L*ab —> XYZ" and the "XYZ —> RGB" conversion.
UPDATE:
I just found this:
http://www.cs.washington.edu/research/imagedatabase/summerproject/2004/eye/src/yi/iu/processor/color/CIELab.java
But I couldn't find out what licence it uses, so maybe you should contact the author, if you are using it.
I'm suprised that Google doesn't shed much light on this.
I'm creating a simple CAD viewer using Direct3D. Because of it's nature (zoom functionality etc) text elements must be vector text; I can't use textured polys.
I've called into gdi32.dll to get the glyphs and create quite reasonable text outlines from straight lines and bezier curves, however the text isn't solid and the points aren't necessarily regular in any way. Enclosing characters (b, p, o, A, etc) actually have more than one seperate outline.
As a consequence, I can't just shoot the points into a vertex buffer and specify a primitive type.
All I can do at the moment is render the outlines as line strips, resulting in hallow text.
Can anyone suggest a good strategy for rendering solid vector text with their outlines?
Note that I interpolate the bezier curves into point lists (A lot of people use shaders/witchcraft).
You don't mention what version of DirectX you are using, but the utility function D3DXCreateText will create a 3D mesh for a given text in any TrueType font. If you want a 2D version, simply use no or minimal extrusion, and straight-on orthogonal projection.
If you need explicit outlines, you might be able to either (a) combine this approach with the Outline you already have, (b) draw the text twice at a slightly different scale (depending on current zoom level) or (c) use shaders to draw a pixel-perfect outline.
A screenshot of the exact look-and-feel you are after might help. My CAD drawings all have solid text, no outlines.
I am creating text meshes with D3DXCreateText (Win32, DX9). They rotate nicely. However, they always seem to be the same size regardless of the height of the font that has been selected in the DC.
The mesh lines in smaller characters are aliased and don't look good on video cards without multisampling.