gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 16:56:05 26 4
gpt4 key购买 nike

我正在尝试从提供的解决方案的源代码构建 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com