double normalizeArea(RegionCandidate candidate) { var maxArea = searchRect.area(); candidate.calcArea(); return(candidate.area / maxArea); }
double degreeOfCentering(RegionCandidate candidate) { // roiの中心 Point roiCenter = ARUtil.getRectCenterPoint(searchRect); double maxDistance = (searchRect.width + searchRect.height); return(ARUtil.clothness(roiCenter, candidate.center, maxDistance)); }
public Region(RegionCandidate candidate, Mat parentMat) { this.parentMat = parentMat; this.candidate = candidate; // 輪郭を塗りつぶしてマスク画像を作成 mask = Mat.zeros(parentMat.size(), CvType.CV_8UC1); Imgproc.drawContours(mask, new List <MatOfPoint> { candidate.contour }, 0, new Scalar(255), -1); //マスク画像のROIを作成 rect = Imgproc.boundingRect(candidate.contour); roiMask = new Mat(mask, rect); id = createId(); }
public Region(RegionCandidate candidate, Mat parentMat, Region previousRegion) : this(candidate, parentMat) { this.previousRegion = previousRegion; this.velocity = new Point(this.center.x - previousRegion.center.x, this.center.y - previousRegion.center.y); }
public Region(int x, int y, int width, int height) { rect = new OpenCVForUnity.Rect(x, y, width, height); candidate = new RegionCandidate(); id = createId(); }