300分高价征求图像采集解决方案(300分)

  • 主题发起人 主题发起人 whitecloud
  • 开始时间 开始时间
W

whitecloud

Unregistered / Unconfirmed
GUEST, unregistred user!
最近要做一个系统,从医院的B超分析仪的Video Output口接收动态的图像到计算机,然后实时播放,本人以前从未有这方面的经验,一时无从下手,请各位大虾指令迷津!需要哪些硬件,程序整体设计思想如何?开发工具用Delphi.
 
视频捕捉卡!
想开发,就找其代SDK的
 
专业型的视频捕捉卡都有附Driver和Dll可使用,因此你要有像Imagelib的组件搭配使用就可。我曾经写过CCD四分割画面的案子,要将影像压缩,如果你是写动态影像的话你要把Video for Windows的说明函数读一遍,如果是写静态影像用上叙的组件就够用了。
 
我使用过的两种视频卡:winnov公司的和av-8卡
可以实现你说的功能.
 
用视频采集卡,然后使用AFW的通用宏即可进行动态采集。

不过不能使用普通的上网用的采集卡:分辨率太低。至少要
640X480吧。

如果不是有特殊要求,一般可以不用采集卡本身的DDK。
 
如果动态图象实时性要求不高,可以选择的卡很多,truevision,miro,Hitech,matrox等都可以
用vfw或自带的sdk都行,数据可以存avi,mpg,jpeg,bmp等。
 
买块卡,上面都有软件的,何必自己开发?
又累又不好
 
我有硬件及软件。
matrox ppb和自编软件
 
用Vfw video for windows
delphi 声明文件在vcl.vclxx.com
我有vcl控件(自编)
实现
视频初始化
单桢捕获
如需要像把分送上,获得原码
 
lbwave:
请将源码发送给我,baino1@163.net,收到后马上奉送300分;
另:程序开发阶段,如何模拟B超仪的视频输入?也请一并赐教!
 
使用windows 提供的 mci 设备,在系统system 目录中有 mmsystem.dll。Delphi 5
封装了所有的 mmsystem.dll 内的函数 ,在 mmsystem.pas 单元中。
使用mci 编程的好处是系统对采集卡的兼容性较好,你也不用看说明书上讨厌的 C
例程了。
如果有必要,我可以贴上原代码。
 
whitecloud:
用普通的多媒体卡,质量不是太好!
硬件:http://www.eachnet.com/cat/single.php?auction_id=10278981
软件:http://www.truepacs.com/html/truecapture.htm

您可以浏览一下!
(我原来从事这方面(DICOM)软件开发,由于各方面原因,我已不再从事了!)
 
某家贴上程序吧:(有BUG通知我,谢谢)
---------------------
<font color=blue>窗体文件</font>
object Form1: TForm1
Left = 288
Top = 159
Width = 462
Height = 404
Caption = 'Form1'
Color = clBtnFace
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -18
Font.Name = '宋体'
Font.Style = []
OldCreateOrder = False
OnClose = FormClose
OnCreate = FormCreate
PixelsPerInch = 120
TextHeight = 18
object Panel2: TPanel
Left = 0
Top = 0
Width = 454
Height = 30
Align = alTop
TabOrder = 0
object SpeedButton1: TSpeedButton
Left = 4
Top = 3
Width = 26
Height = 24
Glyph.Data = {
4E010000424D4E01000000000000760000002800000012000000120000000100
040000000000D800000074120000741200001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
3333330000003300333333333333330000003301003333333333330000003301
9100333333333300000033019991003333333300000033019999910033333300
0000330199999991003333000000330199999999910033000000330199999999
9991030000003301999999999991030000003301999999999100330000003301
9999999100333300000033019999910033333300000033019991003333333300
0000330191003333333333000000330100333333333333000000330033333333
333333000000333333333333333333000000}
OnClick = SpeedButton1Click
end
object SpeedButton2: TSpeedButton
Left = 32
Top = 3
Width = 25
Height = 24
Caption = '抓'
OnClick = SpeedButton2Click
end
object SpeedButton3: TSpeedButton
Left = 60
Top = 3
Width = 25
Height = 24
Caption = '录'
end
object SpeedButton4: TSpeedButton
Left = 87
Top = 3
Width = 26
Height = 24
Caption = '源'
OnClick = SpeedButton4Click
end
object SpeedButton5: TSpeedButton
Left = 116
Top = 3
Width = 25
Height = 24
Hint = '亮度饱和度'
Glyph.Data = {
4E010000424D4E01000000000000760000002800000012000000120000000100
040000000000D800000074120000741200001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
FFFFFF000000FFFFFFF00000000FFF000000FFFFFF0CCCCCCCC0FF000000FFFF
F0CCFCCCCCCC0F000000FFFFF0CCCFCCCCCC0F000000FFFFF80CCFCCCCC0FF00
0000FFF0770CCFCCCCC0FF000000FF07BB0CCFCCCCC0FF000000F07BBBB0CFCC
CC0FFF000000F7BBBFF0CCCCCC0FFF00000007BBFFF0FFF7FF0FFF00000007BB
FFF0FBF7FF0FFF00000007BFFFFF0BF7F0FFFF000000F7BBFFFF000000FFFF00
0000F07BBFFFBB78FFFFFF000000FF07BBBBB70FFFFFFF000000FFF0777770FF
FFFFFF000000FFFFF000FFFFFFFFFF000000}
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton5Click
end
object SpeedButton6: TSpeedButton
Left = 144
Top = 3
Width = 24
Height = 24
Hint = '对比度,色调'
Glyph.Data = {
4E010000424D4E01000000000000760000002800000012000000120000000100
040000000000D800000074120000741200001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
FFFFFF000000F0000000FF0000000F000000FF999999001111110F000000F044
44440FCCCCCCFF000000FF9999990FCCCCCCFF000000F04444440FCCCCCCFF00
0000F04444440F1111110F000000FF9999990F1111110F000000FF9999990F11
11110F000000F044444400CCCCCCFF000000F0444444F0CCCCCCFF000000F044
4444F01111110F000000FF999999F01111110F000000FF999999F0CCCCCCFF00
0000FF999999F01111110F000000F044444400CCCCCCFF000000F0000000FF00
00000F000000FFFFFFFFFFFFFFFFFF000000}
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton6Click
end
object sp_8_24: TSpeedButton
Left = 172
Top = 3
Width = 25
Height = 24
ParentShowHint = False
ShowHint = True
OnClick = sp_8_24Click
end
end
object Panel1: TPanel
Left = 0
Top = 30
Width = 454
Height = 322
Align = alClient
BevelInner = bvLowered
Color = clWindowFrame
TabOrder = 1
object Image1: TImage
Left = 2
Top = 2
Width = 450
Height = 318
Align = alClient
Stretch = True
Visible = False
end
object Image2: TImage
Left = 2
Top = 2
Width = 450
Height = 318
Align = alClient
Stretch = True
Visible = False
end
end
object StatusBar1: TStatusBar
Left = 0
Top = 352
Width = 454
Height = 19
Panels = <>
SimplePanel = False
end
object Timer1: TTimer
Enabled = False
Interval = 100
OnTimer = Timer1Timer
Left = 400
end
object SavePictureDialog1: TSavePictureDialog
Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing]
Left = 256
end
end
//////////////////////////////////////////////////
<font color=blue>单元文件</font>
unit Unit_mci;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus, ExtCtrls, MPlayer, mmsystem, ComCtrls, Clipbrd, Buttons,
ExtDlgs;

type
TForm1 = class(TForm)
Panel2: TPanel;
Panel1: TPanel;
StatusBar1: TStatusBar;
Image1: TImage;
SpeedButton1: TSpeedButton;
Timer1: TTimer;
Image2: TImage;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
sp_8_24: TSpeedButton;
SavePictureDialog1: TSavePictureDialog;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure SpeedButton1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure sp_8_24Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
private
cat_sp_24_8:boolean;
{ Private declarations }
public
procedure mci_SendString(command_str:pchar);
function PlayAviWindow(x_image_1,x_image_2:Timage):boolean;
procedure VideoLoad;
{ Public declarations }
end;

var
Form1: TForm1;

{$R cat_capture.res} //引用资源文件

implementation

uses Unit_mci_source, Unit_mci_change;

{$R *.DFM}

//-----------.* * 自定义函数/过程 * *.-------------------------
// *
// * 过程:mci_SendString(command_str:pchar)
// * 功能:封装 API -> MciSendString(...)
//API 原形(在 mmsystem.pas 中):
//function mciSendString(lpstrCommand, lpstrReturnString: PChar;
// uReturnLength: UINT; hWndCallback: HWND): MCIERROR; stdcall;
//function mciGetErrorString(mcierr: MCIERROR; pszText: PChar; uLength: UINT): BOOL; stdcall;
//function mciExecute(pszCommand: LPCSTR): BOOL; stdcall;
procedure TForm1.mci_SendString(command_str:pchar);
var
ret : Longint;
tstr : array[0..200] of char;
begin
ret := mciSendString(command_str,nil,0,0); // ?form1
If not(ret=0) Then
begin
mciGetErrorString(ret,tstr,200); //
end;
end;

function TForm1.PlayAviWindow(x_image_1,x_image_2:Timage):boolean; //自定义
begin
result := false;
StatusBar1.SimpleText := '播放视频……';
//
mci_sendstring('copy cat_mci'); //300x200
if Clipboard.HasFormat(CF_BITMAP)=true then
begin
if x_image_1.Visible=false then
begin
x_image_1.Picture.Assign(Clipboard);
x_image_2.Visible := false;
x_image_1.Visible := true;
end else begin
x_image_2.Picture.Assign(Clipboard);
x_image_1.Visible := false;
x_image_2.Visible := true;
end;
mci_SendString('unfreeze cat_mci');
//
result := true;
end;
end;

procedure TForm1.VideoLoad; //加载图象时初始化图象性质
begin
mci_Sendstring('freeze cat_Mci');
mci_SendString('SetVideo cat_mci bitsperpel to 24');
mci_Sendstring('unfreeze cat_Mci');
sp_8_24.Glyph.Handle := LoadBitmap(HInstance,'A_24_8');
sp_8_24.Hint := '转换成黑白图象';
end;

//==================================================

procedure TForm1.FormCreate(Sender: TObject);
begin
speedbutton2.Enabled := false;
speedbutton3.Enabled := false;
speedbutton4.Enabled := false;
speedbutton5.Enabled := false;
speedbutton6.Enabled := false;
sp_8_24.Enabled := false;
//
cat_sp_24_8 :=false;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
mci_SendString('close cat_mci');
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
mci_SendString('open overlay alias cat_mci');
VideoLoad;
timer1.enabled := true;
//
speedbutton2.Enabled := true;
speedbutton3.Enabled := true;
speedbutton4.Enabled := true;
speedbutton5.Enabled := true;
speedbutton6.Enabled := true;
sp_8_24.Enabled := true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if PlayAviWindow(image1,image2)=false then
application.MessageBox('播放视频失败。','MCI 设备',mb_ok+mb_iconStop);
end;

procedure TForm1.sp_8_24Click(Sender: TObject); // -- ok --
begin
mci_SendString('freeze cat_mci');
if cat_sp_24_8=false then
begin
mci_SendString('SetVideo cat_mci bitsperpel to 8');
sp_8_24.Glyph.Handle := LoadBitmap(HInstance,'A_8_24');
cat_sp_24_8 := true;
sp_8_24.Hint := '转换成彩色图象';
end else begin
mci_SendString('SetVideo cat_mci bitsperpel to 24');
sp_8_24.Glyph.Handle := LoadBitmap(HInstance,'A_24_8');
cat_sp_24_8 := false;
sp_8_24.Hint := '转换成黑白图象';
end;
mci_SendString('unfreeze cat_mci');
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
savePictureDialog1.Filter := '*.BMP|*.bmp+*.JPG|*.jpg';
savePictureDialog1.DefaultExt := 'BMP';
if SavePictureDialog1.Execute=true then
if image1.Visible=true then
image1.Picture.SaveToFile(SavePictureDialog1.filename)//'aa.bmp')
else
image2.Picture.SaveToFile(SavePictureDialog1.filename);//'aa.bmp');
end;

procedure TForm1.SpeedButton5Click(Sender: TObject);
var
aa1:string;
aa2:array[0..127] of char;
reg01:TRegistry;
begin
form_change.Caption := '调节亮度和饱和度';
//
if form_change.ShowModal=mrok then
begin
mci_sendstring('freeze cat_mci');
//
aa1 := strpas('setvideo cat_mci brightness to ');
aa1 := aa1+form_change.Edit1.text;
strpcopy(aa2,aa1);
mci_SendString(aa2);
//
aa1 := strpas('setvideo cat_mci color to ');
aa1 := aa1+form_change.Edit2.text;
strpcopy(aa2,aa1);
mci_SendString(aa2);
//
mci_Sendstring('unfreeze cat_mci');
end;
end;

procedure TForm1.SpeedButton6Click(Sender: TObject);
var
aa1:string;
aa2:array[0..127] of char;
reg02:Tregistry;
begin
form_change.Caption := '调节对比度和色调值';
//
if form_change.ShowModal=mrok then
begin
mci_Sendstring('freeze cat_mci');
//
aa1 := strpas('setvideo cat_mci contrast to ');
aa1 := aa1+form_change.Edit1.text;
strpcopy(aa2,aa1);
mci_SendString(aa2);
//
aa1 := strpas('setvideo cat_mci tint to ');
aa1 := aa1+form_change.Edit2.text;
strpcopy(aa2,aa1);
mci_SendString(aa2);
//
mci_Sendstring('unfreeze cat_mci');
end;
end;

procedure TForm1.SpeedButton4Click(Sender: TObject);
var
aa1:string;
aa2:array[0..127] of char;
begin
if form_source.ShowModal=mrok then
begin
mci_Sendstring('freeze cat_mci');
//
aa1 := strpas('setvideo cat_mci number ')+form_source.aa;
strpcopy(aa2,aa1);
mci_Sendstring(aa2);
//
mci_Sendstring('unfreeze cat_mci');
end;
end;

end.
 
在下用Deplphih和MicroView d 的 V3A做过一个实时采集加图象处理的
PROJECT
可以方便地实时播放,2个Procedure 搞定,有Pas头文件
国产货,便宜
一般图象采集卡都有此功能,60帧/S,隔行扫描
如果仅仅动态显示,而不必图象处理,太easy
if you want capture image in high speed (100-1000/s)
pray for money please

哇,乱码
 
大部分高质量的采集卡是不提供Delphi 的SDK 的,只有用VC 开发,(太不公平了);
采用VFW 的采集又受到 2G 的文件大小限制,就是说,采用较高质量的话,
 25fp/s(50field/s) Pal制 720x576 pixels 128KB/Frame
每次超过11 分钟,该文件就不可用了。现在在NT 平台上突破2G 的方案采用的为
DirectShow,较复杂.

当然,要求不高就另当别论了。
 
多人接受答案了。
 
后退
顶部