public void DetectNative() { var configuration = new YoloConfigurationDetector().Detect(); using (var yoloWrapper = new YoloWrapper(configuration)) { using (var image = new Bitmap(600, 400)) using (var canvas = Graphics.FromImage(image)) { canvas.Clear(Color.AliceBlue); canvas.FillPie(Brushes.Black, 0, 0, 100, 100, 0, 360); canvas.Flush(); BitmapData bmpData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, image.PixelFormat); var rawImagePtr = bmpData.Scan0; var bmpImagePtr = IntPtr.Zero; try { bmpImagePtr = CreateBmp(rawImagePtr, image.Width, image.Height, out var length); var result = yoloWrapper.Detect(bmpImagePtr, length); } finally { if (bmpImagePtr != IntPtr.Zero) { Marshal.FreeHGlobal(bmpImagePtr); } } } } }
public YoloObjectDetection() { var configurationDetector = new YoloConfigurationDetector(); var configuration = configurationDetector.Detect(); _yoloWrapper = new YoloWrapper(configuration); }
void Startup() { listImages = new List <string>(); var configurationDetector = new YoloConfigurationDetector(); var config = configurationDetector.Detect(); yoloWrapper = new YoloWrapper(config); //phải nhớ là cái này được tạo từ đầu rồi, không tạo mới nữa nếu không nó sẽ null }
public void FileNotFoundTest() { var configuration = new YoloConfigurationDetector().Detect(); using (var yoloWrapper = new YoloWrapper(configuration)) { yoloWrapper.Detect("image-not-exists.jpg"); } }
public Form1() { InitializeComponent(); textBox1.Enabled = false; textBox1.AcceptsReturn = true; configurationDetector = new YoloConfigurationDetector(); config = configurationDetector.Detect(); }
static void TestLogic2() { var configurationDetector = new YoloConfigurationDetector(); var config = configurationDetector.Detect(); using (var yoloWrapper = new YoloWrapper(config)) { var result = yoloWrapper.Detect(@"image.jpg"); } }
public void DetectFromFilePath() { var configuration = new YoloConfigurationDetector().Detect(); using (var yoloWrapper = new YoloWrapper(configuration)) { var items = yoloWrapper.Detect(this._imagePath); Assert.IsTrue(items.Count() > 0); } }
public void DetectFromFileData() { var configuration = new YoloConfigurationDetector().Detect(); using (var yoloWrapper = new YoloWrapper(configuration)) { var imageData = File.ReadAllBytes(this._imagePath); var items = yoloWrapper.Detect(imageData); Assert.IsTrue(items.Count() > 0); } }
private void Initialize(string path) { var configurationDetector = new YoloConfigurationDetector(); var config = configurationDetector.Detect(path); if (config == null) { return; } this.Initialize(config); }
private void Initialize(string path) { var configurationDetector = new YoloConfigurationDetector(); try { var config = configurationDetector.Detect(path); if (config == null) { return; } Initialize(config); } catch (Exception exception) { MessageBox.Show($"Cannot found a valid dataset {exception}", "No Dataset available", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void beginBtn_Click(object sender, EventArgs e) { if (imageUploaded == true) { //begin processing var configurationDetector = new YoloConfigurationDetector(); var config = configurationDetector.Detect(); using (var yoloWrapper = new YoloWrapper(config)) { using (MemoryStream memStream = new MemoryStream()) { imageBox.Image.Save(memStream, ImageFormat.Png); var items = yoloWrapper.Detect(memStream.ToArray()); yoloItemBindingSource.DataSource = items; } } } }