我的WinForms .NET 4 C#应用程序在用户与之交互时记录桌面.
它使用AForge FFMPEG或VFW包装,具体取决于系统的速度.捕获是在后台线程中完成的.
在任何一种情况下,包装器都需要提前指定帧速率.这是有问题的,因为捕获频率是不确定的并且容易受到目标机器的繁忙程度的影响.在一个好的系统上,我得到最多10 FPS.
这里有两个问题:
为清晰起见,下面列出了我使用的代码:
private void ThreadWork ()
{
int count = 0;
string filename = "";
RECT rect = new RECT();
System.Drawing.Bitmap bitmap = null;
System.Drawing.Graphics graphics = null;
System.DateTime dateTime = System.DateTime.Now;
System.IntPtr hWndForeground = System.IntPtr.Zero;
AForge.Video.FFMPEG.VideoFileWriter writer = null;
filename = @"c:\Users\Raheel Khan\Desktop\Temp\Capture.avi";
if (System.IO.File.Exists(filename))
System.IO.File.Delete(filename);
writer = new AForge.Video.FFMPEG.VideoFileWriter();
writer.Open
(
filename,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height,
10, // FPS
AForge.Video.FFMPEG.VideoCodec.MPEG4
);
bitmap = new Bitmap
(
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb
); …Run Code Online (Sandbox Code Playgroud) 我只是想知道如何检测到手势的指尖.
我正在使用这个手指计数手指拼写.更具体地说,我正在使用AFORGE.NET进行C#,并希望使用凸壳算法.我能找到的一切都是在OPENCV平台上完成的.
请建议一种在C#中查找指尖计数的方法,如果可能的话,不使用OPENCV平台.
我开发了一个图像皮肤检测应用程序
但是我的相机存在问题,试图补偿光线并且结果图像很差,在大多数情况下,我对图像有冷或热效果.当我使用Photoshop时,有AutoTone功能可以规范化图像并减少此问题.


使用aforge我想使用HistogramEqualization()过滤器,但结果非常糟糕:

// create filter
HistogramEqualization filter = new HistogramEqualization( );
// process image
filter.ApplyInPlace( sourceImage );
Run Code Online (Sandbox Code Playgroud)
所以我的问题是:在Accord或Aforge中有一个函数可以获得与Photoshop的自动调色板相同的结果吗?如果没有,有一些库或脚本可以做到这一点?
谢谢你们.
我是Aforge.Net的新手,我正在寻找一种将灰度图像转换为黑白图像的方法.我真的找不到任何支持吗?
我设法通过应用灰度滤镜将普通图像转换为GrayScale.但我无法找到有关黑白转换的任何信息
请有人帮我一把.
如何使用此方法:
public static void DFT (Complex[] data, Direction direction)
Run Code Online (Sandbox Code Playgroud)
如果我的输入数组是short[] samples?我可以轻松转换short为double将此值放入Complexstruct.但是这个结构有两个字段Im和Re.那么,这些值中的一个是我的样本值吗?第二个值是多少?样品编号?
请帮我解决这个问题,因为我今天不会睡觉.
我有以下图像并且已二值化?

我需要分割此图像并识别digit.double数字4'和'9'连接在一起。
我阅读了一些有关``分水岭形态''方法的文档。以下图像已实现为``分水岭分割''。


显然,仍然有两位44位数字连接在一起,但是已经有9位数字已经分段成功。
我需要一些帮助来分割44个字符!谢谢。
我的应用程序从外部设备接收一系列图像(BitmapImage),速率为30 fps.我正在使用Aforge.net库来保存.avi文件中收到的流.我使用以下代码来初始化AVIWriter:
AVIWriter writer;
writer = new AVIWriter("wmv3");
writer.FrameRate = 30;
writer.Open("test.avi", 320, 240);
Run Code Online (Sandbox Code Playgroud)
对于收到的每个帧,我将其添加到视频流中,使用以下代码行:
writer.AddFrame(ResizeBitmap(BitmapImage2Bitmap(e.ColorFrame.BitmapImage),320,240));
Run Code Online (Sandbox Code Playgroud)
但生成的文件太重了.(10秒对应于约3Mb).
我也尝试设置低水平writer.Quality,但结果似乎相同(只减少5-7%).
所以,我需要一个更有效的压缩.
Aforge.net支持哪些压缩?我应该使用什么压缩来减少保存文件的重量?
我目前正在使用 AForge dll 在图片框中渲染视频以进行实时查看。我确实有一个视频帧功能,可以将当前图片框帧写入或屏幕截图为 JPG。
但我遇到了一个问题,有时程序会提示参数无效或对象已在其他地方使用的错误。我确实尝试找到解决方案来解决它,并且我很确定我确实对图像和克隆图像进行了处理,但问题仍然存在。
你能帮我解决我的程序做错了什么吗?
void videoSource_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
//your code using bmp object
if (D1Pic.BackColor == Color.Green)
{
video = (Bitmap)eventArgs.Frame.Clone();
if (livePreview.Image != null)
{
//Dispose the resources
this.Invoke(new MethodInvoker(delegate() { livePreview.Image.Dispose(); }));
}
livePreview.Image = (Bitmap)eventArgs.Frame.Clone();
imgclone = (Image)livePreview.Image.Clone();
FileWriter.WriteVideoFrame(video);
}
else
{
video = (Bitmap)eventArgs.Frame.Clone();
if (livePreview.Image != null)
{
//Dispose the resources
this.Invoke(new MethodInvoker(delegate() { livePreview.Image.Dispose(); }));
this.Invoke(new MethodInvoker(delegate() { video.Dispose(); }));
}
livePreview.Image = (Bitmap)eventArgs.Frame.Clone();
imgclone = (Image)livePreview.Image.Clone();
}
video.Dispose(); …Run Code Online (Sandbox Code Playgroud) 我正在制作一个小型应用程序,以窗体形式显示实时网络摄像头,并且还存储水印图像以指定间隔驱动(创建间隔拍摄视频是最终目标).
我正在使用AForge库进行图像和视频处理.
我有问题,似乎有内存泄漏,即使我试图确保在图像处理发生的每个位置使用"使用"语句.
下面是进行图像处理的代码(The NewFrame事件)
private void Video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
try
{
if (ImageProcessing) // If the previous frame is not done processing, let this one go
return;
else
ImageProcessing = true;
using (Bitmap frame = (Bitmap)eventArgs.Frame)
{
// Update the GUI picturebox to show live webcam feed
Invoke((Action)(() =>
{
webcam_PictureBox.Image = (Bitmap)frame.Clone();
}));
// During tests, store images to drive at a certain interval
if (ImageStoreTimer.Elapsed.TotalSeconds > ImageStoreTime)
{
DateTime dt = DateTime.Now;
using (Graphics graphics …Run Code Online (Sandbox Code Playgroud) 我试图弄清楚如何检查网络摄像头/视频捕获设备是否已被另一个应用程序使用,而无需实际激活它。
我当前的方法是使用 AForge.NET 库并使用 VideoCaptureDevice 对象的 .IsRunning 属性,如下所示:
var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
foreach (FilterInfo videoDevice in videoDevices)
{
VideoCaptureDevice camera new AForge.Video.DirectShow.VideoCaptureDevice(videoDevice.MonikerString);
Debug.Print(camera.IsRunning)
}
Run Code Online (Sandbox Code Playgroud)
我猜想 IsRunning 属性仅适用于已开始使用该库的 VideoCaptureDevices,并且我需要对设备进行较低级别的 DirectShow 访问。
虽然在 C# 中使用 DirectShow 的方法有很多,但即使在 C++ 中使用 DirectShow,我也无法找到检查状态的方法。我需要在这里施展什么魔法吗?
谢谢
托比亚斯·廷普
aforge ×10
c# ×9
.net ×4
winforms ×2
accord.net ×1
adjustment ×1
c++ ×1
compression ×1
directshow ×1
fft ×1
frame-rate ×1
grayscale ×1
image ×1
winapi ×1