Catch an update image event and display the new image
| 353 | |
| 354 | // Catch an update image event and display the new image |
| 355 | void ActiveStereoFrame::UpdateImage(wxCommandEvent &event) |
| 356 | { |
| 357 | |
| 358 | // image is shipped as a pointer in the event |
| 359 | // cast to IplImage (must release once finished) |
| 360 | IplImage *img = (IplImage*)event.GetClientData(); |
| 361 | |
| 362 | if (updateImageRunning == true) |
| 363 | { |
| 364 | txtLog->AppendText(wxT("\nUpdate image was already running")); |
| 365 | cvReleaseImage(&img); |
| 366 | return; |
| 367 | } |
| 368 | updateImageRunning = true; |
| 369 | |
| 370 | // camera is connected -- update if it isn't |
| 371 | if (cameraConnected != true) |
| 372 | { |
| 373 | cameraConnected = true; |
| 374 | lblCameraConnected->SetLabel(wxT("Connected")); |
| 375 | |
| 376 | // reset layouts now that the length of the label in lblCameraConnected has changed |
| 377 | flexGridStatus->Layout(); |
| 378 | staticBoxSizerStatus->Layout(); |
| 379 | headBoxSizer->Layout(); |
| 380 | |
| 381 | butCapture->Enable(true); |
| 382 | butCapture->SetFocus(); |
| 383 | } |
| 384 | |
| 385 | // update image display |
| 386 | m_pCamView->DrawCam(img); |
| 387 | |
| 388 | // delete the image that was copied for us to display |
| 389 | cvReleaseImage(&img); |
| 390 | |
| 391 | updateImageRunning = false; |
| 392 | |
| 393 | // update the FPS display |
| 394 | framesSinceLastFpsUpdate ++; |
| 395 | |
| 396 | |
| 397 | } |
| 398 | |
| 399 | // catch a display text event and append the text to the terminal display |
| 400 | void ActiveStereoFrame::DisplayText(wxCommandEvent &event) |