public void LSTGeneratorShould() { var annotationsList = new ImageAnnotationsList(); annotationsList.Annotations = new List <ImageAnnotaion>(); string[] sourceFiles = Directory.GetFiles(folderWithImagesPath, "*", SearchOption.AllDirectories); foreach (string file in sourceFiles) { using (Stream stream = File.OpenRead(file)) { using (Image sourceImage = Image.FromStream(stream, false, false)) { ImageAnnotaion imageAnnotation = new ImageAnnotaion(file); imageAnnotation.ImageLabels = new List <ImageAnnotationLabel>(); ImageAnnotationLabel item = new ImageAnnotationLabel(); imageAnnotation.ImageLabels.Add(item); annotationsList.Annotations.Add(imageAnnotation); } } } Assert.IsTrue(annotationsList.Annotations.ToList().Any()); }
public void ImageAnnotationHasAllMandatoryPropertiesDefaults() { ImageAnnotaion testIA; using (Stream stream = File.OpenRead(dog1ImagePath)) { using (Image sourceImage = Image.FromStream(stream, false, false)) { //Console.WriteLine(sourceImage.Width); //Console.WriteLine(sourceImage.Height); testIA = new ImageAnnotaion(dog1ImagePath); } } Assert.IsFalse(String.IsNullOrEmpty(testIA.Path)); Assert.AreEqual(2, testIA.HeaderSize); Assert.AreEqual(5, testIA.LabelWidth); }
public void ImageAnnotationListSerialization() { string result = "44\t2\t5\t11.0000\t0.2480\t0.0027\t0.9220\t0.8080\t2010_000152.jpg"; var imageLabel = new ImageAnnotationLabel(); imageLabel.ClassIndex = 11; imageLabel.XMin = 0.248F; imageLabel.YMin = 0.0027F; imageLabel.XMax = 0.9220F; imageLabel.YMax = 0.8080F; var imageAnnotation = new ImageAnnotaion("2010_000152.jpg"); imageAnnotation.ImageIndex = 44; imageAnnotation.ImageLabels = new System.Collections.Generic.List <ImageAnnotationLabel>(); imageAnnotation.ImageLabels.Add(imageLabel); string ImageAnnotationSerialized = imageAnnotation.ToString(); Assert.AreEqual(result, ImageAnnotationSerialized); }
public void ImageAnnotationHeaderSizeCanbeChanged() { var testIA = new ImageAnnotaion(dog1ImagePath, headerSize: 3); Assert.AreEqual(3, testIA.HeaderSize); }
public void ImageAnnotationLabelWidhtCanbeChanged() { var testIA = new ImageAnnotaion(dog1ImagePath, headerSize: 2, labelWidth: 4); Assert.AreEqual(4, testIA.LabelWidth); }