找不到类型或命名空间名称 'ImageEntitiesContainer'
The type or namespace name 'ImageEntitiesContainer' could not be found
我正在尝试根据 here 提供的解决方案的源代码构建 C#.NET 应用程序。
我已经添加了对 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 不是class,而是数据源。您可以在 LINQ 查询中找到它代码:
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 实体数据模型,你必须自己创建它。
ImageSet 是 ImageEntitiesContainer 中的一个 table。
图片截取自您提供的link:
我正在尝试根据 here 提供的解决方案的源代码构建 C#.NET 应用程序。
我已经添加了对 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 不是class,而是数据源。您可以在 LINQ 查询中找到它代码:
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 实体数据模型,你必须自己创建它。
ImageSet 是 ImageEntitiesContainer 中的一个 table。
图片截取自您提供的link: