OpenCV로 웹캠 이미지를 캡처하고 있습니다. 그건 잘 작동합니다. 그러나 버튼을 눌렀을 때 OpenCV를 닫으려는 경우 작동하지 않습니다 (cvDestroyWindow("NameOfWindow")
및 cvDestroyAllWindows()
모두 시도). 창은 계속 열려 있고 응용 프로그램은 계속 실행 중입니다.OpenCV 창을 닫으려고해도 아무런 효과가 없습니다.
OpenCV는 기본 GUI의 별도 스레드에서 초기화되었습니다.
Mac에서 C++과 함께 Juce Framework를 사용하고 있습니다. OpenCV Window에 자체 cvNamedWindow가있는 경우 Qt 및 Windows Forms이있는 Windows에서도 동일한 문제가 발생합니다. 당신이 누락 될 수 있습니다 조각이 cvStartWindowThread
함수를 호출이다
PluginEditor.cpp
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "PluginProcessor.h"
#include "PluginEditor.h"
//
TestAudioProcessorEditor::TestAudioProcessorEditor (TestAudioProcessor* ownerFilter)
: AudioProcessorEditor (ownerFilter)
{
// This is where our plugin's editor size is set.
setSize (500, 500);
// open the tracker
openTracker();
}
// code for opencv handling
TestAudioProcessorEditor::openTracker() {
// KEY LINE: Start the window thread
cvStartWindowThread();
// Create a window in which the captured images will be presented
cvNamedWindow("Webcam", CV_WINDOW_AUTOSIZE);
cvWaitKey(0);
cvDestroyWindow("Webcam");
// window should disappear!
}
TestAudioProcessorEditor::~TestAudioProcessorEditor()
{
}
// paint stuff on the vst plugin surface
void TestAudioProcessorEditor::paint (Graphics& g) {
}
합니까'cvDestroyAllWindows() :
는 GCC로 컴파일 예제를 실행하려면? –윈도우를 생성 한 동일한 스레드 (즉,'cvNamedWindow ')에서'cvDestroy'를 호출합니까? – Jacob
@Dan Cecile 예이 시도했지만 작동하지 않습니다. – sn3ek