def cam_dump(): #************* get CAMID ****************************************************** #CAMarea_ID=vaconf_p_dump.floor #vaconf_p_dump.write_conf(CAMarea_ID) Cam_ID=vaconf_db.select_CAMID() print 'CAM Cam_ID',Cam_ID #************ select cam ************************************************************* tbl='Cam_loc_tbl' #Cam_ID='100100' vaconf_db.g_cur.execute("select * from %s where CAM_ID='%s';"%(tbl,Cam_ID)) rows = vaconf_db.g_cur.fetchall() for row in rows: CAMID="CAMID=%s"%(row[0]) Area="Area=%s"%(row[1]) CAMname="CAMname=%s"%(row[2]) FPS="FPS=%s"%(row[3]) HomographyMatrix_11="HomographyMatrix_11=%s"%(row[4]) HomographyMatrix_12="HomographyMatrix_12=%s"%(row[5]) HomographyMatrix_13="HomographyMatrix_13=%s"%(row[6]) HomographyMatrix_14="HomographyMatrix_14=%s"%(row[7]) HomographyMatrix_21="HomographyMatrix_21=%s"%(row[8]) HomographyMatrix_22="HomographyMatrix_22=%s"%(row[9]) HomographyMatrix_23="HomographyMatrix_23=%s"%(row[10]) HomographyMatrix_24="HomographyMatrix_24=%s"%(row[11]) HomographyMatrix_31="HomographyMatrix_31=%s"%(row[12]) HomographyMatrix_32="HomographyMatrix_32=%s"%(row[13]) HomographyMatrix_33="HomographyMatrix_33=%s"%(row[14]) HomographyMatrix_34="HomographyMatrix_34=%s"%(row[15]) HomographyMatrix_41="HomographyMatrix_41=%s"%(row[16]) HomographyMatrix_42="HomographyMatrix_42=%s"%(row[17]) HomographyMatrix_43="HomographyMatrix_43=%s"%(row[18]) HomographyMatrix_44="HomographyMatrix_44=%s"%(row[19]) #************ creat cam conf ******************************************************* vaconf_p_dump.write_conf(Area) vaconf_p_dump.write_conf(CAMID) vaconf_p_dump.write_conf(CAMname) vaconf_p_dump.write_conf(FPS) vaconf_p_dump.write_conf(HomographyMatrix_11) vaconf_p_dump.write_conf(HomographyMatrix_12) vaconf_p_dump.write_conf(HomographyMatrix_13) vaconf_p_dump.write_conf(HomographyMatrix_14) vaconf_p_dump.write_conf(HomographyMatrix_21) vaconf_p_dump.write_conf(HomographyMatrix_22) vaconf_p_dump.write_conf(HomographyMatrix_23) vaconf_p_dump.write_conf(HomographyMatrix_24) vaconf_p_dump.write_conf(HomographyMatrix_31) vaconf_p_dump.write_conf(HomographyMatrix_32) vaconf_p_dump.write_conf(HomographyMatrix_33) vaconf_p_dump.write_conf(HomographyMatrix_34) vaconf_p_dump.write_conf(HomographyMatrix_41) vaconf_p_dump.write_conf(HomographyMatrix_42) vaconf_p_dump.write_conf(HomographyMatrix_43) vaconf_p_dump.write_conf(HomographyMatrix_44) return None
def f10_dump(): try: Cam_ID=vaconf_db.select_CAMID() print 'F10 Cam_ID',Cam_ID vaconf_db.g_cur.execute("select * from F10_tbl where Cam_ID='%s';"%(Cam_ID)) rows = vaconf_db.g_cur.fetchall() if not rows: print " no F10 function !!! " pass else: for row in rows: flag='flag=%s'%(row[1]) nTripwire='nTripwire=%s'%(row[2]) nTripwire_size=row[2] vaconf_p_dump.write_conf(flag) vaconf_p_dump.write_conf(nTripwire) if nTripwire_size>0: nTripwire_sum=1 while nTripwire_sum<=nTripwire_size: ROI_value='ROI%d'%nTripwire_sum Line_ID=Cam_ID+nTripwire_sum ROI_values='%s=%d'%(ROI_value,Line_ID) #Line_ID=Cam_ID+nTripwire_sum vaconf_db.g_cur.execute("select * from F10_line_tbl where Line_ID='%s' limit 1;"%(Line_ID)) rows = vaconf_db.g_cur.fetchall() for row in rows: ROI_nPts_size=row[4] ROI_nPts='%s_nPts=%s'%(ROI_value,ROI_nPts_size) vaconf_p_dump.write_conf(ROI_values) vaconf_p_dump.write_conf(ROI_nPts) for i in range(0,ROI_nPts_size): Rpoint_x='%s_point%d.x'%(ROI_value,i+1) Rpoint_y='%s_point%d.y'%(ROI_value,i+1) vaconf_db.g_cur.execute("select * from F10_line_tbl where Line_ID='%s' order by Line_index limit %s,1;"%(Line_ID,i)) rows = vaconf_db.g_cur.fetchall() for row in rows: Rpoint_xvalue=row[5] Rpoint_yvalue=row[6] ROI_point_x='%s=%s'%(Rpoint_x,Rpoint_xvalue) ROI_point_y='%s=%s'%(Rpoint_y,Rpoint_yvalue) vaconf_p_dump.write_conf(ROI_point_x) vaconf_p_dump.write_conf(ROI_point_y) nTripwire_sum+=1 except BaseException, e: print 'Unknown error (',str(e),') happened in f10_dump!' return None
def f20_dump(): try: Cam_ID=vaconf_db.select_CAMID() print 'F20 Cam_ID',Cam_ID vaconf_db.g_cur.execute("select * from F20_tbl where Cam_ID='%s';"%(Cam_ID)) rows = vaconf_db.g_cur.fetchall() if not rows: print " no F20 function !!!" pass else: for row in rows: flag='flag=%s'%(row[1]) dBgThresh='dBgThresh=%s'%(row[2]) dFactor='dFactor=%s'%(row[3]) iRefDistance='iRefDistance=%s'%(row[4]) iDownScale='iDownScale=%s'%(row[5]) iInitFrame='iInitFrame=%s'%(row[6]) iLostFrame='iLostFrame=%s'%(row[7]) dInitLearnRate='dInitLearnRate=%s'%(row[8]) dInitMean='dInitMean=%s'%(row[9]) dInitStd='dInitStd=%s'%(row[10]) dInitWeight='dInitWeight=%s'%(row[11]) dDisWithoutPredict='dDisWithoutPredict=%s'%(row[12]) dDisWithPredict='dDisWithPredict=%s'%(row[13]) dMinObjSize='dMinObjSize=%s'%(row[14]) dMaxObjSize='dMaxObjSize=%s'%(row[15]) dMinStd='dMinStd=%s'%(row[16]) dUpdateLearnRate='dUpdateLearnRate=%s'%(row[17]) iPredictWinLen='iPredictWinLen=%s'%(row[18]) iStartFrame='iStartFrame=%s'%(row[19]) dSuddenRatio='dSuddenRatio=%s'%(row[20]) dObjSizeLowRate='dObjSizeLowRate=%s'%(row[21]) dObjSizeUpRate='dObjSizeUpRate=%s'%(row[22]) dMaxVelocity='dMaxVelocity=%s'%(row[23]) bBrectDis='bBrectDis=%s'%(row[24]) bDesOut='bDesOut=%s'%(row[25]) bRegionDis='bRegionDis=%s'%(row[26]) bRegionOut='bRegionOut=%s'%(row[27]) bSceneOut='bSceneOut=%s'%(row[28]) bTimeOut='bTimeOut=%s'%(row[29]) bTrajDis='bTrajDis=%s'%(row[30]) bTypeOut='bTypeOut=%s'%(row[31]) dNearbyPosition='dNearbyPosition=%s'%(row[32]) dMediumPosition='dMediumPosition=%s'%(row[33]) dFarawayPosition='dFarawayPosition=%s'%(row[34]) dMediumTargetSize='dMediumTargetSize=%s'%(row[35]) dNearbyTargetSize='dNearbyTargetSize=%s'%(row[36]) dFarawayTargetSize='dFarawayTargetSize=%s'%(row[37]) nAlarmROI='nAlarmROI=%s'%(row[38]) nAlarmROI_size=row[38] nNoUse='nNoUse=%s'%(row[39]) vaconf_p_dump.write_conf(flag) vaconf_p_dump.write_conf(dBgThresh) vaconf_p_dump.write_conf(dFactor) vaconf_p_dump.write_conf(iRefDistance) vaconf_p_dump.write_conf(iDownScale) vaconf_p_dump.write_conf(iInitFrame) vaconf_p_dump.write_conf(iLostFrame) vaconf_p_dump.write_conf(dInitLearnRate) vaconf_p_dump.write_conf(dInitMean) vaconf_p_dump.write_conf(dInitStd) vaconf_p_dump.write_conf(dInitWeight) vaconf_p_dump.write_conf(dDisWithoutPredict) vaconf_p_dump.write_conf(dDisWithPredict) vaconf_p_dump.write_conf(dMinObjSize) vaconf_p_dump.write_conf(dMaxObjSize) vaconf_p_dump.write_conf(dMinStd) vaconf_p_dump.write_conf(dUpdateLearnRate) vaconf_p_dump.write_conf(iPredictWinLen) vaconf_p_dump.write_conf(iStartFrame) vaconf_p_dump.write_conf(dSuddenRatio) vaconf_p_dump.write_conf(dObjSizeLowRate) vaconf_p_dump.write_conf(dObjSizeUpRate) vaconf_p_dump.write_conf(dMaxVelocity) vaconf_p_dump.write_conf(bBrectDis) vaconf_p_dump.write_conf(bDesOut) vaconf_p_dump.write_conf(bRegionDis) vaconf_p_dump.write_conf(bRegionOut) vaconf_p_dump.write_conf(bSceneOut) vaconf_p_dump.write_conf(bTimeOut) vaconf_p_dump.write_conf(bTrajDis) vaconf_p_dump.write_conf(bTypeOut) vaconf_p_dump.write_conf(dNearbyPosition) vaconf_p_dump.write_conf(dMediumPosition) vaconf_p_dump.write_conf(dFarawayPosition) vaconf_p_dump.write_conf(dMediumTargetSize) vaconf_p_dump.write_conf(dNearbyTargetSize) vaconf_p_dump.write_conf(dFarawayTargetSize) vaconf_p_dump.write_conf(nAlarmROI) vaconf_p_dump.write_conf(nNoUse) if nAlarmROI_size>0: nAlarmROI_sum=1 while nAlarmROI_sum<=nAlarmROI_size: ROI_value='ROI%d'%nAlarmROI_sum Line_ID=vaconf_db.Cam_ID+nAlarmROI_sum ROI_values='%s=%d'%(ROI_value,Line_ID) #Line_ID=vaconf_db.Cam_ID+nAlarmROI_sum vaconf_db.g_cur.execute("select * from F20_line_tbl where Line_ID='%s' limit 1;"%(Line_ID)) rows = vaconf_db.g_cur.fetchall() for row in rows: ROI_nPts_size=row[9] # print "ROI_nPts_size",ROI_nPts_size ROI_alarmType='%s_alarmType=%s'%(ROI_value,row[4]) ROI_alarmLevel='%s_alarmLevel=%s'%(ROI_value,row[5]) ROI_iTripwireDirection='%s_iTripwireDirection=%s'%(ROI_value,row[6]) ROI_iApproachingFrameCount='%s_iApproachingFrameCount=%s'%(ROI_value,row[7]) ROI_iPassedFrameCount='%s_iPassedFrameCount=%s'%(ROI_value,row[8]) ROI_nPts='%s_nPts=%s'%(ROI_value,ROI_nPts_size) ROI_dMinTargetSize='%s_dMinTargetSize=%s'%(ROI_value,row[10]) ROI_strDescription='%s_strDescription=%s'%(ROI_value,row[11]) vaconf_p_dump.write_conf(ROI_values) vaconf_p_dump.write_conf(ROI_alarmType) vaconf_p_dump.write_conf(ROI_alarmLevel) vaconf_p_dump.write_conf(ROI_iTripwireDirection) vaconf_p_dump.write_conf(ROI_iApproachingFrameCount) vaconf_p_dump.write_conf(ROI_iPassedFrameCount) vaconf_p_dump.write_conf(ROI_nPts) vaconf_p_dump.write_conf(ROI_dMinTargetSize) vaconf_p_dump.write_conf(ROI_strDescription) for i in range(0,ROI_nPts_size): Rpoint_x='%s_point%d.x'%(ROI_value,i+1) Rpoint_y='%s_point%d.y'%(ROI_value,i+1) vaconf_db.g_cur.execute("select * from F20_line_tbl where Line_ID='%s' order by Line_index limit %s,1;"%(Line_ID,i)) rows = vaconf_db.g_cur.fetchall() for row in rows: Rpoint_xvalue=row[12] Rpoint_yvalue=row[13] ROI_point_x='%s=%s'%(Rpoint_x,Rpoint_xvalue) ROI_point_y='%s=%s'%(Rpoint_y,Rpoint_yvalue) vaconf_p_dump.write_conf(ROI_point_x) vaconf_p_dump.write_conf(ROI_point_y) nAlarmROI_sum+=1 except BaseException, e: print 'Unknown error (',str(e),') happened in f20_dump!'
def f40_dump(): try: Cam_ID=vaconf_db.select_CAMID() print 'F40 Cam_ID',Cam_ID vaconf_db.g_cur.execute("select * from F40_tbl where Cam_ID='%s';"%(Cam_ID)) rows = vaconf_db.g_cur.fetchall() if not rows: print " no F40 function !!!" pass else: for row in rows: flag='flag=%s'%(row[1]) BackImagePath='BackImagePath=%s'%(row[2]) DownSampleWidth='DownSampleWidth=%s'%(row[3]) DownSampleHeight='DownSampleHeight=%s'%(row[4]) IfShadow='IfShadow=%s'%(row[5]) WeightNum_y='WeightNum_y=%s'%(row[6]) WeightCoefficient='WeightCoefficient=%s'%(row[7]) NormalizationCoefficient='NormalizationCoefficient=%s'%(row[8]) nROI='nROI=%s'%(row[9]) nROI_size=row[9] #print nROI_size #*********** creat F40 conf ***************************************************** vaconf_p_dump.write_conf(flag) vaconf_p_dump.write_conf(BackImagePath) vaconf_p_dump.write_conf(DownSampleWidth) vaconf_p_dump.write_conf(DownSampleHeight) vaconf_p_dump.write_conf(IfShadow) vaconf_p_dump.write_conf(WeightNum_y) vaconf_p_dump.write_conf(WeightCoefficient) vaconf_p_dump.write_conf(NormalizationCoefficient) vaconf_p_dump.write_conf(nROI) if nROI_size>0: nROI_sum=1 while nROI_sum<=nROI_size: ROI_value='ROI%d'%nROI_sum Line_ID=Cam_ID+nROI_sum ROI_values='%s=%d'%(ROI_value,Line_ID) #Line_ID=Cam_ID+nROI_sum vaconf_db.g_cur.execute("select * from F40_line_tbl where Line_ID='%s' limit 1;"%(Line_ID)) rows = vaconf_db.g_cur.fetchall() for row in rows: ROI_nPts_size=row[4] ROI_nPts='%s_nPts=%s'%(ROI_value,ROI_nPts_size) vaconf_p_dump.write_conf(ROI_values) vaconf_p_dump.write_conf(ROI_nPts) for i in range(0,ROI_nPts_size): Rpoint_x='%s_point%d.x'%(ROI_value,i+1) Rpoint_y='%s_point%d.y'%(ROI_value,i+1) vaconf_db.g_cur.execute("select * from F40_line_tbl where Line_ID='%s' order by Line_index limit %s,1;"%(Line_ID,i)) rows = vaconf_db.g_cur.fetchall() for row in rows: Rpoint_xvalue=row[5] Rpoint_yvalue=row[6] ROI_point_x='%s=%s'%(Rpoint_x,Rpoint_xvalue) ROI_point_y='%s=%s'%(Rpoint_y,Rpoint_yvalue) vaconf_p_dump.write_conf(ROI_point_x) vaconf_p_dump.write_conf(ROI_point_y) nROI_sum+=1 except BaseException, e: print 'Unknown error (',str(e),') happened in f40_dump!'