關於用DOMINO Alpha 2擷取卡擷取影像作處理的問題 |
尚未結案
|
savory
一般會員 ![]() ![]() 發表:3 回覆:1 積分:0 註冊:2008-06-12 發送簡訊給我 |
想請問各位大大:
目前我用DOMINO Alpha 2擷取卡所提供的範例可以秀出影像了,但我要作後續的處理,如作二值化等,所以第一我需要知道影像擷取進來的用的參數名稱,第二我要如何才能從連續的影像中改成一張一張地處理。 主要程式如下: CProject1Doc::CProject1Doc() { // TODO: add one-time construction code here m_Channel = 0 ; m_pCurrent = NULL ; m_SizeX = 0; m_SizeY = 0; m_BufferPitch = m_SizeX; m_bScreenRefreshCompleted = TRUE; } CProject1Doc::~CProject1Doc() { // Set the channel to IDLE before deleting it McSetParamInt (m_Channel, MC_ChannelState, MC_ChannelState_IDLE); // Delete the channel McDelete (m_Channel); } BOOL CProject1Doc::OnNewDocument() { if (!CDocument::OnNewDocument()) return FALSE; // Show scope of the sample program MessageBox(NULL, "\ This program demonstrates the Snapshot Acquisiton Mode on a DOMINO Alpha Board. \n\n\ The \"Go!\" menu activates the channel for a \"live\" acquisition. \n\ The example requires an area-scan camera to be connected on connector X \n\ (See the initialization code for camera details). \n\ ", "", MB_OK); // Create a channel using the X connector McCreate (MC_CHANNEL_ALPHA_X, &m_Channel); McSetParamInt (m_Channel, MC_DriverIndex, 0); // Associate a camera and its configuration to the channel // Please modify the following line to adapt the sample program // to your camera. McSetParamStr(m_Channel, MC_CamFile, "XC-HR70_P30SM"); // McSetParamStr(m_Channel, MC_CamFile, "CV-M50C_P50RA.cam"); // The acquisition mode is SNAPSHOT on an Alpha board and has not to be set // Configure the triggering mode McSetParamInt (m_Channel, MC_TrigMode, MC_TrigMode_IMMEDIATE); McSetParamInt (m_Channel, MC_NextTrigMode, MC_NextTrigMode_REPEAT); // Configure number of acquisition McSetParamInt (m_Channel, MC_SeqLength_Fr, MC_INDETERMINATE); // Retrieve image dimensions McGetParamInt (m_Channel, MC_ImageSizeX, &m_SizeX); McGetParamInt (m_Channel, MC_ImageSizeY, &m_SizeY); McGetParamInt (m_Channel, MC_BufferPitch, &m_BufferPitch); // The memory allocation for the images is automatically done by Multicam when activating the channel. // We only set the number of surfaces to be created by MultiCam. McSetParamInt (m_Channel, MC_SurfaceCount, EURESYS_SURFACE_COUNT); // Enable MultiCam signals McSetParamInt(m_Channel, MC_SignalEnable MC_SIG_SURFACE_PROCESSING, MC_SignalEnable_ON); // Register the callback function McRegisterCallback(m_Channel, GlobalCallback, this); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // GlobalCallback void WINAPI GlobalCallback (PMCSIGNALINFO SigInfo) { if (SigInfo && SigInfo->Context) { CProject1Doc* pDoc = (CProject1Doc*) SigInfo->Context ; pDoc->Callback (SigInfo); } } ///////////////////////////////////////////////////////////////////////////// // Callback void CProject1Doc::Callback(PMCSIGNALINFO SigInfo) { if (SigInfo->Signal != MC_SIG_SURFACE_PROCESSING) return ; // Update "current" surface address pointer McGetParamInt (SigInfo->SignalInfo, MC_SurfaceAddr, (PINT32) &m_pCurrent); //---------------------------------------- // // Insert the eVision code here. // //---------------------------------------- // Post screen refresh message only if previous refresh completed if(m_bScreenRefreshCompleted) { m_bScreenRefreshCompleted = FALSE; POSITION pos = GetFirstViewPosition(); CProject1View *pView = (CProject1View *)GetNextView(pos); if (pView == NULL) return; HWND hWindow = pView->GetSafeHwnd(); if (hWindow == NULL) return; RECT recpict ; recpict.left =0; recpict.top =0; recpict.right = m_SizeX-1; recpict.bottom = m_SizeY-1; InvalidateRect(hWindow,&recpict,FALSE); } } ///////////////////////////////////////////////////////////////////////////// // CProject1Doc commands void CProject1Doc::OnGoMenu() { // Activate the channel McSetParamInt (m_Channel, MC_ChannelState, MC_ChannelState_ACTIVE); } ///////////////////////////////////////////////////////////////////////////// // CProject1Doc serialization void CProject1Doc::Serialize(CArchive& ar) { if (ar.IsStoring()) { // TODO: add storing code here } else { // TODO: add loading code here } } ///////////////////////////////////////////////////////////////////////////// // CProject1Doc diagnostics #ifdef _DEBUG void CProject1Doc::AssertValid() const { CDocument::AssertValid(); } void CProject1Doc::Dump(CDumpContext& dc) const { CDocument::Dump(dc); } #endif //_DEBUG |
Marcvip
一般會員 ![]() ![]() 發表:5 回覆:9 積分:2 註冊:2003-03-24 發送簡訊給我 |
現在回復不曉得會不會太晚了,
第一我需要知道影像擷取進來的用的參數名稱 Ans:影像取得的address在您的code,McGetParamInt (SigInfo->SignalInfo, MC_SurfaceAddr, (PINT32) &m_pCurrent); 其中m_pCurrent就是影像的起點的address,長度就依你設定的寬*高. 第二我要如何才能從連續的影像中改成一張一張地處理。 Ans:將McSetParamInt (m_Channel, MC_ChannelState, MC_ChannelState_ACTIVE); 改為McSetParamInt(m_Channel, MC_SeqLength_Fr, MC_HIGH_PART);,就會grab一張影像,要改回去連續取像,再下McSetParamInt (m_Channel, MC_ChannelState, MC_ChannelState_ACTIVE); 建議: 建議你用他的工具處理影像會比較方便(不過要買licence) EC24Image1->SetImagePointer(m_SizeX,m_SizeY,(long)m_pCurrent,0); 這樣你就可以用他的元件做一些如二直化,PATTERN MATCH.OCR........
編輯記錄
Marcvip 重新編輯於 2009-03-11 14:25:41, 註解 無‧
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |