急,求关于使用vfw读取avi,获取bmp并显示在image上的问题

cyjcxy 2007-05-02 11:04:09
我想把AVI里读出的每个图都放到image里显示出来,然后取image的x,y的RGB存到数据库里
我搜了一下论坛,找到http://community.csdn.net/Expert/topic/5480/5480539.xml?temp=.6559412是把AVI转到BMP的,可写的是C语言,我是初学者,不知怎么转成Delphi代码,有哥哥姐姐,叔叔帮帮忙吗?很急!!
...全文
271 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
pilicat 2007-05-02
  • 打赏
  • 举报
回复
帮顶一下。
cyjcxy 2007-05-02
  • 打赏
  • 举报
回复
我的目的是,想让视频画面显示在Image上或直接取这个画面的每个点的RGB值,求高手帮个忙,很急很急

我目前写到让视频以指定的画面显示在VideoPlayer1播放控件上
procedure TForm1.ShowVideoFrame(SampleIndex: Integer);
var
lpBi:PBitmapInfoHeader;
begin

if FGetVideoFrame=nil then exit;

lpBi:=AVIStreamGetFrame(FGetVideoFrame,SampleIndex);
if assigned(lpBi) then
begin
VideoPlayer1.DrawFrame(lpBI^,nil);
end;

FVideoSampleIndex:=SampleIndex;
end;


这里把VideoPlayer1.DrawFrame的代码放上
Procedure TVideoPlayer.DrawFrame(var bi:TBitmapInfoHeader;Bits:Pointer);
var
L,T,W,H:integer;
i,j:integer;
RGN:HRGN;
begin

if Visible=FALSE then exit;

DrawDIBHandleNeeded;
DrawCanvasNeeded;

if (DrawDIBHandleAllocated=FALSE) OR (DrawCanvasAllocated=FALSE) then
exit;


GetDrawRect(L,T,W,H,bi.biWidth,bi.biHeight);


if FAlignment = fa_TileShow then
begin
RGN:=CreateRectRgn(0,0,Width,Height);
SelectClipRgn(DrawCanvas,RGN);

i:=T;
while i < Height do
begin
j:=L;
while j< Width do
begin
try
DrawDibDraw(
FDrawDIBH,DrawCanvas,j,i,W,H,
@bi,Bits,0,0,-1,-1,
DrawFlagsToDWord(FDrawFlags)
);
except
end;
inc(j,W);
end;
inc(i,H);
end;

FPaintArea.Left := 0 ;
FPaintArea.Top := 0 ;
FPaintArea.Right := Width ;
FPaintArea.Bottom := Height ;

DeleteObject(RGN);
end
else
begin

try
DrawDibDraw(
FDrawDIBH,DrawCanvas,L,T,W,H,
@bi,Bits,0,0,-1,-1,
DrawFlagsToDWord(FDrawFlags)
);
except

end;

RGN:=CreateRectRgn(
FPaintArea.Left,
FPaintArea.Top,
FPaintArea.Right,
FPaintArea.Bottom
);

SelectClipRgn(DrawCanvas,RGN);

if ExcludeClipRect(DrawCanvas,L,T,L+W,T+H) <> NULLREGION then
begin
FillRect(DrawCanvas,FPaintArea,Brush.Handle);
end;

FPaintArea.Left := L ;
FPaintArea.Top := T ;
FPaintArea.Right := L + W ;
FPaintArea.Bottom := T + H ;

DeleteObject(RGN);

end;


ReleaseDrawCanvas;

end;

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi GAME,图形处理/多媒体
社区管理员
  • GAME,图形处理/多媒体社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧