public LPREngine(APPLICATION_DATA appData) { try { m_AppData = appData; m_AppData.AddOnClosing(Stop, APPLICATION_DATA.CLOSE_ORDER.MIDDLE); m_Log = (ErrorLog)m_AppData.Logger; m_FrameGen = (FrameGenerator)m_AppData.FrameGenerator; m_LPRProcessQ = new ThreadSafeQueue <FRAME>(m_LPRProcessQueSize, "QueueOverruns_LPR_LPRProcessQ", m_AppData); // this queue hold frames that come from the framegenerator and need to be processed by LPR m_AppData.LPRGettingBehind = false; m_LPRFinalPlateGroupOutputQ = new ThreadSafeQueue <FRAME>(60, "QueueOverruns_LPR_LPRFinalPlateGroupOutputQ", m_AppData); // filtered plate readings, grouped into similar readings, redundant readings removed m_LPRPerFrameReadingQ = new ThreadSafeQueue <FRAME>(60, "QueueOverruns_LPR_LPRPerFrameReadingQ", m_AppData); // instantaneous output from LPR for each fram processed m_StoredFrameData = new ThreadSafeHashableQueue(30 * 60); // 60 seconds of frames at 30fps m_LPRFuntions = new LPROCR_Lib(); unsafe { // the plate group processor accumulates per-frame plate readings and consolidates them into a single plate reading where appropriate m_LPRFuntions.RegisterPlateGroupCB(OnNewPlateGroupReady); } int maxW = 0, minW = 0, maxH = 0, minH = 0; m_LPRFuntions.GetMinMaxPlateSize(ref minW, ref maxW, ref minH, ref maxH); m_AppData.MAX_PLATE_HEIGHT = maxH; m_AppData.MIN_PLATE_HEIGHT = minH; m_AppData.MAX_PLATE_WIDTH = maxW; m_AppData.MIN_PLATE_WIDTH = minW; m_processOptions = new LPROCR_Lib.LPR_PROCESS_OPTIONS(); m_processOptions.roll = 1; m_processOptions.rotation = 1; // register with the frame grabber to get new bitmaps from the channel sources as they come in m_ConsumerID = m_FrameGen.GetNewConsumerID(); // m_NumSourceChannels = m_FrameGen.GetNumberOfConfiguredChannels(); m_NumSourceChannels = (m_AppData.RunninAsService) ? m_AppData.MAX_PHYSICAL_CHANNELS : m_AppData.MAX_VIRTUAL_CHANNELS; m_LPREngineProcessThread = new Thread(LPREngineProcessLoop); PushLPRResultsThread = new Thread(PushLPRResultsLoop); } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } }
public LPREngine(APPLICATION_DATA appData) { try { m_AppData = appData; m_AppData.AddOnClosing(Stop, APPLICATION_DATA.CLOSE_ORDER.MIDDLE); m_Log = (ErrorLog)m_AppData.Logger; m_FrameGen = (FrameGenerator)m_AppData.FrameGenerator; m_LPRProcessQ = new ThreadSafeQueue<FRAME>(m_LPRProcessQueSize, "QueueOverruns_LPR_LPRProcessQ", m_AppData); // this queue hold frames that come from the framegenerator and need to be processed by LPR m_AppData.LPRGettingBehind = false; m_LPRFinalPlateGroupOutputQ = new ThreadSafeQueue<FRAME>(60, "QueueOverruns_LPR_LPRFinalPlateGroupOutputQ", m_AppData); // filtered plate readings, grouped into similar readings, redundant readings removed m_LPRPerFrameReadingQ = new ThreadSafeQueue<FRAME>(60, "QueueOverruns_LPR_LPRPerFrameReadingQ", m_AppData); // instantaneous output from LPR for each fram processed m_StoredFrameData = new ThreadSafeHashableQueue(30 * 60);// 60 seconds of frames at 30fps m_LPRFuntions = new LPROCR_Lib(); unsafe { // the plate group processor accumulates per-frame plate readings and consolidates them into a single plate reading where appropriate m_LPRFuntions.RegisterPlateGroupCB(OnNewPlateGroupReady); } int maxW = 0, minW = 0, maxH = 0, minH = 0; m_LPRFuntions.GetMinMaxPlateSize(ref minW, ref maxW,ref minH, ref maxH); m_AppData.MAX_PLATE_HEIGHT = maxH; m_AppData.MIN_PLATE_HEIGHT = minH; m_AppData.MAX_PLATE_WIDTH = maxW; m_AppData.MIN_PLATE_WIDTH = minW; m_processOptions = new LPROCR_Lib.LPR_PROCESS_OPTIONS(); m_processOptions.roll = 1; m_processOptions.rotation = 1; // register with the frame grabber to get new bitmaps from the channel sources as they come in m_ConsumerID = m_FrameGen.GetNewConsumerID(); // m_NumSourceChannels = m_FrameGen.GetNumberOfConfiguredChannels(); m_NumSourceChannels = (m_AppData.RunninAsService) ? m_AppData.MAX_PHYSICAL_CHANNELS : m_AppData.MAX_VIRTUAL_CHANNELS; m_LPREngineProcessThread = new Thread(LPREngineProcessLoop); PushLPRResultsThread = new Thread(PushLPRResultsLoop); } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } }