当前位置: 首页>>代码示例>>Python>>正文


Python PostProcessing.remove_singletons方法代码示例

本文整理汇总了Python中PostProcessing.remove_singletons方法的典型用法代码示例。如果您正苦于以下问题:Python PostProcessing.remove_singletons方法的具体用法?Python PostProcessing.remove_singletons怎么用?Python PostProcessing.remove_singletons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PostProcessing的用法示例。


在下文中一共展示了PostProcessing.remove_singletons方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: report

# 需要导入模块: import PostProcessing [as 别名]
# 或者: from PostProcessing import remove_singletons [as 别名]
        def report(self):
                
                #Run is over, destroy display windows
                #Postprocessing
                cv2.destroyAllWindows()
                if self.remove_singles:
                        singles_removed=PostProcessing.remove_singletons(self.frame_results,self.single_distance*self.frame_rate,self.file_destination)
        
                #Print parameters
                #Batch or single file
                self.log_report.write("\nInput Parameters")        
                self.log_report.write("\nRun type: %s" % self.runtype)
                if self.runtype in ["file","pictures"]:
                        self.log_report.write("\nInput file path: %s" % self.inDEST)
                        
                else:
                        self.log_report.write("\nInput file path: %s" % self.batchpool)
                self.log_report.write("\nOutput dir: %s" % self.fileD)
                self.log_report.write("\nBackground Subtraction Method?: %s" % self.subMethod)
                self.log_report.write("\nAdapt settings: %s" % self.adapt)
                self.log_report.write("\nFrame Rate: %s" % self.frame_rate)
                
                if self.subMethod == "MOG":
                        self.log_report.write("\nLearning Rate: %s" % self.moglearning)
                        self.log_report.write("\nVariance Rate: %s" % self.mogvariance)
                
                if self.subMethod == "Acc":
                        self.log_report.write("\nAccumulated Averaging: %s" % self.accAvg) 
                        self.log_report.write("\nThreshold: %s" % self.threshT)                
        
                if self.adapt:
                        self.log_report.write("\nExpected hitrate: %s" % self.frameHIT)
                
                self.log_report.write("\nFrame crop: %s" % self.set_ROI)     
                if self.set_ROI:        
                        self.log_report.write("\nSet ROI: %s" % self.ROI_include)        
                self.log_report.write("\nMinimum size was drawn or entered?: %s" % self.drawSmall)
                self.log_report.write("\nMinimum area: %s percent of frame" % (self.minSIZE * 100))
                if self.burnin > 0:
                        self.log_report.write("\nBurnin: %s" % self.burnin)
                if self.scan > 0:
                        self.log_report.write("\nScan frames: %s" % self.scan)
                if self.frameSET:
                        self.log_report.write("\nManual framerate: %s" % self.frame_rate)
                if self.set_areacounter:
                        self.log_report.write("\nArea counter: %s" % self.set_areacounter)
                self.log_report.write("\nOutput type: %s\n\n" % self.makeVID)
        
                #Ending time
                end=time.time()
        
                #total_time()
                self.total_min=(end-self.start)/60
        
                #processed frames per second
                try:
                        pfps=float(self.frame_count)/(self.total_min*60)
                except:
                        #run failed before initialization
                        self.frame_count=1
                        pfps=0
                        self.total_min=0
                        self.total_count=0
                
                ##Write to log file
                self.log_report.write("Processing\n")        
                self.log_report.write("Total run time (min): %.2f \n" % self.total_min)
                self.log_report.write("Average frames per second: %.2f \n " % pfps)
        
                #End of program, report some statistic to screen and log
                #log
                self.log_report.write("\nResults\n")
                self.log_report.write("Candidate motion events: %.0f \n" % self.total_count )
                self.log_report.write("Frames skipped due to insufficient movement based on the threshold parameter: %.0f \n" % self.nocountr)
                self.log_report.write("Frames skipped due to minimum size of the contours: %.0f \n" % self.toosmall)
                if self.windy:
                        self.log_report.write("Frames deleted due to windy conditions: %.0f \n" % self.windy_count)
                if self.remove_singles:
                        self.log_report.write("Frames deleted due to singletons: %.0f \n" % singles_removed)
               
                self.log_report.write("Total frames in files: %.0f \n" % self.frame_count)
                
                try:
                        rate=float(self.total_count)/self.frame_count*100
                except:
                        rate=0
                self.log_report.write("Hitrate: %.2f %% \n" % rate)
        
                #print to screen
                print("\n\nThank you for using MotionMeerkat! \n")
                print("Total run time (min): %.2f \n " % self.total_min)
                print("Average frames processed per second: %.2f \n " % pfps)   
                print("Candidate motion events: %.0f \n " % self.total_count )
                print("Frames skipped due to insufficient movement based on the threshold parameter: %.0f \n " % self.nocountr)
                print("Frames skipped due to minimum size of the contours: %.0f \n " % self.toosmall)
                
                #if windy
                if self.windy:
                        print("Frames skipped due to windy conditions: %.0f \n " % self.windy_count)
                if self.remove_singles:
#.........这里部分代码省略.........
开发者ID:bw4sz,项目名称:OpenCV_HummingbirdsMotion,代码行数:103,代码来源:motionClass.py


注:本文中的PostProcessing.remove_singletons方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。