Last active
August 29, 2015 14:17
-
-
Save 0V/35a9749221ea8cabf294 to your computer and use it in GitHub Desktop.
メモリリークする場合としない場合がある
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 運が良いと、ガーベージコレクタがゴミリソースを回収してくれる | |
public static void CannotAllocateMemoryMethod3(int cameraId) | |
{ | |
using (var capture = new VideoCapture(cameraId)) | |
{ | |
var srcMat = new Mat(); | |
var dstMat = new Mat(); | |
while (Cv2.WaitKey(1) < 0) | |
{ | |
capture.Read(srcMat); | |
dstMat = srcMat.CvtColor(ColorConversion.BgrToGray) | |
.Threshold(100, 255, ThresholdType.Binary) | |
.CvtColor(ColorConversion.GrayToBgr); | |
Cv2.ImShow("src", srcMat); | |
Cv2.ImShow("dst", dstMat); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment