我是图像处理和机器视觉的新手.我将编写一个简单的应用程序,它可以处理多页TIFF文件并对它们进行一些对象跟踪.我在Mathematica 8中实现了整个故事,现在我将用一个WPF皮肤在C#中编写一个真实的应用程序.什么API对我最好?Aforge.Net还是Emgu CV?我应该从哪里开始?
我需要为我的图像做一些阈值处理.阈值滤波器功能只接受8-16bpp灰度.我的位图图片具有32bppRGB像素格式.请为此建议一些代码.(我也想知道是否有可能没有像素操作)
ps我正在使用Aforge.NET进行阈值处理.
谢谢
-Sagar
我决定尝试AForge的视频和图像处理,我尝试实现这个简单的演示:
private void Main_Load(object sender, EventArgs e)
{
// enumerate video devices
FilterInfoCollection videoDevices = new FilterInfoCollection(
FilterCategory.VideoInputDevice);
// create video source
VideoCaptureDevice videoSource = new VideoCaptureDevice(
videoDevices[0].MonikerString);
// set NewFrame event handler
videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
// start the video source
videoSource.Start();
}
private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
this.pictureBox1.Image = eventArgs.Frame;
}
Run Code Online (Sandbox Code Playgroud)
问题是我总是得到一个ArgumentException,但并不总是马上发生.它弹出Application.Run(new Main());,但堆栈跟踪的顶部看起来像这样:
at System.Drawing.Image.get_Width() at System.Drawing.Image.get_Size()at System.Windows.Forms.PictureBox.ImageRectangleFromSizeMode(PictureBoxSizeMode mode)at System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)不确定这是否相关,但ParamName异常的属性为null.我试过在try ... catch块中包装图像赋值,但这没有帮助.我还检查过以确保图像在分配之前不为空.我还检查了非null,但是0x0大小的图像. …
我正在尝试在Aforge中应用Bradleys阈值算法
每当我尝试处理图像时,我都会得到以下异常
抛出新的UnsupportedImageFormatException("过滤器不支持源像素格式.");
在应用算法之前,我使用以下方法对图像进行灰度级处理
private void button2_Click(object sender, EventArgs e)
{
Grayscale filter = new Grayscale(0.2125, 0.7154, 0.0721);
Bitmap grayImage = filter.Apply(img);
pictureBox1.Image = grayImage;
}
Run Code Online (Sandbox Code Playgroud)
算法调用的代码
public void bradley(ref Bitmap tmp)
{
BradleyLocalThresholding filter = new BradleyLocalThresholding();
filter.ApplyInPlace(tmp);
}
Run Code Online (Sandbox Code Playgroud)
我在图像处理实验室尝试了理智的图像,它确实有效,但不在我的系统上.
知道我做错了什么吗?
我想使用AForge.net来识别如下图所示的模式.
我使用过滤器来提取黄橙红色,所以我现在可以找到彩色斑点但是:
我想找到被大蓝圈包围的斑点(如图所示)
我想过滤具有椭圆形状的对象
我不想要确切的代码,只是向我展示我应该使用的基本大纲和功能.

我已经使用Microsoft Expression Encoder附加了两个视频,这个东西很好用问题是,当我试图追加"wmv"以外的视频时,它给出了FileNot支持的例外情况
我在谷歌搜索但我无法找到解决方案.
private void button1_Click(object sender, EventArgs e)
{
MediaItem mediaItem1 = null;
Job job = new Job();
job.EncodeProgress += new EventHandler<EncodeProgressEventArgs>(job_EncodeProgress);
int count = 0;
//video url contains all urls of videos
foreach (string x in VideosUrls)
{
if (count == 0)
{
mediaItem1 = new MediaItem(x);
job.MediaItems.Add(mediaItem1);
}
else
{
mediaItem1.Sources.Add(new Source(x));
}
count++;
}
job.OutputDirectory = @"C://videoOutput";
job.Encode();
}
Run Code Online (Sandbox Code Playgroud)
有没有办法使用AForge.NET或Microsoft Expression Encoder,所以我可以编程方式将任何'mp4'视频转换为'wmv', …
我想使用Accord库以及AForge库中的一些东西.但是当我安装它时,我开始收到以下错误:
Error CS0433
The type 'IntPoint' exists in both
'AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb' and
'Accord, Version=3.0.2.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7'
Run Code Online (Sandbox Code Playgroud)
在这行代码上:
startingPoint = new IntPoint(point.X, point.Y);
Run Code Online (Sandbox Code Playgroud)
我怎样才能确保我只使用原始的AForge DLL?是否有解决方法?
我试过了
AForge.IntPoint
Run Code Online (Sandbox Code Playgroud)
但事实证明,雅阁使用相同的命名空间......!
我有 6 个字母的图像,我希望将它分成 6 个图像,每个图像有 1 个字母。我正在使用这个功能:
public static List<UnmanagedImage> ApplyBlobExtractor (UnmanagedImage unmanaged)
{
// Extract blobs
BlobCounter blobCounter = new BlobCounter ();
blobCounter.ObjectsOrder = ObjectsOrder.XY;
blobCounter.ProcessImage (unmanaged);
// Add blobs into list
Blob[] blobs = blobCounter.GetObjects (unmanaged, false);
List<UnmanagedImage> unmanagedList = new List<UnmanagedImage> (blobs.Length);
foreach (Blob blob in blobs)
unmanagedList.Add (blob.Image);
return unmanagedList;
}
Run Code Online (Sandbox Code Playgroud)
问题是有时字母相互接触,这使得函数将 2 个字母识别为一个字母。有没有办法改进我的功能或创建更好的功能?
该功能给了我 2 个图像而不是 6 个。
美好的一天。我想AForge.Video.FFMPEG在我的项目中使用。因此,我尝试在NuGet上找到它。但我在这里找不到。
因此,这里存在:https : //code.google.com/archive/p/aforge/downloads
但是,如果我想从nuget中自动还原它(在git clone和重建之后),在这种情况下是不允许的吗?仅将此dll存储在项目中并始终推送/获取?
我有一个相机类,在这个类中我使用了一个计时器,在它的tick事件中我使用AForge.NetC++/Cli中的VideoFileWriter 保存视频(x86,.net framework:v4.6).
这不应该发生,因为这是托管代码.但即使我在try catch块中包装,程序崩溃也是因为AccessViolationException.我已经验证Image不是null.与此有关VideoFileWriter.这种情况发生在应用程序开始到运行30分钟之间.
AForge.Video.FFMPEG.dll中出现未处理的"System.AccessViolationException"类型异常附加信息:尝试读取或写入受保护的内存.这通常表明其他内存已损坏.
在Visual Studio的输出中,我看到了
test.exe中的0x0C4D689F(swscale-2.dll)抛出异常:0xC0000005:访问冲突写入位置0x09F83D80.抛出异常:AForge.Video.FFMPEG.dll中的"System.AccessViolationException"
码:
private: System::Void Video_Recorder_Tick(System::Object^ sender, System::Timers::ElapsedEventArgs^ e)
{
Bitmap^ save = ConvertMatToBitmap(image); //function to convert opencv's Mat to .net's Bitmap
if(writer!= nullptr)
writer->WriteVideoFrame(save);
delete save;
}
VideoFileWriter ^writer = gcnew VideoFileWriter();
private: Void load_VideoWriter()
{
writer->Open("C:/video.avi", 640, 480, 10, VideoCodec::Default);
}
Run Code Online (Sandbox Code Playgroud)
Visual Studio显示的值很少 writer
BitRate 400000
编解码器默认
FrameRate 10
高度480
IsOpen true
宽度640
如果有人需要更多信息,请告诉我.
调用堆栈没有多大帮助
令我惊讶的是,互联网上没有人有这个问题!
代码似乎很直接,可能是什么问题?
aforge ×10
c# ×8
.net ×2
ffmpeg ×2
image ×2
accord.net ×1
dll ×1
emgucv ×1
git ×1
nuget ×1
picturebox ×1
pixel ×1
video ×1
visual-c++ ×1
wmv ×1