설치 자습서 끝에 제공된 예제 소스 코드를 사용하여 OpenCV 2.4.10을 테스트하고 있습니다. 코드가 컴파일되지만 시작한 후 곧 종료됩니다. 첫 번째 "소리 메시지"의 깜박임을 보지만 이미지 로딩이나 다른 것의 플래시조차 보이지 않습니다. Visual Studio 2012 C++ 및 OpenCV 2.4.10을 사용하고 있습니다.OpenCV 이미지로드 프로그램 종료
테스트 코드 : 나는 그것을 만들 때
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
if(argc != 2)
{
cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image;
image = imread("opencv-logo.png", IMREAD_COLOR); // Read the file
if(! image.data) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
imshow("Display window", image); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}
, 내가 실수로 불필요한 DLL 인해 이전 프로젝트에서 전역 설정에 아마로드합니다. 부하 중 일부는 나에게이 오류 제공 :
'test.exe' (Win32): Loaded 'C:\opencv\build\x64\vc11\bin\opencv_highgui2410d.dll'. Cannot find or open the PDB file.
'test.exe' (Win32): Loaded 'C:\opencv\build\x64\vc11\bin\opencv_core2410d.dll'. Cannot find or open the PDB file.
'test.exe' (Win32): Loaded 'C:\Program Files\NVIDIA Corporation\coprocmanager\_etoured.dll'. Cannot find or open the PDB file.
'test.exe' (Win32): Loaded 'C:\Program Files\NVIDIA Corporation\coprocmanager\Nvd3d9wrapx.dll'. Cannot find or open the PDB file.
'test.exe' (Win32): Loaded 'C:\Program Files\NVIDIA Corporation\coprocmanager\nvdxgiwrapx.dll'. Cannot find or open the PDB file.
'test.exe' (Win32): Loaded 'C:\Windows\System32\guard64.dll'. Cannot find or open the PDB file.
을 그리고 프로그램으로 종료 : 여기 무슨 일이 일어나고 있는지 정확히 모르겠어요
The program '[9084] test.exe' has exited with code -1 (0xffffffff).
, 나는 C에 다음을 추가 한/
: 내가 추가 라이브러리 디렉토리 링커> 일반>에 다음을 추가 한C:\opencv\build\include\opencv
C:\opencv\build\include\opencv2
C:\opencv\build\include
C++> 일반 0
그리고 라이브러리 (특히 nvidia 파일을 제외한로드 오류를 반환하는 라이브러리)를 링커> 입력에 연결합니다. 또한 vc11 \ bin 경로를 환경 변수에 추가했습니다.
잠깐 멈추려면 cin.get()을 사용해 보았지만 작동하지 않습니다. 이 DLL의 일부가 반환하는로드 오류와 관련이 있습니까?
누구나 올바른 방향으로 나를 가리킬 수 있습니까? 읽어 주셔서 감사합니다!
이미지가로드되지 않는 문제가 있습니다. OpenCV는 .PNG 파일과 호환되어야합니다. 또한 디버그 실행 파일과 동일한 폴더에 테스트 파일이 있습니다. – user1846359
Visual Studio의 기본 작업 디렉토리는 프로젝트 디렉토리라고 생각합니다. 해당 디렉터리 내의 명령 줄에서 디버그 실행 파일을 실행하고 작동하는지 확인하십시오. – Eric
네가 맞습니다. 기본 작업 디렉토리는 프로젝트 디렉토리입니다. – user1846359