Exemple #1
0
        private FocusAreas GetFocusPoint(Slice slice, CameraPoint size)
        {
            var pointsNum  = slice[47];
            var focusSlice = new Slice(slice, 48);
            int multiplier = GetMultiplier(slice);

            if (pointsNum > 0)
            {
                var result = new FocusAreas(pointsNum, size, slice[46] == 0xff);

                for (var i = 0; i < pointsNum; i++)
                {
                    var x1      = focusSlice.ToShort(0 + (i * multiplier));
                    var y1      = focusSlice.ToShort(2 + (i * multiplier));
                    var x2      = focusSlice.ToShort(4 + (i * multiplier));
                    var y2      = focusSlice.ToShort(6 + (i * multiplier));
                    var typeval = (int)focusSlice.ToUShort(10 + (i * multiplier));
                    var type    = Enum.IsDefined(typeof(FocusAreaType), typeval) ? (FocusAreaType)typeval : FocusAreaType.FaceOther;
                    var failed  = focusSlice[9 + (i * multiplier)] == 0;
                    result.AddBox(x1, y1, x2, y2, type, failed);
                }

                return(result);
            }

            return(null);
        }
Exemple #2
0
 protected bool Equals(FocusAreas other)
 {
     return(hashcode == other.hashcode);
 }