各位高手,我作了一个图像采集的东西,但是因为我的采集箱里面光线不标准,所以采集出来的图像颜色有偏差,我想在采集箱里面放一个三原色的色标,采集完图像后,根据色标的色差调节整个图像的颜色,达到还原的目的,哪位能告诉我这个色彩还原该怎么做呀?在此先行谢过!!!
解决方案 »
- SQLConnection1和MDI子窗体释放问题
- 让我抓瞎了两天的Locate:Dbexpress中Locate中检索TDateTime数据不行吗?
- 一个函数的问题
- 问个有关db格式的表的问题!
- 很多分等你来拿!!!
- 大问题 在退出一个循环后发现的问题
- 谁能告诉我sql中对有小时,分,秒的datetime类型如何只取年月日
- 一个多层应用的问题:怎样防止DbGrid在滚动时ClientDataSet取得下一个数据包???一定送分!!!
- vb和delphi到底那个好?
- Delphi安卓如何读写外置存储卡?(获取权限)
- 数据驱动问题?
- 请问TClientDataset的ProviderName为何没有选项?
Var
B,R,G:Single;
然后获得原色率Function IntToByte(i: Integer): Byte;
Begin
If i > 255 Then Result := 255
Else If i < 0 Then Result := 0
Else Result := i;
End;
type
PRGBTripleArray = ^TRGBTripleArray;
TRGBTripleArray = array[0..32767] of TRGBTriple;
function GetSLCOlor(pRGB: TRGBTriple): TColor;
begin
Result := RGB(pRGB.rgbtRed, pRGB.rgbtGreen, pRGB.rgbtBlue);
end;
var
b, p: PRGBTripleArray;
x, y: Integer;
BaseColor: TColor;
begin
Bmp.PixelFormat := pf24Bit;
for y := 0 to dBmp.Height - 1 do
begin
p := Bmp.scanline[y];
for x := 0 to (Bmp.Width - 1) do
begin
b[x].rgbtBlue :=IntToByte(Round(p[x].rgbtBlue*B));//通过原色率得到正确蓝色
b[x].rgbtGreen:= IntToByte(Round(p[x].rgbtGreen*G));//通过原色率得到正确绿色
b[x].rgbtRed:= IntToByte(Round(p[x].rgbtRed*R));//通过原色率得到正确红色
end;
end;end;
1:你所说的色彩还原率是怎么得到的,是不是用有偏差的三原色值除255得到的?
2:程序每次运行到b[x].rgbtBlue :=IntToByte(Round(p[x].rgbtBlue*B));//通过原色率得到正确蓝
就出错了,这是怎么回事呀?
把这行的dBmp改为Bmp试试:
for y := 0 to dBmp.Height - 1 do
此段代码不需要定义其它的BitMap对象