コード例 #1
0
        public void Motion2aMultipleCompare()
        {
            try
            {
                //images in memory when sent to the
                ByteWrapper image1 = ImageConvert.ReturnByteWrapper(@"F:\temp\analysis\640x480\test_0.jpg");
                ByteWrapper image2 = ImageConvert.ReturnByteWrapper(@"F:\temp\analysis\640x480\test_1.jpg");

                PixelMatrix dummy = new PixelMatrix();
                dummy.LinkCompare = true;
                dummy.Populate(new BitmapWrapper(ImageConvert.ReturnBitmap(image1.bytes)), new BitmapWrapper(ImageConvert.ReturnBitmap(image2.bytes)));

                MotionSensor_2a motion = new MotionSensor_2a();
                motion.ThresholdSet         = true;
                motion.settings.linkCompare = true;
                motion.Comparison           = dummy.Comparision;

                motion.ImageCreated(image1, EventArgs.Empty);
                motion.ImageCreated(image2, EventArgs.Empty);

                motion.ImageCreated(image1, EventArgs.Empty);
                motion.ImageCreated(image2, EventArgs.Empty);


                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }
コード例 #2
0
        public void Motion2aSubequent()
        {
            try
            {
                List <int> dimensions = ReturnDimensions();
                Stopwatch  sw         = new Stopwatch();
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"f:\temp\runtime\motion_analysis.txt", true))
                {
                    for (int i = 0; i < dimensions.Count; i++)
                    {
                        for (int n = 0; n < 200; n++)
                        {
                            //images in memory when sent to the
                            ByteWrapper image1 = ImageConvert.ReturnByteWrapper(@"F:\temp\analysis\640x480\test_0.jpg");
                            image1.sequenceNumber = i;
                            ByteWrapper image2 = ImageConvert.ReturnByteWrapper(@"F:\temp\analysis\640x480\test_1.jpg");
                            image2.sequenceNumber = i;


                            PixelMatrix dummy = new PixelMatrix();
                            dummy.LinkCompare = true;
                            dummy.SearchWidth = dimensions[i];
                            dummy.Populate(new BitmapWrapper(ImageConvert.ReturnBitmap(image1.bytes)), new BitmapWrapper(ImageConvert.ReturnBitmap(image2.bytes)));


                            sw.Restart();
                            MotionSensor_2a motion = new MotionSensor_2a();
                            motion.ThresholdSet         = true;
                            motion.settings.linkCompare = true;
                            motion.settings.searchWidth = dimensions[i];
                            motion.Comparison           = dummy.Comparision;

                            motion.ImageCreated(image1, EventArgs.Empty);
                            motion.ImageCreated(image2, EventArgs.Empty);

                            motion.ImageCreated(image1, EventArgs.Empty);
                            motion.ImageCreated(image2, EventArgs.Empty);
                            sw.Stop();
                            file.WriteLine(i + " - " + n + " - " + " no grid - " + sw.Elapsed.TotalMilliseconds);
                        }
                    }
                }
                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }