我有一个项目,我需要使用USB相机处理在非常近的范围(5毫米以下)获得的图像.由于可用空间很短,我不能使用辅助镜头.
我知道我可以在位图级别进行一些后期处理,但我希望能够在相机级别访问自动对焦或白平衡等属性.
我正在用AForge开发C#进行图像采集和后期处理,但在图像采集发生之前我似乎无法找到控制相机的方法.
你能帮助我吗?
我正在尝试使用AForge.NET来检测图像上的粗白线.
它就像我得到的管道,是应用阈值过滤器后的理想结果.
我知道如何检测形状,我已经这样做了,但是这在任何形状下都不匹配,因为它没有边缘而且不是圆形.
我有检测等边形状的示例代码,但我不知道这是否相关.
public void DetectQuadrilateralType(Bitmap bitmap)
{
BlobCounter blobCounter = new BlobCounter();
blobCounter.ProcessImage(bitmap);
Blob[] blobs = blobCounter.GetObjectsInformation();
//Graphics object to draw
Pen pen;
Graphics g = Graphics.FromImage(bitmap);
SimpleShapeChecker shapeChecker = new SimpleShapeChecker();
for (int i = 0; i < blobs.Length; i++)
{
List<IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints(blobs[i]);
List<IntPoint> corners;
if (i < edgePoints.ToArray().Length && i > -1)
{
try
{
if (shapeChecker.IsConvexPolygon(edgePoints, out corners))
{
PolygonSubType subType = shapeChecker.CheckPolygonSubType(corners);
pen = new Pen(colors[subType], 2);
g.DrawPolygon(pen, ToPointsArray(corners));
pen.Dispose();
}
} …Run Code Online (Sandbox Code Playgroud) 我有跟踪扫描文档,上面有徽标,我有另一张黑白图像,标识和样式相同(下面以黑白色显示).
如何确保此图像上是否存在徽标?

通常我会有很多扫描文件,OCR会拾取MTNL,但有时这些徽标只是由OCR无法识别的符号组成.
徽标的大小和位置发生变化,它们不会多次修复.它们可以放在文档的任何位置.
我想根据存在的徽标和符号组织和编目扫描图像.大多数文件可能是也可能不是英文,可能包含也可能不包含任何条形码,在这种情况下,徽标匹配会有所帮助.
我见过Aforge.NET库,但我不太确定要将哪些方法组合起来进行搜索.如果源目标具有不同的大小,则像素搜索非常慢并且失败.
我听说YouTube会进行某种直方图或热门签名匹配,以查看该视频是否包含任何受版权保护的内容.如果有人能在这种情况下指导我,我会很有帮助.
我理想的选择是C#和Aforge.NET,否则一些命令行工具将不胜感激.
c# pattern-recognition image-processing pattern-matching aforge
我试图用C#中的Aforge.Net通过感知器进行OCR.我用九个30*30二进制图片学习了我的网络.但在结果中,它将所有内容都识别为"C".这是代码:
private void button1_Click(object sender, EventArgs e)
{
AForge.Neuro.ActivationNetwork network = new AForge.Neuro.ActivationNetwork(new AForge.Neuro.BipolarSigmoidFunction(2), 900, 3);
network.Randomize();
AForge.Neuro.Learning.PerceptronLearning learning = new AForge.Neuro.Learning.PerceptronLearning(network);
learning.LearningRate =1 ;
double[][] input = new double[9][];
for (int i = 0; i < 9; i++)
{
input[i] = new double[900];
}
//Reading A images
for (int i = 1; i <= 3; i++)
{
Bitmap a = AForge.Imaging.Image.FromFile(path + "\\a" + i + ".bmp");
for (int j = 0; j < 30; j++)
for (int k …Run Code Online (Sandbox Code Playgroud) 我尝试创建一个文本视频,其中文本通过文本到语音进行叙述.
要创建的视频文件,我用VideoFileWriter的Aforge.Net是以下几点:
VideoWriter = new VideoFileWriter();
VideoWriter.Open(CurVideoFile, (int)(Properties.Settings.Default.VideoWidth),
(int)(Properties.Settings.Default.VideoHeight), 25, VideoCodec.MPEG4, 800000);
Run Code Online (Sandbox Code Playgroud)
要大声朗读文本,我使用SpeechSynthesizer类并将输出写入波流
AudioStream = new FileStream(CurAudioFile, FileMode.Create);
synth.SetOutputToWaveStream(AudioStream);
Run Code Online (Sandbox Code Playgroud)
我想突出显示视频中的单词,所以我通过SpeakProgress事件同步它们:
void synth_SpeakProgress(object sender, SpeakProgressEventArgs e)
{
curAuidoPosition = e.AudioPosition;
using (Graphics g = Graphics.FromImage(Screen))
{
g.DrawString(e.Text,....);
}
VideoWriter.WriteVideoFrame(Screen, curAuidoPosition);
}
Run Code Online (Sandbox Code Playgroud)
最后,我使用合并视频和音频 ffmpeg
using (Process process = new Process())
{
process.StartInfo.FileName = exe_path;
process.StartInfo.Arguments =
string.Format(@"-i ""{0}"" -i ""{1}"" -y -acodec copy -vcodec copy ""{2}""", avi_path, mp3_path, output_file);
// ...
}
Run Code Online (Sandbox Code Playgroud)
问题是,对于像微软Hazel,Zira和David这样的声音,在Windows 8.1中,视频与音频不同步,音频比显示的字幕快得多.但是,对于Windows …
我有一个奇怪的问题,我发现难以调试有时我无法关闭我的程序,它冻结当我尝试关闭它我做了一个大程序的视频图像识别,它工作我做了一个特殊的按钮关闭相机这按钮通过调用下面的函数来解决这个问题,确实,它确实有效.
private void exitcamera()
{
FinalVideo.SignalToStop();
FinalVideo.WaitForStop();
FinalVideo = null;
}
Run Code Online (Sandbox Code Playgroud)
请注意,原始视频是这样开始的
private void buttonStartCamera_Click(object sender, EventArgs e)
{
FinalVideo = new VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonikerString);
FinalVideo.DesiredFrameSize = new System.Drawing.Size(640, 480);
FinalVideo.DesiredFrameRate = 90;
FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
FinalVideo.ProvideSnapshots = true; //snapshots
FinalVideo.Start();
}
Run Code Online (Sandbox Code Playgroud)
现在我的问题接缝了(这是一个猜测,因为我无法调试这一刻)一些线程仍然活跃,想要用数据更新主窗体.但是,由于那个正在关闭,它可能无法这样做.我觉得这样的事情正在发生,所以我在主申请表上写了
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
// Thread.Sleep(1000); // not sure about these delays might help syncing threads
ExitCamera();
Thread.Sleep(1000);
}
Run Code Online (Sandbox Code Playgroud)
然而,随着最后的代码到位,程序退出更加困难?
我想发送子线程一个退出,但我不知道他们的名字(如果他们有一个名字),我不知道如何列出他们或指示他们停止他们在另一个DLL而不是我的代码部分.从一些dll我没有代码.
那么有没有办法列出子线程然后一个接一个地关闭它们,如果有人按下右上角以退出应用程序?
我使用Visual C#2008并希望从bmp序列中编写AVI文件.
我找到了AForge.Video.VWF,但它仅适用于"vmw3"或"DIB"编解码器,我想使用AForge.Video.FFMPEG,但它有错误.
例如我只是编码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AForge.Video.FFMPEG;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
VideoFileWriter vfw = new VideoFileWriter();
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我得到了这个 filenotfoundexception
{"The specified module could not be found. (Exception from HRESULT: 0x8007007E)":null}
Run Code Online (Sandbox Code Playgroud) 
我正在尝试从视频流中捕获帧,我正在尝试使用AForge库来实现此目的.但是当我尝试从我的项目中调用库的任何API时,它会给我上述错误.
我的研究表明它可能是由于在x64上使用32位Windows dll或反之亦然.但是我还没能找到64位窗口的任何AForge库包.我使用的是x64 windows7.任何可以帮助我解决此错误的链接或建议都将非常感激.
我正在使用Accord.Video.FFMPEG来录制屏幕.我面临的问题是CPU和内存利用率都过高.通常,我们的进程使用最大2%的CPU和30 MB的内存,但是当我们开始视频捕获时,CPU上升到17%,内存达到700MB.我试着把
所以GC.Collect();
但没有用.
private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
try
{
if (this._isRecording)
{
int screenRecordingLength = screenRecrodingRule != null ? screenRecrodingRule.length : 500;
//Bitmap frame;
Bitmap frame = eventArgs.Frame;
{
Graphics graphics = Graphics.FromImage(frame);
try
{
CURSORINFO pci;
pci.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(CURSORINFO));
if (GetCursorInfo(out pci))
{
if (pci.flags == CURSOR_SHOWING)
{
int x = pci.ptScreenPos.x - screenLeft;
int y = pci.ptScreenPos.y - screenTop;
Color c = Color.Yellow;
float width = 2;
int radius = 30;
if ((Control.MouseButtons & …Run Code Online (Sandbox Code Playgroud)