public void MotionSensor_2b_threshold()
        {
            MotionSensor_2b motion = new MotionSensor_2b();
            motion.settings = new MotionSensorSettings();
            motion.settings.LoadDefaults();

            motion.ControlImageNumber = 10;

            foreach (var file in Directory.EnumerateFiles(@"d:\bsc\project\TestImages"))
            {
                ByteWrapper wrapper = ImageConvert.ReturnByteWrapper(file);
                motion.ImageCreatedAsync(wrapper, EventArgs.Empty);
                Thread.Sleep(250);
            }
            Assert.IsNotNull(motion.ThresholdImage);

            for(int i = 0; i < motion.ThresholdImage.Columns.Count; i++)
            {
                for(int n = 0; n < motion.ThresholdImage.Columns[i].grids.Count;n++)
                {
                    Assert.IsTrue(motion.ThresholdImage.Columns[i].grids[n].threshold != 0);
                }                     
            }

        }//MotionSensor_2b_threshold
        public void Run(string captureKey)
        {
            //set up the extractor
            string uri = "http://localhost:9000/api/jpeg/0/" + captureKey;

            ImageExtractor imageExtractor = new ImageExtractor(uri, "root", "root");

            //create the motion sensor, and listen for images
            MotionSensor_2b motionSensor = new MotionSensor_2b();
            motionSensor.motionDetected += new MotionSensor_2.MotionDetected(MotionDetected);

            //create the validator 
            ImageValidator imageValidator = new ImageValidator();
            imageValidator.ListenForImages(imageExtractor);
            imageValidator.imageValidated += new ImageValidator.ImageValidatedEvent(motionSensor.ImageCreatedAsync);//subscribe to events from the validator

            imageExtractor.Run();

        }