问题描述
这个是毕业设计要做的求教过很多次再次感谢了但是都看不明白最好能指点细致些我下载吧整个程序都发过来请高手前辈帮忙解决图片问题要求是把指纹获取的图片保存到数据库里面然后验证的时候再从数据库中提取出来然后对比程序有特殊的算法他把图片是存放的本地C盘中了但是老师要求放到数据里面这点难倒我了sdk也给了demo程序了但是里面没有数据这方面的请高手帮帮我是在是不清楚怎么办了下面程序的请高手帮我把数据库这块解决了真不好意思麻烦大家了DimFMatchTypeAsIntegerDimisConnectedAsBooleanDimfpcHandleAsIntegerDimFIDAsIntegerDimRegTemplateAsObjectDimVerTemplateAsObjectDimtempstrAsStringPrivateSubAxZKFPEngX1_OnFingerTouching(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesAxZKFPEngX1.OnFingerTouchingEndSubPrivateSubPictureBox1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesPictureBox1.ClickEndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickIfAxZKFPEngX1.InitEngine()=0ThenStatusBar1.Panels(0).Text="SensorConnected"TextBox1.Text=AxZKFPEngX1.SensorCount.ToString()TextBox2.Text=AxZKFPEngX1.SensorIndex.ToString()TextBox3.Text=AxZKFPEngX1.SensorSNTextBox4.Text=AxZKFPEngX1.ImageWidth.ToString()TextBox5.Text=AxZKFPEngX1.ImageHeight.ToString()FMatchType=0isConnected=TrueElseStatusBar1.Panels(0).Text="SensorDisconneted"TextBox1.Text=""TextBox2.Text=""TextBox3.Text=""isConnected=FalseEndIfEndSubPrivateSubAxZKFPEngX1_OnImageReceived(ByValsenderAsObject,ByValeAsAxZKFPEngXControl.IZKFPEngXEvents_OnImageReceivedEvent)HandlesAxZKFPEngX1.OnImageReceivedDimcanvasAsGraphics=PictureBox1.CreateGraphicsDimdcAsIntPtr=canvas.GetHdc()AxZKFPEngX1.PrintImageAt(dc.ToInt32,0,0,PictureBox1.Width,PictureBox1.Height)canvas.Dispose()EndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickIfNotisConnectedThenReturnIfRadioButton1.CheckedThenAxZKFPEngX1.SaveBitmap("c:fingerprint.bmp")ElseAxZKFPEngX1.SaveJPG("c:fingerprint.jpg")EndIfMessageBox.Show("保存成功","Warn",MessageBoxButtons.OK)EndSubPrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickIfAxZKFPEngX1.IsRegisterThenAxZKFPEngX1.CancelEnroll()AxZKFPEngX1.BeginEnroll()EndSubPrivateSubAxZKFPEngX1_OnEnroll(ByValsenderAsObject,ByValeAsAxZKFPEngXControl.IZKFPEngXEvents_OnEnrollEvent)HandlesAxZKFPEngX1.OnEnrollIfe.actionResultThenFID=FID+1RegTemplate=e.aTemplateAxZKFPEngX1.AddRegTemplateToFPCacheDB(fpcHandle,FID,e.aTemplate)TextBox6.Text=FID.ToString()MessageBox.Show("RegisterSuccess","Warn",MessageBoxButtons.OK)EndIfEndSubPrivateSubAxZKFPEngX1_OnCapture(ByValsenderAsObject,ByValeAsAxZKFPEngXControl.IZKFPEngXEvents_OnCaptureEvent)HandlesAxZKFPEngX1.OnCaptureIfe.actionResultThenVerTemplate=e.aTemplateDimscoreAsInteger=0DimprocessedFPNumberAsIntegerDimIDAsIntegerAxZKFPEngX1.OneToOneThreshold=Int32.Parse(TextBox7.Text)AxZKFPEngX1.Threshold=Int32.Parse(TextBox5.Text)IfFMatchType=1ThenDimbAsBooleanIfAxZKFPEngX1.VerFinger(RegTemplate,e.aTemplate,False,b)Thentempstr="VerifySuccess!FingerNumis"+FID.ToString()MessageBox.Show(tempstr,"Warn",MessageBoxButtons.OK)ElseMessageBox.Show("Verifyfailed","Warn",MessageBoxButtons.OK)EndIfEndIfIfFMatchType=2ThenID=AxZKFPEngX1.IdentificationInFPCacheDB(fpcHandle,e.aTemplate,score,processedFPNumber)tempstr="VerifySuccess!FingerNumis"+ID.ToString()MessageBox.Show(tempstr,"Warn",MessageBoxButtons.OK)EndIfEndIfEndSubPrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.ClickIfAxZKFPEngX1.IsRegisterThenAxZKFPEngX1.CancelEnroll()AxZKFPEngX1.BeginCapture()FMatchType=1EndSubPrivateSubButton5_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton5.ClickIfAxZKFPEngX1.IsRegisterThenAxZKFPEngX1.CancelEnroll()AxZKFPEngX1.BeginCapture()FMatchType=2EndSubPrivateSubForm1_Closed(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesMyBase.ClosedAxZKFPEngX1.FreeFPCacheDB(fpcHandle)EndSub下面这个事说明文档是程序说明给的但是完全看不懂要是高手能帮我用vb代码说名下做好求教了数据库中指纹模板写入和读出SDK中指纹模板是以Vairant变量的方式保存和传递,其存储的是一维二进制字节数组,不能像字符串一样直接用SQL语句写入和读出,有下面处理方法:1、EncodeTemplate和DecodeTemplate方法可以在Variant变量和字符串变量之间互相进行BASE64编码转换,转换为字符串后,模板长度会增加大约1/3。2、在OnEnroll事件和OnCapture事件中直接调用GetTemplateAsString方法得到相应字符串形式的登记模板和比对模板。3、直接操作Variant变量,下面是操作示例:Delphi,CB:procedureTFPProcess.SaveFPData(AQuery:TADOQuery;AFingerID:Integer;AFPData:OleVariant);varpData:PChar;beginwithAQuerydobeginClose;SQL.Clear;SQL.Add('SELECT*FROMzkFingerPrintWHEREFingerID='+IntToStr(AFingerID));Open;ifIsEmptythenAppendelseEdit;FieldByName('FingerID').Value:=AFingerID;//保存指纹模板withTBlobStream(CreateBlobStream(FieldByName('Template'),bmWrite))dobeginpData:=VarArrayLock(AFPData);tryWrite(pData^,VarArrayHighBound(AFPData,1)-VarArrayLowBound(AFPData,1)+1);finallyVarArrayUnlock(AFPData);end;Free;end;Post;Close;end;end;procedureTFPProcess.GetFPData(AQuery:TADOQuery;AFingerID:Integer;varAFPData:OleVariant);varpData:PChar;beginwithAQuerydobeginClose;SQL.Clear;SQL.Add('SELECT*FROMzkFingerPrintWHEREFingerID='+IntToStr(AFingerID));Open;//读取数据ifnotIsEmptythenwithTBlobStream(CreateBlobStream(FieldByName('Template'),bmRead))dobeginAFPData:=VarArrayCreate([0,Size+1],varByte);pData:=VarArrayLock(AFPData);tryRead(pData^,Size);finallyVarArrayUnlock(AFPData);end;Free;end;Close;end;end;