0

Visual Studio 2010、OpenCV 2.2.2、Windows 7 64x を使用

私のコードは正常にビルドされ、デバッグに入ると次のエラーが発生します。

First-chance exception at 0x75f0c41f in MachineVisionHW0.exe: Microsoft C++ exception: cv::Exception at memory location 0x002dec90..
Unhandled exception at 0x75f0c41f in MachineVisionHW0.exe: Microsoft C++ exception: cv::Exception at memory location 0x002dec90..

次に、デバッグを終了し、ファイル ディレクトリに移動して、ビルドされた実行可能ファイルを実行すると、問題なく実行されます。これを修正する方法を知っている人はいますか?コードの作成が妨げられるわけではありませんが、非常に不便です。これを実行しているコードの例を以下に示します。

int main(){
    cv::Mat image1 = cv::imread("img1.JPG", CV_LOAD_IMAGE_GRAYSCALE);

    cv::namedWindow("Sample1");
    cv::imshow("Sample1", image1);
    cv::waitKey(0); 

    return 1;
}
4

1 に答える 1