我想把AVI里读出的每个图都放到image里显示出来,然后取image的x,y的RGB存到数据库里
我搜了一下论坛,找到http://community.csdn.net/Expert/topic/5480/5480539.xml?temp=.6559412是把AVI转到BMP的,可写的是C语言,我是初学者,不知怎么转成Delphi代码,有哥哥姐姐,叔叔帮帮忙吗?很急!!

解决方案 »

  1.   

    我的目的是,想让视频画面显示在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;