0
我再次運行查找等高線功能,但總是返回空白。OpenCV FindContours return empty
我Xamarin的Android代碼:
var frame = new Mat();
bitmapOptions = new BitmapFactory.Options();
bitmapOptions.InScaled = false;
var bitmapTemplateOrig = BitmapFactory.DecodeResource(this.Resources, Resource.Drawable.abi_canny, bitmapOptions);
OpenCV.Android.Utils.BitmapToMat(bitmapTemplateOrig, frame);
bitmapTemplateOrig.Dispose();
Imgproc.CvtColor(frame, frame, Imgproc.ColorRgba2gray);
var contours = new List<MatOfPoint>();
Imgproc.FindContours(frame, contours, new Mat(), Imgproc.RetrList, Imgproc.ChainApproxSimple, new Core.Point(0, 0));
var size = contours.Count(); // returns 0 here?
任何想法?
我能獲得518組的輪廓爲這個圖象的一半大小。你如何運行它? –
不知道。我爲Android使用了Xamarin。我更新了我的代碼。 –
@JeruLuke:你可以發佈你的代碼嗎? –