Attempt to connect to the camera and grab a frame
| 89 | |
| 90 | // Attempt to connect to the camera and grab a frame |
| 91 | bool Cameras::InitializeCamera() |
| 92 | { |
| 93 | //m_MyCapture = cvCreateCameraCapture(CV_CAP_ANY); |
| 94 | m_MyCapture = cvCaptureFromCAM(cameraNum); |
| 95 | if (!m_MyCapture) |
| 96 | { |
| 97 | m_pMemo->AppendText(wxT("\nFailed to connect to camera.")); |
| 98 | return false; |
| 99 | } |
| 100 | cvQueryFrame(m_MyCapture); // this call is necessary to get correct capture properties |
| 101 | |
| 102 | // TODO: These resolution selection calls don't appear to work right now. |
| 103 | //cvSetCaptureProperty(m_MyCapture, CV_CAP_PROP_FRAME_WIDTH, 1280); |
| 104 | //cvSetCaptureProperty(m_MyCapture, CV_CAP_PROP_FRAME_HEIGHT, 960); |
| 105 | m_FrameHeight = (int) cvGetCaptureProperty(m_MyCapture, CV_CAP_PROP_FRAME_HEIGHT); |
| 106 | m_FrameWidth = (int) cvGetCaptureProperty(m_MyCapture, CV_CAP_PROP_FRAME_WIDTH); |
| 107 | //m_FrameRate = (int) cvGetCaptureProperty(m_MyCapture, CV_CAP_PROP_FPS); |
| 108 | wxString TempString = wxT("\nCamera online at "); |
| 109 | TempString << m_FrameWidth << wxT("x") << m_FrameHeight << wxT("."); |
| 110 | m_pMemo->AppendText(TempString); |
| 111 | |
| 112 | FrameGrab(); |
| 113 | |
| 114 | return true; |
| 115 | } |
| 116 | |
| 117 | // Determine if we are OK to capture from the camera |
| 118 | bool Cameras::CaptureExists() |
nothing calls this directly
no outgoing calls
no test coverage detected