示例#1
0
        private void FindBinocularBoundaries()
        {
            boundaries.Clear();
            int start = 0;

            for (int i = 0; i < LBoundaries.Count; i++)
            {
                for (int j = start; j < RBoundaries.Count; j++)
                {
                    ColorInt cLL = LBoundaries[i].colorL;
                    ColorInt cLR = LBoundaries[i].colorR;
                    ColorInt cRL = RBoundaries[j].colorL;
                    ColorInt cRR = RBoundaries[j].colorR;
                    if (cLL == cRL || cLR == cRR)
                    {
                        //find distance and error
                        int       l1             = LBoundaries[i].direction;
                        int       r1             = RBoundaries[j].direction;
                        PointPlus leftPoint      = FindDepth(l1, r1);
                        PointPlus leftPointError = FindDepth(l1 - 1, r1);
                        float     error          = leftPointError.R - leftPoint.R;
                        if (error < 0)
                        {
                            break;
                        }
                        leftPoint.Conf = error;

                        PointPlus pp = new PointPlus()
                        {
                            R = leftPoint.R, Theta = leftPoint.Theta, Conf = leftPoint.Conf
                        };
                        //if both sides of the point match...this creates two boundaries, one for each color
                        if (cLL == cRL)
                        {
                            BinocularBoundary bb = new BinocularBoundary()
                            {
                                p        = leftPoint,
                                theColor = cLL,
                                changed  = LBoundaries[i].changed,
                            };
                            boundaries.Add(bb);
                        }
                        if (cLR == cRR)
                        {
                            BinocularBoundary bb = new BinocularBoundary()
                            {
                                p        = pp,
                                theColor = cLR,
                                changed  = LBoundaries[i].changed,
                            };
                            boundaries.Add(bb);
                        }
                        start = j;
                        break;
                    }
                }
            }
        }
示例#2
0
        //an area must appear in both eyes to count
        //partial areas as the edge of the field of view will have only one endpoint
        //this relies on having only one area per color in the visual field
        private void FindAreasOfColor()
        {
            areas.Clear();
            if (boundaries.Count == 0)
            {
                return;
            }
            BinocularBoundary bb1 = boundaries[0];

            for (int i = 1; i < boundaries.Count; i++)
            {
                BinocularBoundary bb2 = boundaries[i];
                if (bb1.theColor == bb2.theColor)
                {
                    Area aa = new Area()
                    {
                        PL       = bb1.p,
                        PR       = bb2.p,
                        lChanged = bb1.changed,
                        RChanged = bb2.changed,
                        theColor = bb1.theColor,
                    };
                    //aa.angleFromTexture = GetAngleFromTexture(aa);
                    Segment s = new Segment()
                    {
                        P1 = aa.PL, P2 = aa.PR, theColor = aa.theColor,
                    };
                    Module2DModel nmModel = (Module2DModel)FindModuleByType(typeof(Module2DModel));
                    if (nmModel != null)
                    {
                        aa.t = nmModel.MostLikelySegment(s);
                    }
                    areas.Add(aa);
                }
                bb1 = bb2;
            }
        }