请问下,
opencv mat 与 delphi Tbitmap如何转换?
自己尝试了下,在C++里,把mat与windos的Hbitmap进行了转换。
可是在delphi上,Tbitmap与Hbitmap如何转换,不知道怎么实现啊
opencv mat 与 delphi Tbitmap如何转换?
自己尝试了下,在C++里,把mat与windos的Hbitmap进行了转换。
可是在delphi上,Tbitmap与Hbitmap如何转换,不知道怎么实现啊
解决方案 »
- 跨数据库查询
- Delphi 连接数据库高手进!
- XE BUG?
- delphi使用 idftp 创建文件夹失败怎么处理
- fastreport中的master footer如何处理?
- 用ADO 可以连接PARADOX库吗?感谢
- 大哥,大姐。有这么难吗?问题点数:60分
- 兩個日期值怎麼相減?比如“2002-8-28”-“2002-8-20”=8......
- 请教关于使用socket和TstringList更新数据库的问题!
- 有谁知道Font.style是何格式?
- delphi7 使用UniDAC连接Oracle 报Cannt load OCI DLL
- List使用 和返回存储cxgird中改变后的值
function PIplImage2bitmap(p_image:PIplImage): TBitmap;
var
bmp: Tbitmap;
step: integer;
i,j: integer;
p:PbyteArray;
begin
bmp:= Tbitmap.create;
bmp.Width := p_image^.width;
bmp.Height := p_image^.height;
bmp.PixelFormat := pf24bit;
step:= p_image^.widthStep;
for i := 0 to bmp.Height -1 do
begin
p := bmp.ScanLine[i];
for j := 0 to bmp.Width - 1 do
begin
move(PByteArray(p_image^.imageData)^[step*i],p^[0] ,step);
end;
end;
result := bmp;
end;function bitmap2PIplImage(p_bmp:TBitmap): PIplImage;
var
image: PIplImage;
step: integer;
i,j: integer;
p:PbyteArray;
p2: pointer;
begin
//result := nil;
if p_bmp <> nil then
begin
if p_bmp.PixelFormat = pf24bit then
begin
image := cvCreateImage(CvSize(p_bmp.Width,p_bmp.Height),IPL_DEPTH_8U,3);
step:= image^.widthStep;
p2 := image^.imageData;
for i := 0 to p_bmp.Height -1 do
begin
p := p_bmp.ScanLine[i];
move(p^[0],P2^,step);
PAnsiChar(p2) := PAnsiChar(p2) + step;
end;
result := image;
end
else
begin
raise exception.create('This pixelFormat is not implemented!');
end;
end
else
raise exception.create('p_bmp not assigned in function bitmap2cv!');
end;