Delphi下的 YCrCb RGB 转换
来源:互联网 发布:淘宝足球装备 编辑:程序博客网 时间:2024/05/19 05:31
for i := 0 to Form1.Image1.Picture.Width do
for j := 0 to Form1.Image1.Picture.Height do
begin
R:= (Form1.Image1.Canvas.Pixels[i,j] and $FF0000) shr 16;
G:= (Form1.Image1.Canvas.Pixels[i,j] and $FF00) shr 8;
B:= (Form1.Image1.Canvas.Pixels[i,j] and $FF) ;
Y := Trunc((66*R + 129*G + 25*B + 128)/256.0 + 16);
Cb := Trunc((-38*R - 74*G + 112*B + 128)/256.0 + 128);
Cr := Trunc((112*R - 94*G - 18*B + 128)/256.0 + 128);
if Y<0 then
Y:=0
else if Y>255 then
Y:=255;
if Cr<0 then
Cr:=0
else if Cr>255 then
Cr:=255;
if Cb<0 then
Cb:=0
else if Cb>255 then
Cb:=255;
Y:= Y- 16;
Cb:=Cb- 128;
Cr:=Cr- 128;
R := (298*Y + 409*Cr + 128)/256;
G := (298*Y - 100*Cb - 208*Cr + 128)/256;
B := (298*Y + 516*Cb + 128)/256;
if R<0 then
R:=0
else if R>255 then
R:=255;
if G<0 then
G:=0
else if G>255 then
G:=255;
if B<0 then
B:=0
else if B>255 then
B:=255;
Form1.Image2.Canvas.Pixels[i,j]:=RGB( Trunc(B),Trunc(G),Trunc(R)) ;
for j := 0 to Form1.Image1.Picture.Height do
begin
R:= (Form1.Image1.Canvas.Pixels[i,j] and $FF0000) shr 16;
G:= (Form1.Image1.Canvas.Pixels[i,j] and $FF00) shr 8;
B:= (Form1.Image1.Canvas.Pixels[i,j] and $FF) ;
Y := Trunc((66*R + 129*G + 25*B + 128)/256.0 + 16);
Cb := Trunc((-38*R - 74*G + 112*B + 128)/256.0 + 128);
Cr := Trunc((112*R - 94*G - 18*B + 128)/256.0 + 128);
if Y<0 then
Y:=0
else if Y>255 then
Y:=255;
if Cr<0 then
Cr:=0
else if Cr>255 then
Cr:=255;
if Cb<0 then
Cb:=0
else if Cb>255 then
Cb:=255;
Y:= Y- 16;
Cb:=Cb- 128;
Cr:=Cr- 128;
R := (298*Y + 409*Cr + 128)/256;
G := (298*Y - 100*Cb - 208*Cr + 128)/256;
B := (298*Y + 516*Cb + 128)/256;
if R<0 then
R:=0
else if R>255 then
R:=255;
if G<0 then
G:=0
else if G>255 then
G:=255;
if B<0 then
B:=0
else if B>255 then
B:=255;
Form1.Image2.Canvas.Pixels[i,j]:=RGB( Trunc(B),Trunc(G),Trunc(R)) ;
end;
下载地址:点击打开链接
0 0
- Delphi下的 YCrCb RGB 转换
- RGB与YCrCb相互转换
- RGB-YCrCb
- YCrCb(YUV) & RGB
- 【VNC】YCrCb - YUV - RGB
- YCrCb/YUV/RGB
- rgb转YCrCb
- 【图像处理】RGB与YCrCb互转
- YIQ、YUV、YCrCb 与 RGB关系
- Delphi图像处理 -- RGB与HSV转换
- Delphi图像处理 -- RGB与HSL转换
- YCrCb
- YCrCb
- Delphi下的进制转换
- Delphi下常用转换
- YUV(YCrCb)和RGB 和HSVHSL 图像信号
- YUV和YCrCb的差异
- yuv和ycrcb的差异
- POJ_1698_Alice's Chance
- Eclipse导入自定义Schema文件
- Python 变量赋值过程
- xsi:schemaLocation详解
- Python 调试器debugger
- Delphi下的 YCrCb RGB 转换
- window用ssh连接本机虚拟机中的ubuntu
- Dojo实现Tabs页报错(一)
- 【读书笔记】卧底经济学
- Python 为什么需要使用__name__=='__main__'
- 求模m的逆元
- mysql数据库配置之全局参数设置
- Python random模块
- XML Schema File VS. XML File