Exemple #1
0
        public void UpdateValueCheck2()
        {
            resetMessageValue();
            candb.UpdateSignalValue("Vi_VehicleSpeed", 2.0);
            Message m = candb.GetAllMessage()[0];

            Assert.AreEqual("0\n" + "200\n" +
                            "0\n" + "0\n", m.GetArrayString());
        }
Exemple #2
0
        void ProcessImage(object obj)
        {
            IplImage img = obj as IplImage;

            matlab.Execute(@"cd '" + imgPath + "'");

            /* b 1.5 - 1.8 FPS */
            // Define the output
            object result1 = null;

            // Call the MATLAB function recog
            byte[,] matlabImage = ImageConverter.IplImageToMatlabImage(img);
            matlab.Feval("recog", 4, out result1, matlabImage, parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5]);
            /* end b 1.5 - 1.8 FPS*/

            /* c 6ms */

            // Display result
            Result = result1 as object[];

            double[,] eArray = Result[0] as double[, ];

            //Get smallest Euclidean Distance and index of smallest distance is the index where corresponding signal and its value are stored.
            int index = indexOfSmallest(eArray);

            if (index > -1)
            {
                ImagePreperationItem ipi = ipiList[index];
                candb.UpdateSignalValue(ipi.SignalName, ipi.Value);
                can.CANTransmit(candb.GetMessageFromSignal(ipi.SignalName)[0]);
                //This 4 lines of code allows me to interact with GUI from separate thread (this)
                Dispatcher.Invoke(DispatcherPriority.Render, new Action(() =>
                {
                    UpdateSignals(ipi.SignalName, ipi.Value);
                }));
            }

            //can.CANMultipleTransmit(candb.GetMessageFromSignal(ipi.SignalName));
            /* c end 6ms */
        }