Пример #1
0
        public FxMatrixF ToFxMatrixF(int Width, int Height)
        {
            FxMatrixF result = new FxMatrixF(Width, Height);
            int i = 0;
            foreach(FxContourChain chain in ChainList)
            {
                //chain.Equalization(20);
                i++;
                FxVector2f prevPoint = chain.StartPoint;
                foreach (FxComplexF c in chain.ListComplex)
                {
                    if (prevPoint.x >= Width)
                        prevPoint.x = Width-1;
                    if (prevPoint.y >= Height)
                        prevPoint.y = Height-1;
                    result[(int)prevPoint.x, (int)prevPoint.y] = i;

                    // calc the new prev point
                    prevPoint.x += c.r;
                    prevPoint.y += c.i;
                }

                // Draw boundrary rect
                result.DrawRect(chain.RectStart, chain.RectSize, i);
            }

            result.Divide(result.Max());

            return result;
        }
Пример #2
0
        private void ProcessMatrix()
        {
            try {
                // proccessing ...
                depthImageMatrixAve = a * depthImageMatrix + (1 - a) * depthImageMatrixAve;
                var depth = depthImageMatrixAve / depthImageMatrixAve.Max();
                //depthImageMatrix.Divide(depthImageMatrix.Max());
                //depthImageMatrix.MultiplyPointwise(colorImageMatrix);

                if(null == mapper) {
                    // Create a coordinate mapper
                    mapper = new CoordinateMapper(this.sensor);

                }

                //mapper.MapColorFrameToDepthFrame(ColorFormat, DepthFormat, depthImagePixels, depthImagePoints);
                mapper.MapDepthFrameToColorFrame(DepthFormat, depthImagePixels, ColorFormat, colorCoordinates);
                for(int i=0; i < depthWidth * depthHeight; i++) {
                    depth[i] *= colorImageMatrix[colorCoordinates[i].X, colorCoordinates[i].Y];
                }

              //  m = a * depthImageMatrix + (1 - a) * m;

                // Updating viewports...
                colorImageElement.UpdateInternalImage(colorImageMatrix);
                depthImageElement.UpdateInternalImage(depth, depthColorMap, true);
                canvas1.ReDraw();

                // The input frame was processed successfully, increase the processed frame count
                ++this.processedFrameCount;
            } catch(InvalidOperationException ex) {
                Console.WriteLine(ex.Message);
            } finally {
                this.processingFrame = false;
            }
        }