Esempio n. 1
0
        private AssemblyZone createAssemblyZoneFromFactory(int pX, int pY, int pWidth, int pHeight, bool[,] pMask, bool p7, bool pDetectRemoval, int pArea, Polygon pContour = null)
        {
            AssemblyZone z = new AssemblyZone(m_IdCounter);

            z.Name           = m_IdCounter.ToString();
            z.TriggerMessage = "z" + m_IdCounter;
            m_IdCounter++;
            if (pDetectRemoval)
            {
                z.IsDisassemblyZone = true;
            }
            z.X            = pX;
            z.Y            = pY;
            z.Width        = pWidth;
            z.Height       = pHeight;
            z.DepthMask    = pMask;
            z.UseDepthmask = true;
            z.Area         = pArea;
            z.Contour      = pContour;
            z.DepthArray   = getDepthArrayFromAssemblyZone(z);

            z.trigger += WorkflowManager.Instance.OnTriggered;

            return(z);
        }
Esempio n. 2
0
        public AssemblyZone createAssemblyZoneFromChanges()
        {
            //TODO: wait for smoothing
            Image <Gray, Int32> currentDepthImageCropped = HciLab.Kinect.CameraManager.Instance.DepthImageCropped;

            AssemblyZone z  = createAssemblyZoneFromChanges(currentDepthImageCropped, false);
            AssemblyZone dz = createAssemblyZoneFromChanges(currentDepthImageCropped, true);

            if (z == null && dz == null)
            {
                return(null);
            }

            if (z != null && dz == null)
            {
                return(z);
            }

            if (dz != null && z == null)
            {
                return(dz);
            }

            if (z.Area > dz.Area)
            {
                return(z);
            }
            else
            {
                return(dz);
            }
        }
Esempio n. 3
0
        public AssemblyZone createAssemblyZoneFromFactory()
        {
            AssemblyZone ret = new AssemblyZone(m_IdCounter);

            ret.Name           = m_IdCounter.ToString();
            ret.TriggerMessage = "z" + m_IdCounter;
            m_IdCounter++;
            ret.trigger += WorkflowManager.Instance.OnTriggered;

            return(ret);
        }
Esempio n. 4
0
        public static int[,] getDepthArrayFromAssemblyZone(AssemblyZone pZone)
        {
            Image <Gray, Int32> pDepthImg = HciLab.Kinect.CameraManager.Instance.DepthImage;

            //pDepthImg.ROI = new Rectangle(pZone.X, pZone.Y, pZone;
            int[,] depthArray = new int[pZone.Width, pZone.Height];
            for (int x = pZone.X; x < pZone.X + pZone.Width; x++)
            {
                for (int y = pZone.Y; y < pZone.Y + pZone.Height; y++)
                {
                    depthArray[x - pZone.X, y - pZone.Y] = pDepthImg.Data[y, x, 0];
                }
            }
            return(depthArray);
        }
Esempio n. 5
0
 public Scene.Scene getAssemblyZoneAutoScene(AssembleyZones.AssemblyZone z)
 {
     Scene.SceneItem drawable = z.getDrawable(true);
     Scene.Scene     autoScene;
     if (drawable is Scene.Scene)
     {
         // we already have a scene
         autoScene = (Scene.Scene)drawable;
     }
     else
     {
         autoScene = new Scene.Scene();
         autoScene.Add(drawable);
     }
     return(autoScene);
 }
Esempio n. 6
0
 public void updateCurrentAssemblyZone(AssemblyZone updatedAssemblyZone)
 {
     m_CurrentLayout.AssemblyZones.ReplaceOrAdd(updatedAssemblyZone);
 }