How to control a camera with Delphi

后端 未结 3 902
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 10:22

A Delphi programm should make produkt photos with a Nikon D5000AF SDX. The only commands I need are \"make a photo\", \"get me the photo\".

Which library or API can

3条回答
  •  日久生厌
    2021-01-03 10:41

    • you can use wia (windows image acquisition)
    • from component menu select import component and select windows image acquisition and install it
    • or download and add to your project
    • then
    • if you are use win xp
    • start new project and put
    • new Button named Button1
    • new CheckBox named MultiPic
    • and copy the cod and past in Button1

    the cod:

    procedure TForm1.Button1Click(Sender: TObject);
    var
       wia:IWia;
       WiaInf: IWiaDeviceInfo;
       wiaImg: IWiaDispatchItem;
       I:integer;
       Coll: ICollection;
    begin
      wia:=CoWia.Create;
      WiaInf:= WIA.Devices.Item[0] as IWiaDeviceInfo;
      wiaImg:=WiaInf.Create;
      if MultiPic.Checked then
      begin
        coll:=wiaImg.GetItemsFromUI(UseCommonUI, MaximizeQuality);
        for I := 0 to coll.Count - 1 do
          begin
            wiaImg:=coll.Item[i]  as IWiaDispatchItem ;
            wiaImg.Transfer('C:\Source\test'+inttostr(i)+'.bmp',false);
          end;
      end
      else
      begin
        wiaImg:=wiaImg.GetItemsFromUI(SingleImage, MaximizeQuality).Item[0]  as IWiaDispatchItem ;
        wiaImg.Transfer('C:\Source\test.bmp',false);
      end;
    end;
    
    • i use CheckBox to for user Determine if he want 1 picture or multi pictures

    • you can load the Picture/s to image by loadfromfile

提交回复
热议问题