bool MyApp::OnInit() { initFrame = new MyInitFrame(); initFrame->Show(); initFrame->Center(); MyFrame* f = new MyFrame(); f->SetTransparent(0); f->Center(); f->Show(); DWORD tid; hVideo = CreateThread(NULL, 0, video_test, f, 0, &tid); return true; }
DWORD WINAPI video_test(void* data) { MyFrame* f = (MyFrame*)data; wxClientDC dc(f->left_bottom); cap.open(0); cv::Mat img; cap >> img; Sleep(2000); initFrame->Hide(); // 开始显示 for (int i = 0; i < 50; i++) { f->SetTransparent(i + 206); Sleep(i / 10); } while (cap>>img,!img.empty()) { IplImage image = img.operator IplImage(); wxImage wximg = wx_from_cv(&image); wximg.Rescale(320, 240); dc.DrawBitmap(wxBitmap(wximg), wxDefaultPosition); } return 0; }