Beispiel #1
0
        public void CheckImagesCountWithWrongPath()
        {
            // Arrage
            int    quantity    = 10;
            int    equalsCount = 0;
            string path        = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";

            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();
            ThermalFile thermalFile = ThermalFile.Read(path);

            // Act
            for (int i = 0; i < quantity; i++)
            {
                thermalFiles.Add(thermalFile);
            }
            ThermalFile brokenThermalFile = DeclareBadThermalFile(thermalFiles[0]);

            brokenThermalFile.path = @"D:\ThermalDetection\Theata\tem23.tof";
            thermalFiles.Add(brokenThermalFile);

            equalsCount = CalculateEqualsItems(thermalFiles);
            // Assert
            Assert.AreEqual(thermalFiles.Count, equalsCount);
        }
Beispiel #2
0
        public void WriteFileTest()
        {
            // Arrage
            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();

            string path  = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";
            string path2 = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp225.tof";

            // Act
            ThermalFile file = ThermalFile.Read(path);

            File.Delete(path2);
            ThermalFile.Write(path2, file);
            ThermalFile file2 = ThermalFile.Read(path2);

            int excepted = 1;

            if (file == file2)
            {
                excepted = 1;
            }
            // Assert
            Assert.AreEqual(1, excepted);
        }
Beispiel #3
0
        public void ComprareThermalFilesWithBrokenImage()
        {
            // Arrage
            int    quantity    = 10;
            int    equalsCount = 0;
            string path        = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";

            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();
            ThermalFile thermalFile = ThermalFile.Read(path);

            // Act
            for (int i = 0; i < quantity; i++)
            {
                thermalFiles.Add(thermalFile);
            }
            ThermalFile badFile = GenerateThermalFileWithBrokenImage(thermalFiles[0]);

            thermalFiles.Add(badFile);

            foreach (var thermal in thermalFiles)
            {
                if (thermal == thermalFiles[1])
                {
                    equalsCount++;
                }
            }
            // Assert
            Assert.AreEqual(quantity, equalsCount);
        }
Beispiel #4
0
        public void NotEqualsThermalFilesWithBrokenPath()
        {
            // Arrage
            int    quantity     = 10;
            int    badComprared = 0;
            string path         = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";

            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();
            ThermalFile thermalFile = ThermalFile.Read(path);

            // Act
            for (int i = 0; i < quantity; i++)
            {
                thermalFiles.Add(thermalFile);
            }
            ThermalFile brokenThermalFile = DeclareBadThermalFile(thermalFiles[0]);

            brokenThermalFile.path = @"D:\ThermalDetection\Theata\tem23.tof";
            thermalFiles.Add(brokenThermalFile);

            foreach (var thermal in thermalFiles)
            {
                if (thermal != thermalFiles[0])
                {
                    badComprared++;
                }
            }

            // Assert
            Assert.AreEqual(0, badComprared);
        }
Beispiel #5
0
        private ThermalFile DeclareBadThermalFile(ThermalFile thermalFile)
        {
            ThermalFile badThermalFile = new ThermalFile();

            badThermalFile.count           = thermalFile.count;
            badThermalFile.minTemperature  = thermalFile.minTemperature;
            badThermalFile.maxTemperature  = thermalFile.maxTemperature;
            badThermalFile.images          = new List <Emgu.CV.UMat>(thermalFile.images);
            badThermalFile.TemperatureData = new List <int[, ]>(thermalFile.TemperatureData);
            return(badThermalFile);
        }
Beispiel #6
0
 public List <IFile> getThermoFiles()
 {
     string[] fileslist = Directory.GetFiles(currentPath, thermoExtension);
     foreach (var filename in fileslist)
     {
         IFile file = new ThermalFile();
         file.Path = filename;
         thermofiles.Add(file);
     }
     return(thermofiles);
 }
Beispiel #7
0
        public void ReadThermalFile()
        {
            // Arrage
            string path = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";
            // Act
            IThermalReader thermalFileReader = new MockReader();
            ThermalFile    thermalFile       = thermalFileReader.Read(path);
            // Assert
            int imagesCount = thermalFile.images.Count;

            Assert.AreNotEqual(0, imagesCount);
        }
Beispiel #8
0
 private void loadThermalFile(string path)
 {
     Console.WriteLine("Load Thermal File: " + path);
     thermalFile       = ThermalFile.Read(path);
     imageBox1.Image   = thermalFile.images[0];
     trackBar1.Maximum = thermalFile.count - 1;
     Console.WriteLine();
     Console.WriteLine();
     Console.WriteLine();
     Console.WriteLine();
     Console.WriteLine("Images: " + thermalFile.count);
     Console.WriteLine("min: " + thermalFile.minTemperature);
 }
Beispiel #9
0
        public ThermalFile Read(string filePath)
        {
            ThermalFile thermalFile = new ThermalFile();

            thermalFile.path  = "somewhere.tof";
            thermalFile.count = 10;
            thermalFile.raw   = MakeRawData(10);

            thermalFile.TemperatureData = DataConverting.RawDataToArray(thermalFile.raw, 120, 160);
            thermalFile.images          = DataConverting.CreateThermalImages(thermalFile.intMatrices, thermalFile.minTemperature, thermalFile.maxTemperature);
            //thermalFile.count = thermalFile.images.Count;
            return(thermalFile);
        }
Beispiel #10
0
        private ThermalFile GenerateThermalFileWithBrokenImage(ThermalFile file)
        {
            ThermalFile brokenThermalFile = DeclareBadThermalFile(file);

            List <Emgu.CV.UMat> imgs = new List <Emgu.CV.UMat>();

            Emgu.CV.UMat img = file.images[0];
            imgs.Add(img);
            imgs.Add(img);
            for (int i = 2; i < file.count; i++)
            {
                imgs.Add(file.images[i]);
            }

            brokenThermalFile.images = new List <Emgu.CV.UMat>(imgs);
            return(brokenThermalFile);
        }
Beispiel #11
0
        public void CheckImagesCountInFile()
        {
            // Arrage
            int    quantity = 10;
            string path     = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";

            IThermalReader thermalFileReader = new MockReader();
            int            imagecount        = 0;

            // Act
            for (int i = 0; i < quantity; i++)
            {
                ThermalFile thermalFile = thermalFileReader.Read(path);
                imagecount = thermalFile.images.Count;
            }
            // Assert

            Assert.AreNotEqual(0, imagecount);
        }
Beispiel #12
0
        public void ComprareThermalFiles()
        {
            // Arrage
            int    quantity    = 10;
            int    equalsCount = 0;
            string path        = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";

            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();
            ThermalFile thermalFile = ThermalFile.Read(path);

            // Act
            for (int i = 0; i < quantity; i++)
            {
                thermalFiles.Add(thermalFile);
            }
            equalsCount = CalculateEqualsItems(thermalFiles);
            // Assert
            Assert.AreEqual(quantity, equalsCount);
        }