public void Evaluate(int spreadMax)
		{
			if (!FPinInFilename.IsChanged || FPinInFilename.SliceCount < 1) return;

			FPinOutImage.SliceCount = spreadMax;
			FPinOutStatus.SliceCount = spreadMax;
			FImages.SliceCount = spreadMax;

			for (int i = 0; i < spreadMax; i++)
			{
				if(FPinInFilename[i] == FFilename[i]) continue;

				FPinOutImage[i] = new ImageRGB();
				
				try
				{
					FImages[i] = new ImageRGB();
					FPinOutImage[i] = FImages[i];
					Image<Bgr, byte> image = new Image<Bgr, byte>(FPinInFilename[i]);

					FImages[i].SetImage(image);

					FPinOutStatus[i] = "OK";
				}
				catch
				{
					FPinOutStatus[i] = "Failed";
				}
			}

			FFilename = (Spread<string>) FPinInFilename.Clone();
		}
 public void Load(ImageRGB image)
 {
     lock (image.GetLock())
         if (image.Ptr != null)
         {
             FIsFresh = true;
             CvInvoke.cvCvtColor(image.Ptr, FBufferImage.Ptr, COLOR_CONVERSION.CV_RGB2RGBA);
         }
 }
		public FaceTrackingInstance(ImageRGB image, HaarCascade cascade)
		{
			FSource = image;
			FHaarCascade = cascade;
			FTrackingThread = new Thread(fnFindFacesThread);
			FTrackingThread.Start();

			IsRunning = true;
		}
Exemple #4
0
        public FaceTrackingInstance(ImageRGB image, HaarCascade cascade)
        {
            FSource         = image;
            FHaarCascade    = cascade;
            FTrackingThread = new Thread(fnFindFacesThread);
            FTrackingThread.Start();

            IsRunning = true;
        }
        void ResizeOutput(int count)
        {
            FPinOutStatus.SliceCount   = count;
            FPinOutImage.SliceCount    = count;
            FPinOutLength.SliceCount   = count;
            FPinOutPosition.SliceCount = count;

            for (int i = 0; i < count; i++)
            {
                if (FPinOutImage[i] == null)
                {
                    FPinOutImage[i] = new ImageRGB();
                }
            }
        }
        public void Initialise(ImageRGB image, string filePath, int codec)
        {
            try
            {
                FVideoWriter = new VideoWriter(filePath, codec, 25, image.Width, image.Height, true);
                Image        = image;
            }
            catch
            {
                IsRunning = false;
                return;
            }

            RunCaptureThread = true;
            CaptureThread    = new Thread(Process);
            CaptureThread.Start();
            IsRunning = true;
        }
        private void Initialise(ImageRGB image)
        {
            lock (Lock)
            {
                RemoveListeners();

                if (image == null || !image.HasAllocatedImage)
                {
                    FBufferImage = null;
                    Initialised  = false;
                    return;
                }

                FImage = image;
                Allocate();

                if (Initialised)
                {
                    AddListeners();
                    Load(image);
                }
            }
        }
		private void Initialise(ImageRGB image)
		{
			lock (Lock)
			{
				RemoveListeners();

				if (image == null || !image.HasAllocatedImage)
				{
					FBufferImage = null;
					Initialised = false;
					return;
				}

				FImage = image;
				Allocate();

				if (Initialised)
				{
					AddListeners();
					Load(image);
				}
			}
		}
		//called when data for any output pin is requested
		public void Evaluate(int SpreadMax)
		{
			if (FPinInContext[0] != FContext)
			{
				FContext = FPinInContext[0];
			}

			if (FContext == null)
			{
				FRunning = false;
				return;
			}

			if (FContext.running && !FRunning && FContext.context != null)
			{
				try
				{
					FImageGenerator = FContext.context.FindExistingNode(global::OpenNI.NodeType.Image) as ImageGenerator;
					FDepthGenerator = FContext.context.FindExistingNode(global::OpenNI.NodeType.Depth) as DepthGenerator;
					FDepthGenerator.AlternativeViewpointCapability.SetViewpoint(FImageGenerator);

					FImageRGB = new ImageRGB();
					FImageDepth = new ImageL16();
					FImageWorld = new ImageRGB32F();

					Size size = new Size(640, 480);
					FImageRGBBuffer = new Image<Bgr, byte>(size);
					FImageDepthBuffer = new Image<Gray,ushort>(size);
					FImageWorldBuffer = new Image<Rgb, float>(size);

					FPinOutRGB[0] = FImageRGB;
					FPinOutDepth[0] = FImageDepth;
					FPinOutWorld[0] = FImageWorld;

					FThread = new Thread(fnThread);
					FRunning = true;
					FThread.Start();
					FPinOutStatus[0] = "OK";
				}
				catch (StatusException e)
				{
					FRunning = false;
					FPinOutStatus[0] = e.Message;
				}
			}


		}
		public void Load(ImageRGB image)
		{
			lock (image.GetLock())
				if (image.Ptr != null)
				{
					FIsFresh = true;
					CvInvoke.cvCvtColor(image.Ptr, FBufferImage.Ptr, COLOR_CONVERSION.CV_RGB2RGBA);
				}
		}
		void ResizeOutput(int count)
		{
			FPinOutStatus.SliceCount = count;
			FPinOutImage.SliceCount = count;
			FPinOutLength.SliceCount = count;
			FPinOutPosition.SliceCount = count;

			for (int i = 0; i < count; i++)
			{
				if (FPinOutImage[i] == null)
				{
					FPinOutImage[i] = new ImageRGB();
				}
			}
		}