Example #1
0
        /// <summary>
        /// bate array ==> MilImage 변환기.
        /// </summary>
        /// <param name="array">버퍼.</param>
        /// <param name="width">폭.</param>
        /// <param name="height">높이.</param>
        /// <returns></returns>
        public static MilImage BufferToMilImage(byte[] buffer, int width, int heigth)
        {
            MilImage newMilImage = new MilImage();

            newMilImage.CreateColor(width, heigth, buffer);

            return(newMilImage);
        }
Example #2
0
        /// <summary>
        /// MilImage ==> byte array 변환기.
        /// </summary>
        /// <param name="matImage">MIL 이미지.</param>
        /// <returns></returns>
        public static byte[] MilImageToBuffer(MilImage milImage, System.Windows.Media.PixelFormat Format)
        {
            byte[] buffer = new byte[milImage.GetBufferSize()];

            milImage.GetColor((Format.BitsPerPixel / 8), buffer);

            System.Drawing.Size imageSize = (System.Drawing.Size)milImage.GetImageSize();

            return(buffer);
        }
Example #3
0
        public bool DoInspect(IParameter parameter, ref IInspectedResult inspectedResult)
        {
            if (parameter.SpecMap["Align"] is AlignSpec spec)
            {
                inspectedResult.Description += String.Format("정렬 이진화 값:{0} ", spec.BinarizationThreshold);
            }

            MilImage milImage = new MilImage();

            milImage.Alloc(MBandSize.Gray, 3776, 2684);
            milImage.Load(@"D:\HVModel\NANOS\00_0.bmp");
            Stopwatch watch = new Stopwatch();

            watch.Start();

            //for (int i = 0; i < 1000; i++)
            //{
            //	MilFilter.Median(milImage, milImage, 0, 0);
            //}

            List <MilImage> imageList = new List <MilImage>();

            for (int i = 0; i < 500; i++)
            {
                MilImage newImage = new MilImage();
                newImage.Alloc(MBandSize.Gray, 3776, 2684);
                newImage.CopyFrom(milImage, true);

                imageList.Add(newImage);
            }

            watch.Stop();

            IMessageInfo messageInfo = _container.Resolve <IMessageInfo>();

            messageInfo.Level       = 1;
            messageInfo.Category    = "측정";
            messageInfo.Description = String.Format("{0} ms", watch.ElapsedMilliseconds);
            App.Locator.MessageViewModel.MessageInfoList.Add(messageInfo);

            IResultObject resultObject = _container.Resolve <IResultObject>();

            resultObject.ResultType   = ResultType.Ok;
            resultObject.Description  = "정렬 정상.";
            resultObject.GrabImageMap = new Dictionary <string, IGrabImage>()
            {
                { "Align", parameter.GrabImageMap["Align"] }
            };
            resultObject.ShapeMap = new Dictionary <string, EditableShape>()
            {
                { "Align", parameter.EditableShapesMap["Align"].First() }
            };

            inspectedResult.ResultObjectMap.Add("Align", resultObject);

            foreach (var shape in parameter.EditableShapesMap["Align"])
            {
                IRoundingRect rect = shape as IRoundingRect;
            }

            return(true);
        }