Example #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void HandleChanged(object pSender, TimeValue pTime, int pSensor, ImagingState pReport)
        {
            if (vIsChanged)
            {
                return;
            }

            Marshal.Copy(pReport.data, vImgFloats, 0, vImgFloats.Length);

            for (int x = 0; x < ImageWidth; x++)
            {
                for (int y = 0; y < ImageHeight; y++)
                {
                    int floatI = (x + y * ImageWidth) * ImageChannels;
                    int colorI = (ImageWidth - x - 1) + y * ImageWidth;

                    vImgColors[colorI] = new Color(
                        vImgFloats[floatI + 2],
                        vImgFloats[floatI + 1],
                        vImgFloats[floatI]
                        );
                }
            }

            vIsChanged = true;
        }
Example #2
0
 /// <summary>
 /// Determines whether the imaging state is unsuitable to be put
 /// in the queue. Only Completed and Skipped are unsuitable.
 /// </summary>
 /// <param name="state">The state to assess</param>
 /// <returns>true if unsuitable to be queued, otherwise false</returns>
 private bool isStateUnqueuable(ImagingState state)
 {
     if (ImagingState.Completed.Equals(state) || ImagingState.Skipped.Equals(state))
     {
         return(true);
     }
     return(false);
 }
Example #3
0
 static void imaging_StateChanged(object sender, TimeValue timestamp, int sensor, ImagingState report)
 {
     var m = report.metadata;
     Console.WriteLine("Got Imaging report {0}:", reportNum++);
     Console.WriteLine("\twidth: {0}", m.width);
     Console.WriteLine("\theight: {0}", m.height);
     Console.WriteLine("\tdepth: {0}", m.depth);
     Console.WriteLine("\tnumber of color channels: {0}", m.channels);
     Console.WriteLine("\ttype: {0}", m.type.ToString());
 }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		private void HandleChanged(object pSender, TimeValue pTime, int pSensor, ImagingState pReport) {
			if ( vIsChanged ) {
				return;
			}

			for ( int x = 0 ; x < ImageWidth ; x++ ) {
				for ( int y = 0 ; y < ImageHeight ; y++ ) {
					int byteI = x+y*ImageWidth;
					int colorI = (ImageWidth-x-1) + y*ImageWidth;
					byte b = Marshal.ReadByte(pReport.data, byteI);

					vImgColors[colorI] = new Color32(b, b, b, 255);
				}
			}

			vIsChanged = true;
		}
Example #5
0
    private void HandleChanged(object sender, TimeValue timestamp, int sensor, ImagingState imageReport)
    {
        if (!firstReport)
        {
            firstReport = true;
            initVideoTexture(imageReport.metadata);
        }

        for (int i = 0; i < imageWidth * imageHeight; i++)
        {
            byte r = Marshal.ReadByte(imageReport.data, i * 3 + 0);
            byte g = Marshal.ReadByte(imageReport.data, i * 3 + 1);
            byte b = Marshal.ReadByte(imageReport.data, i * 3 + 2);
            imageData[i] = new Color32(r, g, b, 255);
        }

        videoTexture.SetPixels32(imageData);
        videoTexture.Apply();
    }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void HandleChanged(object pSender, TimeValue pTime, int pSensor, ImagingState pReport)
        {
            if (vIsChanged)
            {
                return;
            }

            for (int x = 0; x < ImageWidth; x++)
            {
                for (int y = 0; y < ImageHeight; y++)
                {
                    int  byteI  = x + y * ImageWidth;
                    int  colorI = (ImageWidth - x - 1) + y * ImageWidth;
                    byte b      = Marshal.ReadByte(pReport.data, byteI);

                    vImgColors[colorI] = new Color32(b, b, b, 255);
                }
            }

            vIsChanged = true;
        }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		private void HandleChanged(object pSender, TimeValue pTime, int pSensor, ImagingState pReport) {
			if ( vIsChanged ) {
				return;
			}

			Marshal.Copy(pReport.data, vImgFloats, 0, vImgFloats.Length);

			for ( int x = 0 ; x < ImageWidth ; x++ ) {
				for ( int y = 0 ; y < ImageHeight ; y++ ) {
					int floatI = (x + y*ImageWidth)*ImageChannels;
					int colorI = (ImageWidth-x-1) + y*ImageWidth;

					vImgColors[colorI] = new Color(
						vImgFloats[floatI+2],
						vImgFloats[floatI+1],
						vImgFloats[floatI]
					);
				}
			}

			vIsChanged = true;
		}
Example #8
0
 public void SetState(ImagingState state)
 {
     _state = state;
 }
Example #9
0
        static void imaging_StateChanged(object sender, TimeValue timestamp, int sensor, ImagingState report)
        {
            var m = report.metadata;

            Console.WriteLine("Got Imaging report {0}:", reportNum++);
            Console.WriteLine("\twidth: {0}", m.width);
            Console.WriteLine("\theight: {0}", m.height);
            Console.WriteLine("\tdepth: {0}", m.depth);
            Console.WriteLine("\tnumber of color channels: {0}", m.channels);
            Console.WriteLine("\ttype: {0}", m.type.ToString());
        }