0

Windows 8のVisual Studio 11でopencv 2.4.1を使用しています。

次のような完全に読みやすい名前をウィンドウに付けます。

namedWindow( "canny_src");
imshow( "canny_src", canny_src );

namedWindow( "canny_other_image");
imshow( "canny_other_image", canny_other );

namedWindow( "RESULT");
imshow( "RESULT", result );

しかし、窓が開いていると、非常にまれな名前が表示されます。自分で見てください。

ここに画像の説明を入力

誰かが修正するのを手伝ってくれますか

編集!!!コード全体はこちら。

  #include "stdafx.h"
  #include "cv.h"
  #include "highgui.h"
  #include "opencv2\imgproc\imgproc.hpp"

  using namespace cv;

  Mat src;
  Mat other;

  int thresh_src = 100;
  int thresh_other = 100;
  int max_thresh = 255;

  void thresh_callback(int, void* );

  int main(int argc, _TCHAR* argv[])
  {
    IplImage *_img = cvLoadImage("C:\\Users\\Eric\\Desktop\\lena.jpg", 0);
    IplImage *_img_other = cvLoadImage("C:\\Users\\Eric\\Desktop\\lena.jpg", 0);
    src = Mat(_img);

    other = Mat(_img_other);


    namedWindow("image");
    imshow("image", src);


    createTrackbar("Tracking src: ", "image", &thresh_src, max_thresh, thresh_callback);
    createTrackbar("Tracking other: ", "image", &thresh_other, max_thresh, thresh_callback);


    waitKey(0);
  }



  void thresh_callback(int, void*)
  {
    Mat canny_src;
    Mat canny_other;
    Mat result;
    Canny(src, canny_src, thresh_src, thresh_src * 2, 3);
    Canny(other, canny_other, thresh_other, thresh_other * 2, 3);

    bitwise_and(canny_src, canny_other, result);


    namedWindow( "canny_src");
    imshow( "canny_src", canny_src );

    namedWindow( "canny_other_image");
    imshow( "canny_other_image", canny_other );

    namedWindow( "RESULT");
    imshow( "RESULT", result );
}
4

3 に答える 3

0

コードをコピーして、システムで実行しました。誤ったウィンドウ名は取得されませんでした。出力を添付しました。 ここに画像の説明を入力してください

于 2012-11-09T17:00:02.107 に答える
0

同様のエラーが発生しました。私の imshow ウィンドウには常にバグのあるタイトルがあり、imread は常に失敗しました (img.data はありません)。いくつかのテストの後、「_DEBUG;」があることがわかりました。リリースで実行中の私のプリプロセッサ定義で。もう 1 つのエラー ソースは、ランタイム ライブラリと、デバッグ ライブラリとリリース ライブラリの混在です。これが誰かに役立つことを願っています。

于 2015-11-12T07:09:28.120 に答える
0

置く

setlocale( 0, "" ); 

あなたが言及する前に。

于 2012-11-09T16:03:07.717 に答える