Skip to content

Instantly share code, notes, and snippets.

@ochilab
Last active December 17, 2015 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ochilab/5655208 to your computer and use it in GitHub Desktop.
Save ochilab/5655208 to your computer and use it in GitHub Desktop.
OpenCVSharpをインストールしたときに動作確認のために試すコード。公式サイトのコードをそのまま引用し、Matの処理だけ追記してます。
//This code is quoted from the following URL
//http://schima.hatenablog.com/entry/2013/12/15/110513
using (var img = new IplImage(@"C:\OpenCv\Lena.png")) {
//Matが使えないケースがたまにあるので、最初に確認しておきましょう
Mat mat = new Mat(img);
Cv2.ImShow("mat",mat);
Cv.SetImageROI(img, new CvRect(200, 200, 180, 200));
Cv.Not(img, img);
Cv.ResetImageROI(img);
using (new CvWindow(img)) {
Cv.WaitKey();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment