笔迹鉴别程序
考试的笔迹鉴别程序,分辨出不同人写的笔迹
This commit is contained in:
123
测试/服务器测试/输出文件/输出待检测检测文件 source/DBop.cpp
Normal file
123
测试/服务器测试/输出文件/输出待检测检测文件 source/DBop.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
实现文件:DBop.cpp 数据库操作实现文件
|
||||
*/
|
||||
#include "DBop.h"
|
||||
|
||||
/*本地的全局变量*/
|
||||
|
||||
_ConnectionPtr p_conn; /*全局变量 连接对象*/
|
||||
_RecordsetPtr p_recordset; /*全局变量 记录集对象*/
|
||||
_CommandPtr p_cmd; /*全局变量 操作集对象*/
|
||||
string str_conn; /*全局变量 连接字符串设置*/
|
||||
|
||||
|
||||
/**
|
||||
功能: 查询所有学生的学号,将所有的指定位置的数据库信息(学号)全部存储在名为stu的vector<string>型的变量中
|
||||
|
||||
@变量 stu 学生学号存储
|
||||
@返回值 成功1 失败0
|
||||
*/
|
||||
int DbStu(vector<string>& stu)
|
||||
{
|
||||
/*字符转换,方便使用*/
|
||||
string userName(g_db_userName.c_str());
|
||||
string password(g_db_password.c_str());
|
||||
string hostName(g_db_hostName.c_str());
|
||||
string dBName(g_db_dBName.c_str());
|
||||
|
||||
//连接字串设置 //因为strConn是全局变量,因此仅仅初始化一次
|
||||
str_conn = "Provider=OraOLEDB.Oracle";
|
||||
str_conn += ";Persist Security Info = true";
|
||||
str_conn += ";User ID = "; //==================//
|
||||
str_conn += userName; //===仅初始化一次===//
|
||||
str_conn += ";Password="; //==================//
|
||||
str_conn += password;
|
||||
str_conn += ";Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)";
|
||||
str_conn += "(HOST=";
|
||||
str_conn += hostName;
|
||||
str_conn += ")(PORT=1521))(CONNECT_DATA=";
|
||||
str_conn += "(SERVICE_NAME=";
|
||||
str_conn += dBName;
|
||||
str_conn += ")))";
|
||||
|
||||
::CoInitialize(NULL);//初始化com组件
|
||||
|
||||
//连接数据库,并执行sql查询语句 【必须要用try catch捕获异常】
|
||||
try{
|
||||
p_conn.CreateInstance("ADODB.Connection");//创建连接
|
||||
p_recordset.CreateInstance("ADODB.Recordset");//创建结果集,也就是实例化
|
||||
p_cmd.CreateInstance("ADODB.Command");
|
||||
|
||||
p_conn->CursorLocation = adUseClient; //存储过程同时返回记录集和返回值
|
||||
p_conn->Open(_bstr_t(str_conn.c_str()), _bstr_t(userName.c_str()), _bstr_t(password.c_str()), adConnectUnspecified);
|
||||
p_cmd->ActiveConnection = p_conn;
|
||||
|
||||
//SELECT KS_ZKZ FROM ZK.V_BYSQ_BJSH_JQ_KS
|
||||
//SELECT DISTINCT(KS_ZKZ2) FROM ZK.T_BYSQ_KS_KC WHERE KSSJ BETWEEN '200907' AND '201510'
|
||||
//SELECT * FROM ZK.T_BYSQ_KS_KC WHERE (SUBSTR(KS_ZKZ2,1,2) = '02' OR SUBSTR(KS_ZKZ2,1,2) = '03')
|
||||
//SELECT KS_ZKZ2 FROM ZK.T_BYSQ_KS_KC WHERE KSSJ between '200907' and '201510' AND (SUBSTR(KS_ZKZ2,1,2) = '02') AND BJSH_JG_JQ IS NULL GROUP BY KS_ZKZ2 HAVING COUNT(KS_ZKZ2)>1
|
||||
/*HRESULT hr1 = pRecordset->Open("SELECT KS_ZKZ FROM ZK.T_BYSQ_KS_KC WHERE KSSJ between '200907' and '201510' AND (SUBSTR(KS_ZKZ2,1,2) = '02') AND BJSH_JG_JQ IS NULL GROUP BY KS_ZKZ HAVING COUNT(KS_ZKZ)>1",*/
|
||||
|
||||
|
||||
/*构造查询语句*/
|
||||
int zong_flag = g_db_qurry_zone.length();
|
||||
int num_flag = g_db_qurry_stu_num.length();
|
||||
int date_flag = g_db_qurry_start.length();
|
||||
|
||||
string str_qurry = "SELECT KS_ZKZ FROM YANNSY.T_BYSQ_KS_KC WHERE KSSJ between ";
|
||||
str_qurry += g_db_qurry_start;
|
||||
str_qurry += " and ";
|
||||
str_qurry += g_db_qurry_end;
|
||||
|
||||
// cout<<str_qurry.c_str()<<endl;
|
||||
if (num_flag - 1)//长度大于1,就是需要查询学号
|
||||
{
|
||||
str_qurry += "AND KS_ZKZ = ";
|
||||
str_qurry += g_db_qurry_stu_num;
|
||||
}
|
||||
else//不需要查询单个学号才会有区域的作用范围
|
||||
{
|
||||
if ((zong_flag - 1))//长度大于1,就是需要查询区域,且查询时间
|
||||
{
|
||||
str_qurry += " AND(SUBSTR(KS_ZKZ2, 1, 2) = ";
|
||||
str_qurry += g_db_qurry_zone;
|
||||
str_qurry += ")";
|
||||
}
|
||||
}
|
||||
if (g_db_qurry_all)
|
||||
{
|
||||
str_qurry += " AND BJSH_JG_JQ IS NULL";
|
||||
}
|
||||
str_qurry += " GROUP BY KS_ZKZ HAVING COUNT(KS_ZKZ)>1";
|
||||
_variant_t _vstr_qurry(str_qurry.c_str());/* 转换string为_variant_t */
|
||||
|
||||
|
||||
|
||||
/*查询*/
|
||||
HRESULT hr1 = p_recordset->Open(_vstr_qurry,
|
||||
p_conn.GetInterfacePtr(),
|
||||
adOpenStatic,
|
||||
adLockOptimistic,
|
||||
adCmdText);
|
||||
if (!(SUCCEEDED(hr1))){ exit(-1); }//读取不成功,直接退出程序
|
||||
|
||||
int count_exit = 10;
|
||||
do
|
||||
{//读取成功,将每一行存到vector的stu末尾
|
||||
stu.push_back((string)(_bstr_t)(p_recordset->Fields->GetItem(_variant_t("KS_ZKZ"))->GetValue()));
|
||||
p_recordset->MoveNext();//移到下一条
|
||||
} while (!p_recordset->EndOfFile && count_exit--);//条件是没有到所有记录的末尾
|
||||
}
|
||||
catch (_com_error e){
|
||||
cout << "<提取学号(数据库):>查询失败--" << endl;
|
||||
cout<<e.Error()<<" "<<e.ErrorMessage()<<" "<<e.ErrorInfo()<<endl;
|
||||
}
|
||||
/*=================================================================================================*/
|
||||
|
||||
//3、关闭查询====//执行读取完毕后要关闭连接
|
||||
try { ::CoUninitialize(); }
|
||||
catch (_com_error e){ /*cout << "<提取学号:关闭失败-->" << e.ErrorInfo() << endl;*/ }
|
||||
|
||||
cout<<"查询完毕"<<endl;
|
||||
return 1;
|
||||
}
|
||||
58
测试/服务器测试/输出文件/输出待检测检测文件 source/DBop.h
Normal file
58
测试/服务器测试/输出文件/输出待检测检测文件 source/DBop.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
头文件:DBop.h 数据库操作头文件
|
||||
*/
|
||||
#pragma once
|
||||
#import "msado15.dll" no_namespace rename("EOF","EndOfFile")
|
||||
|
||||
//#import "C:/Program Files/Common Files/System/ado/msado15.dll" no_namespace rename("EOF","EndOfFile")
|
||||
/*#if defined(ADO2_OLD)
|
||||
#pragma message( "Using ADO2 TLB" )
|
||||
#import <msado20.tlb> no_namespace rename("EOF", "adoEOF")
|
||||
#else #pragma message( "Using Latest ADO" )
|
||||
#import <msado15.dll> no_namespace rename("EOF", "adoEOF")
|
||||
#endif
|
||||
*/
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*全局变量*/
|
||||
|
||||
/*全局变量*/
|
||||
|
||||
extern char g_log_adr[50]; /*全局变量 程序日志存储地址*/
|
||||
extern char g_log_rec[500]; /*全局变量 程序日志专用变量*/
|
||||
extern FILE *g_log_fpzz; /*全局变量 程序日志专用文件句柄*/
|
||||
|
||||
extern string g_db_hostName; /*全局变量 服务器ip或名称*/
|
||||
extern string g_db_dBName; /*全局变量 服务器ODBC数据源*/
|
||||
extern string g_db_userName; /*全局变量 服务器用户名*/
|
||||
extern string g_db_password; /*全局变量 服务器密码*/
|
||||
|
||||
extern string g_db_qurry_start; /*全局变量 数据库查询_开始日期*/
|
||||
extern string g_db_qurry_end; /*全局变量 数据库查询_结束日期*/
|
||||
extern string g_db_qurry_zone; /*全局变量 数据库查询_特定区域*/
|
||||
extern string g_db_qurry_stu_num; /*全局变量 数据库查询_特定考号*/
|
||||
extern bool g_db_qurry_all; /*全局变量 数据库查询_查询全部标记*/
|
||||
extern string g_db_hoster_zk; /*全局变量 数据库用户,zk(考试院的zk,本地的yannsy)*/
|
||||
/*****************************************函数原型*************************************/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
功能: 查询所有学生的学号,将所有的指定位置的数
|
||||
据库信息(学号)全部存储在名为stu的vector<string>型
|
||||
的变量中
|
||||
|
||||
@变量 stu 学生学号存储
|
||||
@返回值 成功1 失败0
|
||||
*/
|
||||
int DbStu(vector<string>& stu);
|
||||
|
||||
|
||||
|
||||
int WriteToLog(char* str);
|
||||
8
测试/服务器测试/输出文件/输出待检测检测文件 source/StdAfx.cpp
Normal file
8
测试/服务器测试/输出文件/输出待检测检测文件 source/StdAfx.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// HWCV.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
24
测试/服务器测试/输出文件/输出待检测检测文件 source/StdAfx.h
Normal file
24
测试/服务器测试/输出文件/输出待检测检测文件 source/StdAfx.h
Normal file
@@ -0,0 +1,24 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__0B833134_257D_4F21_9707_24C780138809__INCLUDED_)
|
||||
#define AFX_STDAFX_H__0B833134_257D_4F21_9707_24C780138809__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
// Insert your headers here
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__0B833134_257D_4F21_9707_24C780138809__INCLUDED_)
|
||||
54
测试/服务器测试/输出文件/输出待检测检测文件 source/main.cpp
Normal file
54
测试/服务器测试/输出文件/输出待检测检测文件 source/main.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
主函数文件:segmentation.cpp 主函数的实现文件
|
||||
*/
|
||||
#include "main.h"
|
||||
//#pragma comment( linker, "/subsystem:windows /entry:mainCRTStartup" )//没有界面运行
|
||||
|
||||
/*主函数*/
|
||||
char *adr="D:/process.csv";
|
||||
int main(int argc,char* argv[])
|
||||
{
|
||||
|
||||
// cout<<"开始鉴定"<<fpname1<<endl;
|
||||
//char *fpname1 = "010209400748";
|
||||
/*变量定义*/
|
||||
cout<<"1"<<endl;
|
||||
vector<string> stuNum;
|
||||
|
||||
//读取配置文件,并配置各项参数
|
||||
memset(g_log_rec, 0, sizeof(g_log_rec));
|
||||
strcat(g_log_rec, GetTime());
|
||||
if (!ReadConfig("D:/HWCV/config/configure.cfg"))
|
||||
{
|
||||
cout<<"!ReadConfig"<<endl;
|
||||
strcat(g_log_rec, ",config failed!\n");
|
||||
SaveLog(g_log_rec, adr, "a");
|
||||
|
||||
return 0;
|
||||
}
|
||||
cout<<"ReadConfig success"<<endl;
|
||||
|
||||
//查询数据库
|
||||
cout<<"2"<<endl;
|
||||
DbStu(stuNum);
|
||||
|
||||
//生成路径();
|
||||
FILE *fp;
|
||||
string name="D:/HWCV/Check/";
|
||||
cout<<"搜索到的数量:"<<stuNum.size()<<endl;
|
||||
for(int i=0; i<stuNum.size();i++)
|
||||
{
|
||||
string temp=name;
|
||||
temp+=stuNum[i];
|
||||
fp=fopen((char*)temp.c_str(),"w+");
|
||||
fclose(fp);
|
||||
fp=NULL;
|
||||
|
||||
system("pause");
|
||||
}
|
||||
|
||||
/*返回值*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
62
测试/服务器测试/输出文件/输出待检测检测文件 source/main.h
Normal file
62
测试/服务器测试/输出文件/输出待检测检测文件 source/main.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
头文件:segmentation.h 主函数头文件
|
||||
*/
|
||||
#pragma once
|
||||
#ifdef WIN32 //屏蔽VC6对STL的一些不完全支持造成
|
||||
#pragma warning (disable: 4514 4786)
|
||||
#endif
|
||||
#include "StdAfx.h"
|
||||
#include "DBop.h"
|
||||
#include "path.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*定义全局变量*/
|
||||
|
||||
int g_bi_threshold = 230; /* 全局变量 二值化阈值*/
|
||||
double g_std_kesa[50][50]; /* 全局变量 标准差数组*/
|
||||
float g_doubt_threshold = 0.12; /* 全局变量 作弊嫌疑阈值*/
|
||||
string g_dir = "Y:/"; /* 全局变量 总路径的目录*/
|
||||
int g_cheat_num_threshold = 0; /* 全局变量 默认作弊阈值*/
|
||||
int g_conti = 1; /* 全局变量 默认作弊比较的图片*/
|
||||
|
||||
int g_all_img_num = 0; /* 全局变量 已鉴定的全部图片数量*/
|
||||
int g_doubt_img_num = 0; /* 全局变量 已鉴定怀疑的图片数量*/
|
||||
int g_all_stu_num = 0; /* 全局变量 已鉴定的全部学生数量*/
|
||||
int g_doubt_stu_num = 0; /* 全局变量 已鉴定怀疑的学生数量*/
|
||||
|
||||
/*
|
||||
string g_db_hostName = "192.168.200.97"; //全局变量 服务器ip或名称
|
||||
string g_db_dBName = "purple"; //全局变量 服务器ODBC数据源
|
||||
string g_db_userName = "BJSH"; //全局变量 服务器用户名
|
||||
string g_db_password = "bjshadmin"; //全局变量 服务器密码
|
||||
*/
|
||||
|
||||
string g_db_hostName = "localhost"; //全局变量 服务器ip或名称
|
||||
string g_db_dBName = "orcl123"; //全局变量 服务器ODBC数据源
|
||||
string g_db_userName = "yannsy"; //全局变量 服务器用户名
|
||||
string g_db_password = "123456"; //全局变量 服务器密码
|
||||
|
||||
|
||||
string g_db_qurry_start = "200906"; /*全局变量 数据库查询_开始日期*/
|
||||
string g_db_qurry_end = "201610"; /*全局变量 数据库查询_结束日期*/
|
||||
string g_db_qurry_zone = "0"; /*全局变量 数据库查询_特定区域*/
|
||||
string g_db_qurry_stu_num = "0"; /*全局变量 数据库查询_特定考号*/
|
||||
bool g_db_qurry_all = true; /*全局变量 数据库查询_查询全部标记*/
|
||||
string g_db_hoster_zk = "ZK"; /*全局变量 数据库用户,zk(考试院的zk,本地的yannsy)*/
|
||||
|
||||
|
||||
bool g_output_cmd_config = false; /*全局变量 输出参数控制*/
|
||||
bool g_output_txt_config = false; /*全局变量 输出中间文件选项*/
|
||||
char g_log_adr[50] = "D:/HWCV/log_ori.txt"; /*全局变量 程序日志存储地址*/
|
||||
char g_log_rec[500] = { 0 }; /*全局变量 程序日志专用变量*/
|
||||
/*全局变量 输出txt结果文件*/
|
||||
/*全局变量 输出txt结果文件地址*/
|
||||
|
||||
|
||||
|
||||
time_t g_ltime;
|
||||
char *g_srcTime=NULL;
|
||||
char g_timeNow[32]={0};
|
||||
char g_msg[100]={0};
|
||||
int g_stu_sus;
|
||||
177
测试/服务器测试/输出文件/输出待检测检测文件 source/path.cpp
Normal file
177
测试/服务器测试/输出文件/输出待检测检测文件 source/path.cpp
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
实现文件:path.cpp 路径操作实现文件
|
||||
*/
|
||||
#include "path.h"
|
||||
|
||||
|
||||
/**
|
||||
获取并返回当前时间
|
||||
*/
|
||||
char* GetTime()
|
||||
{
|
||||
time(&g_ltime);
|
||||
g_srcTime = ctime(&g_ltime);
|
||||
strncpy(g_timeNow, g_srcTime, strlen(g_srcTime) - 1); //不拷贝换行
|
||||
g_timeNow[strlen(g_srcTime) - 1] = '\0'; //加结束符'\0'
|
||||
|
||||
return g_timeNow;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
读取配置文件,并配置各项参数
|
||||
|
||||
@变量 filename 配置文件的路径
|
||||
@返回值 成功1 失败0
|
||||
*/
|
||||
int ReadConfig(char *filename)
|
||||
{
|
||||
ifstream file(filename);
|
||||
|
||||
if (!file)/*"配置文件不存在!"*/
|
||||
{
|
||||
/*写入时间*/
|
||||
memset(g_log_rec, 0, sizeof(g_log_rec));
|
||||
// cout<<"read"<<endl;
|
||||
|
||||
strcat(g_log_rec, "--ERR:配置文件不存在!");
|
||||
SaveLog(g_log_rec, g_log_adr, "a");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
cout<<"1.1"<<endl;
|
||||
/*步骤:开始读取信息*/
|
||||
/*仅用作过滤字符*/
|
||||
string temp;
|
||||
file >> temp >> temp;
|
||||
/*---此行6个,参考配置信息:图片对比参数*/
|
||||
file >> temp >> temp >> temp >> temp >> temp >>temp;
|
||||
file >> g_dir >> temp >> temp >> temp;
|
||||
string g_log_adr_t;
|
||||
file >> g_log_adr_t >> temp;
|
||||
|
||||
memset(g_log_adr, 0, sizeof(g_log_adr));
|
||||
strcpy(g_log_adr, (char*)g_log_adr_t.c_str());
|
||||
cout<<"1.2"<<endl;
|
||||
|
||||
//if (g_bi_threshold < 0 || g_bi_threshold >255)/*输出到日志错误信息*/{
|
||||
// memset(g_log_rec, 0, sizeof(g_log_rec));
|
||||
// strcat(g_log_rec, "--MSG:配置参数有误-笔迹图像对比参数!");
|
||||
// strcat(g_log_rec, g_dir.c_str());
|
||||
// SaveLog(g_log_rec, g_err_adr, "a");
|
||||
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
|
||||
/*---此行6个,参考配置信息:网络配置参数*/
|
||||
file >> temp >> temp >> g_db_hostName >> temp >> g_db_dBName >> temp >> g_db_userName >> temp >> g_db_password >> temp >> g_db_hoster_zk >> temp;
|
||||
|
||||
cout<<"1.3"<<endl;
|
||||
///*检验参数*/
|
||||
////if (strcmp(g_db_hostName.c_str(), "") || g_bi_threshold >255 || g_bi_threshold < 1)/*输出到日志错误信息*/{
|
||||
// memset(g_log_rec, 0, sizeof(g_log_rec));
|
||||
// /*time_t timer;
|
||||
// struct tm *tblock;
|
||||
// timer = time(NULL);
|
||||
// tblock = localtime(&timer);
|
||||
// strcat(g_log_rec, asctime(tblock));*/
|
||||
// strcat(g_log_rec, "--MSG:-网络配置参数!");
|
||||
// strcat(g_log_rec, g_db_password.c_str());
|
||||
// strcat(g_log_rec, "\n");
|
||||
|
||||
// SaveLog(g_log_rec, g_err_adr, "a");
|
||||
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
|
||||
/*---此行5个,参考配置信息:控制参数*/
|
||||
//备用
|
||||
file >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp >> temp;
|
||||
|
||||
///*检验参数*/
|
||||
//if (0)/*输出到日志错误信息*/{
|
||||
// memset(g_log_rec, 0, sizeof(g_log_rec));
|
||||
///* time_t timer;
|
||||
// struct tm *tblock;
|
||||
// timer = time(NULL);
|
||||
// tblock = localtime(&timer);
|
||||
// strcat(g_log_rec, asctime(tblock));*/
|
||||
// strcat(g_log_rec, "--ERR:配置参数有误-控制参数!");
|
||||
// SaveLog(g_log_rec, g_err_adr, "a");
|
||||
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
/*---此行5个,参考配置信息:数据库查询参数*/
|
||||
file >> temp >> temp >> g_db_qurry_start >> temp >> g_db_qurry_end >> temp >> g_db_qurry_zone >> temp >> g_db_qurry_stu_num >> temp >> g_db_qurry_all >> temp;
|
||||
|
||||
///*检验参数*/
|
||||
//if (0)/*输出到日志错误信息*/{
|
||||
// memset(g_log_rec, 0, sizeof(g_log_rec));
|
||||
// /*time_t timer;
|
||||
// struct tm *tblock;
|
||||
// timer = time(NULL);
|
||||
// tblock = localtime(&timer);
|
||||
// strcat(g_log_rec, asctime(tblock));*/
|
||||
// strcat(g_log_rec, "--ERR:配置参数有误-数据库查询参数!");
|
||||
// SaveLog(g_log_rec, g_err_adr, "a");
|
||||
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//if (g_doubt_threshold < 0.01)
|
||||
//{
|
||||
// memset(g_log_rec, 0, sizeof(g_log_rec));
|
||||
// /*time_t timer;
|
||||
// struct tm *tblock;
|
||||
// timer = time(NULL);
|
||||
// tblock = localtime(&timer);
|
||||
// strcat(g_log_rec, asctime(tblock));*/
|
||||
// strcat(g_log_rec, "--ERR:配置参数有误-笔迹图像对比参数!");
|
||||
// SaveLog(g_log_rec, g_err_adr, "a");
|
||||
//
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
//if (g_conti < 0 || g_conti > 10 || g_conti == NULL)
|
||||
//{
|
||||
// memset(g_log_rec, 0, sizeof(g_log_rec));
|
||||
///* time_t timer;
|
||||
// struct tm *tblock;
|
||||
// timer = time(NULL);
|
||||
// tblock = localtime(&timer);
|
||||
// strcat(g_log_rec, asctime(tblock));*/
|
||||
// strcat(g_log_rec, "--ERR:配置参数有误-笔迹图像对比参数!\n\n");
|
||||
// SaveLog(g_log_rec, g_err_adr, "a");
|
||||
|
||||
// return 0;
|
||||
//}
|
||||
file.close();/*关闭文件句柄*/
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
函数功能:存储过程数据到txt文件
|
||||
|
||||
@变量: record 存储的语句
|
||||
@变量 g_txt_file_path 存储的位置
|
||||
@返回值 1成功 0失败
|
||||
*/
|
||||
int SaveLog(char *txt, string txt_file_path, char *type)
|
||||
{
|
||||
FILE* fpzz = fopen(txt_file_path.c_str(), type); //创建文件
|
||||
if (!fpzz) return 0;
|
||||
//要返回错误代码
|
||||
fprintf(fpzz, txt); //从控制台中读入并在文本输出
|
||||
fclose(fpzz);
|
||||
fpzz = NULL;//需要指向空,否则会指向原打开文件地址
|
||||
|
||||
return 1;
|
||||
}
|
||||
69
测试/服务器测试/输出文件/输出待检测检测文件 source/path.h
Normal file
69
测试/服务器测试/输出文件/输出待检测检测文件 source/path.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
头文件:path.h 与路径相关操作的函数头文件以及函数原型
|
||||
*/
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <cv.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
extern int g_bi_threshold; /*全局变量 二值化阈值*/
|
||||
extern double g_std_kesa[50][50]; /*全局变量 标准差数组*/
|
||||
extern float g_doubt_threshold; /*全局变量 作弊嫌疑阈值*/
|
||||
extern string g_dir; /*全局变量 总路径的目录*/
|
||||
extern int g_conti; /*全局变量 比较标准*/
|
||||
|
||||
extern string g_db_hostName; /*全局变量 服务器ip或名称*/
|
||||
extern string g_db_dBName; /*全局变量 服务器ODBC数据源*/
|
||||
extern string g_db_userName; /*全局变量 服务器用户名*/
|
||||
extern string g_db_password; /*全局变量 服务器密码*/
|
||||
|
||||
extern char g_log_adr[50]; /*全局变量 程序日志存储地址*/
|
||||
extern char g_log_rec[500]; /*全局变量 程序日志专用变量*/
|
||||
/*全局变量 待定*/
|
||||
/*全局变量 待定*/
|
||||
|
||||
extern string g_db_qurry_start; /*全局变量 数据库查询_开始日期*/
|
||||
extern string g_db_qurry_end; /*全局变量 数据库查询_结束日期*/
|
||||
extern string g_db_qurry_zone; /*全局变量 数据库查询_特定区域*/
|
||||
extern string g_db_qurry_stu_num; /*全局变量 数据库查询_特定考号*/
|
||||
extern bool g_db_qurry_all; /*全局变量 数据库查询_查询全部标记*/
|
||||
extern string g_db_hoster_zk;
|
||||
|
||||
|
||||
|
||||
extern time_t g_ltime;
|
||||
extern char *g_srcTime;
|
||||
extern char g_timeNow[32];
|
||||
extern char g_msg[100];
|
||||
|
||||
|
||||
/**
|
||||
获取并返回当前时间
|
||||
*/
|
||||
char* GetTime();
|
||||
|
||||
|
||||
/**
|
||||
读取配置文件,并配置各项参数
|
||||
|
||||
@变量 filename 配置文件的路径
|
||||
@返回值 成功1 失败0
|
||||
*/
|
||||
int ReadConfig(char *filename);
|
||||
|
||||
|
||||
/**
|
||||
函数功能:存储过程数据到txt文件
|
||||
|
||||
@变量: record 存储的语句
|
||||
@变量 g_txt_file_path 存储的位置
|
||||
@返回值 1成功 0失败
|
||||
*/
|
||||
int SaveLog(char *record, string txt_file_path, char *type);
|
||||
128
测试/服务器测试/输出文件/输出待检测检测文件 source/test_all.dsp
Normal file
128
测试/服务器测试/输出文件/输出待检测检测文件 source/test_all.dsp
Normal file
@@ -0,0 +1,128 @@
|
||||
# Microsoft Developer Studio Project File - Name="test_all" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=test_all - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "test_all.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "test_all.mak" CFG="test_all - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "test_all - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "test_all - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "test_all - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x804 /d "NDEBUG"
|
||||
# ADD RSC /l 0x804 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "test_all - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x804 /d "_DEBUG"
|
||||
# ADD RSC /l 0x804 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "test_all - Win32 Release"
|
||||
# Name "test_all - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DBop.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\path.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DBop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\path.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
29
测试/服务器测试/输出文件/输出待检测检测文件 source/test_all.dsw
Normal file
29
测试/服务器测试/输出文件/输出待检测检测文件 source/test_all.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# 警告: 不能编辑或删除该工作区文件!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "test_all"=".\test_all.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
BIN
测试/服务器测试/输出文件/输出待检测检测文件 source/test_all.opt
Normal file
BIN
测试/服务器测试/输出文件/输出待检测检测文件 source/test_all.opt
Normal file
Binary file not shown.
16
测试/服务器测试/输出文件/输出待检测检测文件 source/test_all.plg
Normal file
16
测试/服务器测试/输出文件/输出待检测检测文件 source/test_all.plg
Normal file
@@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: test_all - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
test_all.exe - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user