文件名称:Gray-Image
- 所属分类:
- Dephi控件源码
- 资源属性:
- [Dephi] [Pascal] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 9kb
- 下载次数:
- 0次
- 提 供 者:
- dia tr*******
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
procedure GrayScale(const Image:TImage)
var
BytesPerScan: Integer
iWidth, iHeight: Integer
pScanLine: pByteArray
R,G,B: Byte
begin
try
BytesPerScan := Abs(Integer(Image.Picture.Bitmap.ScanLine[1])-
Integer(Image.Picture.Bitmap.ScanLine[0]))
except
raise exception.create(‘Error’)
end
for iHeight := 0 to Image.Picture.Bitmap.Height - 1 do
begin
pScanLine := Image.Picture.Bitmap.ScanLine[iHeight]
iWidth := 0
while(iWidth <= BytesPerScan - 1) do
begin
R := pScanLine^[iWidth + 2]
G := pScanLine^[iWidth + 1]
B := pScanLine^[iWidth + 0]
pScanLine^[iWidth + 2] := Byte(Round(0.299 * R + 0.587 * G + 0.114 * B))
pScanLine^[iWidth + 1] := Byte(Round(0.299 * R + 0.587 * G + 0.114 * B))
pScanLine^[iWidth + 0] := Byte(Round(0.299 * R + 0.587 * G + 0.114 * B))
iWidth := iWidth + 3
end
end
Image.Refresh
end
var
BytesPerScan: Integer
iWidth, iHeight: Integer
pScanLine: pByteArray
R,G,B: Byte
begin
try
BytesPerScan := Abs(Integer(Image.Picture.Bitmap.ScanLine[1])-
Integer(Image.Picture.Bitmap.ScanLine[0]))
except
raise exception.create(‘Error’)
end
for iHeight := 0 to Image.Picture.Bitmap.Height - 1 do
begin
pScanLine := Image.Picture.Bitmap.ScanLine[iHeight]
iWidth := 0
while(iWidth <= BytesPerScan - 1) do
begin
R := pScanLine^[iWidth + 2]
G := pScanLine^[iWidth + 1]
B := pScanLine^[iWidth + 0]
pScanLine^[iWidth + 2] := Byte(Round(0.299 * R + 0.587 * G + 0.114 * B))
pScanLine^[iWidth + 1] := Byte(Round(0.299 * R + 0.587 * G + 0.114 * B))
pScanLine^[iWidth + 0] := Byte(Round(0.299 * R + 0.587 * G + 0.114 * B))
iWidth := iWidth + 3
end
end
Image.Refresh
end
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ImageProcessor6\BrightnessUnit.dfm
...............\BrightnessUnit.pas
...............\ContrastUnit.dfm
...............\ContrastUnit.pas
...............\HistogramUnit.dfm
...............\HistogramUnit.pas
...............\ImageProcessor.dpr
...............\ImageProcessor.res
...............\ImageUnit.dfm
...............\ImageUnit.pas
...............\MainUnit.dfm
...............\MainUnit.pas
...............\BrightnessUnit.pas
...............\ContrastUnit.dfm
...............\ContrastUnit.pas
...............\HistogramUnit.dfm
...............\HistogramUnit.pas
...............\ImageProcessor.dpr
...............\ImageProcessor.res
...............\ImageUnit.dfm
...............\ImageUnit.pas
...............\MainUnit.dfm
...............\MainUnit.pas