我的图片框是空的,有人可以帮我吗? [英] My imagebox is empty, can somebody help me why?

查看:76
本文介绍了我的图片框是空的,有人可以帮我吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在图像框中捕获视频文件。我使用EmguCV 3.0.0.2157。当我运行代码时,我没有收到任何错误或警告,它只是在图像框中没有显示任何内容。有人可以帮助我解决问题吗?

我有这个代码:

 使用系统; 
使用 System.ComponentModel;
使用 System.Windows.Forms;
使用 Emgu.CV;

命名空间 videInImageBox
{
public partial class Form1:Form
{
Capture _capture = Capture();

public Form1()
{
InitializeComponent();
}

private void openFileDialog1_FileOk( object sender,CancelEventArgs e)
{
_capture = new Capture(openFileDialog1.FileName.ToString() );
}

private void _openStartButton_Click( object sender,EventArgs e)
{
if (openFileDialog1.ShowDialog()== DialogResult.OK )
{
Mat _image = new Mat();
_capture.Retrieve(_image, 0 );
_imageBox.Image = _image;
}
}
}
}

解决方案

嗨SA,


我的_imageBox是一个ImageBox,它是像PictureBox这样的用户控件。它是Emgu.CV.UI的一部分。

_imageBox在Form1.Designer.cs中声明



无论如何,我发现问题是什么:我没有复制所有的执行文件夹中的dll。有关正确的调整,请参阅下载和安装 - Emgu CV:.NET中的OpenCV(C#,VB,C ++等) ) [ ^ ]

I want to capture a video file in image box. I use EmguCV 3.0.0.2157. When I run the code, I don't get any errors or warnings, it just simply doesn't show a thing in the image box. Can somebody help me what the problem can be?
I have this code:

using System;
using System.ComponentModel;
using System.Windows.Forms;
using Emgu.CV;

namespace videInImageBox
{
    public partial class Form1 : Form
    {
        Capture _capture= new Capture();        
        
        public Form1()
        {
            InitializeComponent();
        }

        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {            
            _capture = new Capture(openFileDialog1.FileName.ToString());
        }

        private void _openStartButton_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Mat _image = new Mat();
                _capture.Retrieve(_image, 0);
                _imageBox.Image = _image;
            }
        }
    }
}

解决方案

Hi SA,

My _imageBox is an ImageBox that is a user control like PictureBox. It's part of Emgu.CV.UI.
_imageBox is declared in Form1.Designer.cs

Anyway, I found what the problem was: I didn't copy the all the dlls in the execution folder. For the proper adjustments see Download And Installation - Emgu CV: OpenCV in .NET (C#, VB, C++ and more)[^]


这篇关于我的图片框是空的,有人可以帮我吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆