Method for color space conversion from HSL to RGB

A technology of color space conversion and calibration method, which is applied in the field of HSL to RGB color space conversion, can solve the problems of poor compatibility and low efficiency of floating-point operation, and achieve the effects of improving efficiency, reducing system cost, and expanding the scope of application

Inactive Publication Date: 2014-02-05
无锡硅奥科技有限公司
View PDF8 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0020] That is, when converting HSL to RGB space in the prior art, the compatibility of the a

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for color space conversion from HSL to RGB

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0032] Take an 8-bit microcontroller to realize color space conversion as an example, such as figure 1 shown, including the following steps:

[0033] 1) Calibrate the HSL, the range is between 0 and 240;

[0034] 2) If S=0, then RGB is equal, and the fixed-point calculation is calibrated, and the range of RGB is between 0 and 255;

[0035] 3) If S≠0, then calculate p, q, hk at fixed point; initialize tR, tG, tB at fixed point; calculate tc corresponding to each color at fixed point; calculate corresponding color according to tc, p, q; calibrate RGB, the range of RGB is Between 0 and 255.

[0036] The specific process is as follows:

[0037] void hsl2rgb(u8 h,u8 s,u8 l,u8 *r,u8 *g,u8 *b)

[0038] {

[0039] unsigned short R, G, B;

[0040] unsigned char i;

[0041] if(s == 0)

[0042] {

[0043] R = G = B = l*255 / 240;

[0044] }

[0045] else

[0046] {

[0047] unsigned char q = (l<120)?((unsigned short)(l * (240+s...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a method for color space conversion from HSL to RGB. The method includes the steps that standardization is carried out on the HSL, and the scope ranges from 0 to 240; if S equals to zero, the R, G and B are equal, fixed-point calculation standardization is carried out, and the scope of the RGB ranges from 0 to 255; if the S is not equal to zero, fixed-point calculation is carried out on p, q and hk; fixed-point initialization is carried out on t R, t G and t B; the fixed-point calculation is carried out on tc corresponding to each color; the corresponding colors are calculated according to the tc, the p and the q; standardization is carried out on the RGB, and the scope of the RGB ranges from 0 to 255. The method has the advantages that fixed-pointed processing is adopted, the method can be used in embedded 8-bit, 16-bit and 32-bit single-chip microcomputer systems and X86 systems, so the application scope is broadened greatly; some applications can be achieved on the single-chip microcomputers, so the system cost is reduced greatly; in addition, the efficiency of the floating point arithmetic mode is also improved.

Description

technical field [0001] The invention relates to the technical field of video and image processing, in particular to a method for converting an HSL to RGB color space. Background technique [0002] RGB (Red Green Blue) is a space defined based on the colors recognized by the human eye and can represent most colors. It is the most general hardware-oriented color model. However, the RGB color space is generally not used in scientific research, because its details are difficult to adjust digitally; in addition, it expresses the three quantities of hue, saturation, and brightness together, and it is difficult to separate them. [0003] The HSL color mode is a color standard in the industry. It obtains a variety of colors by changing the three color channels of hue (H), saturation (S), and brightness (L) and superimposing them with each other. In terms of color, HSL is the color representing the three channels of hue, saturation, and brightness. This standard includes almost all...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): H04N9/64
Inventor 倪伟郭彦锋张继璠
Owner 无锡硅奥科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products