Exemplo n.º 1
0
		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();
		}
Exemplo n.º 2
0
 public void Load(ImageRGB image)
 {
     lock (image.GetLock())
         if (image.Ptr != null)
         {
             FIsFresh = true;
             CvInvoke.cvCvtColor(image.Ptr, FBufferImage.Ptr, COLOR_CONVERSION.CV_RGB2RGBA);
         }
 }
Exemplo n.º 3
0
		public FaceTrackingInstance(ImageRGB image, HaarCascade cascade)
		{
			FSource = image;
			FHaarCascade = cascade;
			FTrackingThread = new Thread(fnFindFacesThread);
			FTrackingThread.Start();

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

            IsRunning = true;
        }
Exemplo n.º 5
0
        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();
                }
            }
        }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
        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);
				}
			}
		}
Exemplo n.º 9
0
		//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;
				}
			}


		}
Exemplo n.º 10
0
		public void Load(ImageRGB image)
		{
			lock (image.GetLock())
				if (image.Ptr != null)
				{
					FIsFresh = true;
					CvInvoke.cvCvtColor(image.Ptr, FBufferImage.Ptr, COLOR_CONVERSION.CV_RGB2RGBA);
				}
		}
Exemplo n.º 11
0
		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();
				}
			}
		}