예제 #1
0
        private static void DebugDragMaxima(Rectangle regionBounds, SCalcRegionBuffers buffers, SCalcRegionTask data,
                                            Segmentation.MaxPoint[] maxPoints, int iMaxPointCount)
        {
            Rectangle roiRect = data.roiRect;

            int regionROIOffsetX = regionBounds.X - roiRect.X;
            int regionROIOffsetY = regionBounds.Y - roiRect.Y;

            if (iMaxPointCount > 1)
            {
                Console.WriteLine(" ----- Max debug -----");
                Console.WriteLine(" roi: pos({0},{1}) size({2},{3})", regionBounds.X, regionBounds.Y, regionBounds.Width, regionBounds.Height);
                Console.WriteLine(" max count:" + iMaxPointCount);
            }
            int ri = 0;

            for (int ry = 0; ry < regionBounds.Height; ry++)
            {
                for (int rx = 0; rx < regionBounds.Width; rx++)
                {
                    int iVal = buffers.maxMap[ri];
                    if (iVal > 0)
                    {
                        if ((iVal & Segmentation.MAX_POINT) > 0)
                        {
                            data.debugTexture.SetPixel(rx + regionROIOffsetX, ry + regionROIOffsetY, 0, 255, 0, 1);
                        }
                        else
                        {
                            data.debugTexture.SetPixel(rx + regionROIOffsetX, ry + regionROIOffsetY, 255, 0, 0, 1);
                        }
                        if (iMaxPointCount > 1)
                        {
                            Console.WriteLine("maxMap({0},{1})={2}", rx, ry, Segmentation.GetMaxMapString(iVal));
                        }
                    }
                    ri++;
                }
            }
            if (iMaxPointCount > 1)
            {
                foreach (Segmentation.MaxPoint maxPoint in maxPoints)
                {
                    ri = maxPoint.y * regionBounds.Width + maxPoint.x;
                    int iVal = buffers.maxMap[ri];
                    Console.WriteLine("maxPoint({0},{1})={2} : {3}", maxPoint.x, maxPoint.y, maxPoint.value, Segmentation.GetMaxMapString(iVal));
                }
            }
        }