c# - 找不到类型或命名空间名称 'ImageEntitiesContainer'

标签 c# visual-studio-2013 ffmpeg namespaces aforge

我正在尝试从提供的解决方案的源代码构建 C#.NET 应用程序 here .

我已经添加了对 的引用AForge.Video.FFMPEG.dll ,但我仍然收到以下错误:

Error 2 The type or namespace name 'ImageEntitiesContainer' could not be found (are you missing a using directive or an assembly reference?) C:\WorkSpace\Visual Studio 2013\Projects\CSharp\ImagesToVideo\Program.cs 56 40 ImagesToVideo



我搜索了这个错误并找到了一些帖子,但没有任何帮助。我尝试将目标框架从我的默认“.NET Framework 4.5”更改为其他一些框架:“.NET Framework 2.0”、“.NET Framework 3.0”、“.NET Framework 4.0”,但没有任何成功。有谁知道为什么我仍然收到此错误?

这是我的完整源代码:
using AForge.Video.FFMPEG;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AForge.Video.FFMPEG
{
public class MovieMaker
{

    public void Start()
    {
        var startDate = DateTime.Parse("12 Mar 2012");
        var endDate = DateTime.Parse("13 Aug 2012");

        CreateMovie(startDate, endDate);
    }


    /*THIS CODE BLOCK IS COPIED*/

    public Bitmap ToBitmap(byte[] byteArrayIn)
    {
        var ms = new System.IO.MemoryStream(byteArrayIn);
        var returnImage = System.Drawing.Image.FromStream(ms);
        var bitmap = new System.Drawing.Bitmap(returnImage);

        return bitmap;
    }

    public Bitmap ReduceBitmap(Bitmap original, int reducedWidth, int reducedHeight)
    {
        var reduced = new Bitmap(reducedWidth, reducedHeight);
        using (var dc = Graphics.FromImage(reduced))
        {
            // you might want to change properties like
            dc.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            dc.DrawImage(original, new Rectangle(0, 0, reducedWidth, reducedHeight), new Rectangle(0, 0, original.Width, original.Height), GraphicsUnit.Pixel);
        }

        return reduced;
    }

    /*END OF COPIED CODE BLOCK*/


    private void CreateMovie(DateTime startDate, DateTime endDate)
    {
        int width = 320;
        int height = 240;
        var framRate = 200;

        using (var container = new ImageEntitiesContainer())
        {
            //a LINQ-query for getting the desired images
            var query = from d in container.ImageSet
                        where d.Date >= startDate && d.Date <= endDate
                        select d;

            // create instance of video writer
            using (var vFWriter = new VideoFileWriter())
            {
                // create new video file
                vFWriter.Open("nameOfMyVideoFile.avi", width, height, framRate, VideoCodec.Raw);

                var imageEntities = query.ToList();

                //loop throught all images in the collection
                foreach (var imageEntity in imageEntities)
                {
                    //what's the current image data?
                    var imageByteArray = imageEntity.Data;
                    var bmp = ToBitmap(imageByteArray);
                    var bmpReduced = ReduceBitmap(bmp, width, height);

                    vFWriter.WriteVideoFrame(bmpReduced);
                }
                vFWriter.Close();
            }
        }

    }
}
}

最佳答案

ImageEntitiesContainer 是 不是类但是一个 数据源 .你可以在LINQ-query代码中弄清楚:

using (var container = new ImageEntitiesContainer())
{
    //a LINQ-query for getting the desired images
    var query = from d in container.ImageSet
                where d.Date >= startDate && d.Date <= endDate
                select d; 

ImageEntitiesContainer ADO.Net 实体数据模型 您必须自己创建它。

图像集 是 ImageEntitiesContainer 中的一个表。

图片是从您提供的链接中截取的:

enter image description here

关于c# - 找不到类型或命名空间名称 'ImageEntitiesContainer',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29553052/

相关文章:

python - 我有一个 ffmpeg 命令来连接 300 多个不同格式的视频。 concat 复杂过滤器的正确语法是什么?

ffmpeg:[NULL @ 0x5578f5fc0580] 无法为 '[out]' [out] 找到合适的输出格式:参数无效

c# - Excel 添加在自定义功能区选项卡中将不显示

c++ - 在 Visual Studio 2013 中使用 Libusb

c# - 如何在 C# 中强制退出应用程序?

entity-framework - 抑制 EF 警告的正确方法是什么?

c++ - ReSharper C++ 中的配色方案困惑

iphone - 为 IOS 编译 ffmpeg(R_ABS reloc 错误)

c# - 如何判断 Socket 的发送缓冲区中有多少数据

c# - Hangfire 交易流程(工作单元)