ES400:保存一张图像后 CameraCaptureDialog 错误

发布于 2024-12-16 23:29:25 字数 1403 浏览 3 评论 0原文

我在 ES400 中使用 CameraCaptureDialog 类时遇到错误,在捕获第二个图像时,它显示“无法找到图像”。但同样的代码在 MC35 中运行良好。

  Dim app_path As String
        Dim ccd As New CameraCaptureDialog
        Dim count As Integer
        count = TransImagelst.Images.Count
        Try

            ccd.Owner = Me
            ccd.DefaultFileName = "Image" & count.ToString & ".jpg"
            ccd.Mode = CameraCaptureMode.Still
            ccd.StillQuality = CameraCaptureStillQuality.Low
            ccd.Resolution = New Size(0, 0)
            ccd.Title = "Image"
            ccd.InitialDirectory = DataBase_Path & "\" & Region & "\Image"
            ccd.ShowDialog()


            'add files to image directory.
            If Not Directory.Exists(DataBase_Path & "\" & Region & "\Image") Then Directory.CreateDirectory(DataBase_Path & "\" & Region & "\Image")

            If ccd.FileName  String.Empty Then
                TransImagelst.ImageSize = New Drawing.Size(55, 55)
                TransImagelst.Images.Add(New Bitmap(ccd.FileName))
                TransImagelstv.View = View.LargeIcon
                TransImagelstv.LargeImageList = TransImagelst
                Dim lv As New ListViewItem("Image" & TransImagelst.Images.Count - 1)
                TransImagelstv.Items.Add(lv)
                lv.ImageIndex = TransImagelst.Images.Count - 1
            End If

请帮帮我。

I am getting an error using the CameraCaptureDialog class in the ES400, while catpturing the second image it says "Could not find image". But the same code works fine in MC35.

  Dim app_path As String
        Dim ccd As New CameraCaptureDialog
        Dim count As Integer
        count = TransImagelst.Images.Count
        Try

            ccd.Owner = Me
            ccd.DefaultFileName = "Image" & count.ToString & ".jpg"
            ccd.Mode = CameraCaptureMode.Still
            ccd.StillQuality = CameraCaptureStillQuality.Low
            ccd.Resolution = New Size(0, 0)
            ccd.Title = "Image"
            ccd.InitialDirectory = DataBase_Path & "\" & Region & "\Image"
            ccd.ShowDialog()


            'add files to image directory.
            If Not Directory.Exists(DataBase_Path & "\" & Region & "\Image") Then Directory.CreateDirectory(DataBase_Path & "\" & Region & "\Image")

            If ccd.FileName  String.Empty Then
                TransImagelst.ImageSize = New Drawing.Size(55, 55)
                TransImagelst.Images.Add(New Bitmap(ccd.FileName))
                TransImagelstv.View = View.LargeIcon
                TransImagelstv.LargeImageList = TransImagelst
                Dim lv As New ListViewItem("Image" & TransImagelst.Images.Count - 1)
                TransImagelstv.Items.Add(lv)
                lv.ImageIndex = TransImagelst.Images.Count - 1
            End If

Please help me out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

燕归巢 2024-12-23 23:29:25

我也有同样的问题。尽管 ES400 功能丰富,但它无法与 Cameracapturedialog 配合使用。它甚至不支持 Motorla EMDK SDK 中的成像库。这真是令人费解。
EMDK 程序员指南中有一个 ES400 编程条目,其中指出 - 您必须使用 Microsoft 的 DirectShow 来捕获图像。我尝试了这种方法,但我只能获得 VGA 分辨率,这对于我的目的来说是垃圾。如果这对您来说足够了,您可以查看 http://alexmogurenko.com/blog/directshownetcf/< /a>.在这一点上我对ES400非常失望。
我最终使用了一个有点垃圾的简单解决方案,但至少它有效(参见下面的概述,祝你好运)。

using (Process proc = new Process())
{
    //This will open the internal camera application.
    proc.StartInfo = new System.Diagnostics.ProcessStartInfo(@"\Windows\Camera.lnk", string.Empty);
    if (proc.Start() == false)
    {
      Messagebox.(this did not work blablabla)
        return; 
    }
}
//The camera app has now focus, in the meantime, we wait with a new messagebox…
Messagebox.Show(“Ok,Cancel” to open picturedialog)
if (cancel)
    return;
string _filename = string.Empty; 
using (SelectPictureDialog _spd = new SelectPictureDialog())
{
    _spd.Owner = this;
    _spd.CameraAccess = false;
    _spd.LockDirectory = false;
    _spd.SortOrder = SortOrder.DateDescending;
    _spd.Title = "Select picture from camera";
    if (_spd.ShowDialog() == DialogResult.OK)
    {
        _filename = _spd.FileName;
    }
    else //No picture selected
        return;
}

//Handle image.. 
//Delete image from folder?

I had the same problem. Although ES400 is stuffed with features, it does not work with the Cameracapturedialog. It does not even support the Imaging library in the Motorla EMDK SDK. This is baffeling.
The EMDK Programmers Guide has an ES400 Programming entry which states - You must use Microsoft’s DirectShow for capturing images. I tried this approach, but I could only get VGA resolution which is rubbish for my purpose. If this is sufficient for you, you might have a look at http://alexmogurenko.com/blog/directshownetcf/. I am extremely disappointed of the ES400 on this point.
I ended up using a simple soliution that is a bit rubbish, but at least it works (see outline below and good luck).

using (Process proc = new Process())
{
    //This will open the internal camera application.
    proc.StartInfo = new System.Diagnostics.ProcessStartInfo(@"\Windows\Camera.lnk", string.Empty);
    if (proc.Start() == false)
    {
      Messagebox.(this did not work blablabla)
        return; 
    }
}
//The camera app has now focus, in the meantime, we wait with a new messagebox…
Messagebox.Show(“Ok,Cancel” to open picturedialog)
if (cancel)
    return;
string _filename = string.Empty; 
using (SelectPictureDialog _spd = new SelectPictureDialog())
{
    _spd.Owner = this;
    _spd.CameraAccess = false;
    _spd.LockDirectory = false;
    _spd.SortOrder = SortOrder.DateDescending;
    _spd.Title = "Select picture from camera";
    if (_spd.ShowDialog() == DialogResult.OK)
    {
        _filename = _spd.FileName;
    }
    else //No picture selected
        return;
}

//Handle image.. 
//Delete image from folder?
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文