示例#1
0
    double normalizeArea(RegionCandidate candidate)
    {
        var maxArea = searchRect.area();

        candidate.calcArea();
        return(candidate.area / maxArea);
    }
示例#2
0
    double degreeOfCentering(RegionCandidate candidate)
    {
        // roiの中心
        Point  roiCenter   = ARUtil.getRectCenterPoint(searchRect);
        double maxDistance = (searchRect.width + searchRect.height);

        return(ARUtil.clothness(roiCenter, candidate.center, maxDistance));
    }
示例#3
0
    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();
    }
示例#4
0
 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);
 }
示例#5
0
 public Region(int x, int y, int width, int height)
 {
     rect      = new OpenCVForUnity.Rect(x, y, width, height);
     candidate = new RegionCandidate();
     id        = createId();
 }