/// <summary>
 /// Setter for bool deciding if the color image
 /// </summary>
 /// <param name="enable"></param>
 public void GenerateColorImage(bool enable)
 {
     cameraData.GenerateColorImage(enable);
 }
        /// <summary>
        ///  Constructor for the ImageProcessing class
        /// </summary>
        /// <param name="cameraData"></param>
        /// <param name="mainWindow"></param>
        public ImageProcessing(ICamera cameraData, MainWindow mainWindow)
        {
            // only genrate colorimage if the mainwindow is present and the color option is clicked
            if (mainWindow != null && mainWindow.colorClicked)
            {
                cameraData.GenerateColorImage(true);
                this.mainWindow = mainWindow;
                showWindow      = true;
            }


            this.cameraData = cameraData;

            // create UDPsender object responsible outgoing data(via UDP socket)
            udpSender = new UDPsender();

            // create TCPserv object responsible ingoing commands(via TCP socket)
            commands = new TCPserv(this);

            // create Thread for running the TCPserv and start it
            TCPthread = new Thread(commands.StartListening);
            TCPthread.Start();


            // listen for images from the Camera
            cameraData.EmguArgsProcessed += EmguImageReceived;

            // listen for status changes from the camera object's kinectSensor
            cameraData.ChangeStatusText += ChangeStatusText;

            // get handle to Kinectdata
            this.cameraData = cameraData;



            //this.screen = new DisplacementScreen();
            int[] irdims = cameraData.IRFrameDImensions();
            int   height = irdims[0];
            int   width  = irdims[1];



            this.screen = new ExtrapolationScreen(height, width);



            int padding = Properties.UserSettings.Default.IRPixelPadding;

            mask = new Rectangle(padding, padding, width - (padding * 2), height - (padding * 2));

            int kernelSize = Properties.UserSettings.Default.KernelSize;

            this.kernel = CvInvoke.GetStructuringElement(ElementShape.Ellipse, new System.Drawing.Size(kernelSize, kernelSize), new System.Drawing.Point(-1, -1));



            cols      = Properties.UserSettings.Default.GridColums;
            rows      = Properties.UserSettings.Default.GridRows;
            maxPoints = rows * cols;
            hung      = new Hungarian(maxPoints, maxPoints);
        }