def bccResultComputation(sampledRGB, filterRadius, exposedTime, airFlowRate, bcGradient, gradient, chartFile, parenttags=None, level=logging.ERROR): ''' This method gets invoked externally with the specified params and computes the BCVol, it also plots the chart. Keyword Arguments: sampledRGB -- The sampled RGB values of the BCFilter filterRadius -- The radius of the filter in the image exposedTime -- The time duration for which the filter was exposed. airFlowRate -- The flowrate of the pump bcGradient -- The gradient values to be used in the interpolation to ind the BCVol gradient -- The gradient/grayscale list that is used in the interpolation chartFile -- The name of the chartFile in which to store the plotted results parenttags -- The tag string of the calling function level -- The logging level Returns: BCCResult object containing the results of the Image Analysis. ''' # Set the logging level log.setLevel(logging.DEBUG) tags = parenttags + " BCCRESULTCOMPUTATION" log.info('Running BCCResultComputation ', extra=tags) # Compute BCC bccResult, exitcode = rateFilter(sampledRGB, filterRadius, exposedTime, airFlowRate, bcGradient, gradient, tags, logging.DEBUG) if exitcode is not ExitCode.Success: log.error('Could not compute BCC result : ' + ExitCode.toString[exitcode], extra=tags) return None, exitcode log.info('Done Running BCCResultComputation', extra=tags) plotChart(filterRadius, exposedTime, airFlowRate, bcGradient, gradient, bccResult, sampledRGB, chartFile) return bccResult, exitcode
bestBcFilter = bestBand[0] sampledRGB = bestBcFilter.sample(image, bestBcFilter.radius/MainConstants.samplingfactor) # Compute BCC bccResult, exitcode = rateFilter(sampledRGB, filterRadius, exposedTime, airFlowRate, bcGradient, gradient, tags, logging.DEBUG) if exitcode is not ExitCode.Success: log.error('Could not compute BCC result for : ' + str(exitcode), extra=tags) return None, exitcode log.info('Done Running SuryaImageAnalyzer', extra=tags) if imageLogLevel: plotChart(filterRadius, exposedTime, airFlowRate, bcGradient, gradient, bccResult, sampledRGB, chartFile) debugImage.save(debugImageFile) if imageLogLevel > 1: debugImage.show() return bccResult, exitcode if __name__ == '__main__': # (imagefile, filterRadius, bcGradient, exposedTime, airFlowRate, imageLogLevel, debugImageFile, chartFile, level=logging.ERROR,): # bccResult, exitcode = Main('/home/surya/Desktop/Surya_BC_Catalog-2010-10-13/Khairatpur-2010-08/09092010039.jpg', # Los_Angeles-2010-06/0625101809.jpg # 5.45, # pylab.array([ 0.53805296, 0.77764056, # 1.10252548, 1.54307503, # 2.14046781, 2.9505427 , # 4.04901822, 5.53856995,