- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想通过并行提取检测到的人脸来加速 Viola-Jones,我使用了这段代码,但是 For Each 语句中的人脸参数有一个错误,你能告诉我如何解决这个错误吗?错误是
(Error 2 The type arguments for method
System.Threading.Tasks.Parallel.ForEach<TSource>(System.Collections.Concurrent.OrderablePartitioner<TSource>, System.Action<TSource,System.Threading.Tasks.ParallelLoopState,long>)
cannot be inferred from the usage. Try specifying the type arguments explicitly.
D:\Hadeel\00 thesis\Face recognition\C #\Backup\Viola and Jones Results
2 - Copy\Viola and Jones Results 2\Form1.cs 356 25
Viola and Jones Results 2)
else if (chcParallel.Checked == true)
{//Rectangle face=new Rectangle();
Parallel.ForEach( face, faceObjects =>
{
graphicRect.DrawRectangle(p, face);
face.Inflate(-10, -10);// resize face for crop face without background
Crop crop = new Crop(face);
Bitmap newimage = crop.Apply(image);
// ResizeBicubic resixe = new ResizeBicubic(460, 480);
//newimage = resixe.Apply(newimage);
//pictureBox2.Image = (newimage);
if (chcSkin.Checked == false)
{
facearray[i] = newimage;
pictureBox2.Image = facearray[i];
i = i + 1;
}
else if (chcSkin.Checked == true)
{
f1 = 0; f2 = 0; f3 = 0;
Bitmap imagess = new Bitmap(newimage);
for (int x = 0; x < imagess.Width - 1; x++)
{
for (int y = 0; y < imagess.Height - 1; y++)
{
Color pixelColor = imagess.GetPixel(x, y);
int r = pixelColor.R;
int g = pixelColor.G;
int b = pixelColor.B;
// int f1 = 0;
// int f2 = 0;
// int f3 = 0;
int differenceMinMax = Math.Max(r, Math.Max(g, b)) - Math.Min(r, Math.Min(g, b));
if (r > 95 & g > 40 & b > 20 & differenceMinMax > 15 & r > g & r > b)
{
f1 = f1 + 1;// image.SetPixel(x, y, Color.White);
}
else if (r > 220 & g > 210 & b > 170)
{
f2 = f2 + 1;// imagess.SetPixel(x, y, Color.White);
}
else
{
f3 = f3 + 1;// imagess.SetPixel(x, y, Color.White);
}
}
}
if ((f1 > f2) && (f1 > f3))
{
facearray[i] = newimage;
pictureBox2.Image = facearray[i];
i = i + 1;
}
}
//else
//{ }
});
graphicRect.Dispose();
pictureBox1.Image = image;
}//end if Parallel True
最佳答案
很难确定,但您是否试图将 face
对象标记为 lambda 参数?然后需要切换参数:
// for each of faceObject do
Parallel.ForEach(faceObjects, face =>
{
// your code here
});
关于c# - 如何在 Viola-Jones 中编写 Parallel ForEach,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43199781/
在 Oracle 中,PARALLEL 被广泛使用。提示 PARALLEL、PARALLEL(8) 和 PARALLEL(a,8) 有什么区别。如何选择最佳的查询提示? SELECT /*+ PARA
好的,我希望以前没有问过这个问题,因为在搜索中很难找到。 我查看了 F95 手册,但仍然觉得这很模糊: For the simple case of: DO i=0,99 END DO 我正
我有一个 C-shell 脚本,其中有一个名为 $hosts_string 的变量,格式为: host1,host2,...,hostN 我还有一个名为 $chrs_string 的变量,其形式为:
是否可以从由gnu parallel产生的脚本的多次运行中调用gnu parallel? 我有一个python脚本,可以运行100个顺序顺序迭代,并且在每次迭代中的某处,并行计算4个值(使用gnu p
我想在几个输入上运行几个长时间运行的进程。例如。: solver_a problem_1 solver_b problem_1 ... solver_b problem_18 solver_c pro
TParallel.&For 和 TParallel.For 之间有区别吗? 两者都可以在 Delphi 10 Seattle 中编译。那么我应该坚持哪一个呢? 最佳答案 TParallel.&For
我第一次使用 julia 进行并行计算.我有点头疼。所以假设我开始 julia如下:julia -p 4 .然后我为所有处理器声明 a 函数,然后将它与 pmap 一起使用还有@parallel fo
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 10年前关闭。 Improve this
我有一堆相互排斥的方法,因此可以并行运行。有这样做的好方法吗?到目前为止,我有以下两种实现方式,但我不确定是否应该选择其中一种。 使用 Parallel.For : Parallel.For(0, 2
我对并行运行脚本很感兴趣,并且我已经开始查看 GNU 并行工具,但是我遇到了一些麻烦。我的脚本 doSomething 有 3 个参数,我想在参数的不同值上并行运行脚本。我该怎么做? 我试过:para
我需要在多核(和多线程)机器上运行多个作业。我正在使用 GNU Parallel utility跨核心分配作业以加速任务。要执行的命令在名为“命令”的文件中可用。我使用以下命令运行 GNU Paral
我正在尝试使用如下两个输入运行 Python 脚本。我得到了大约 300 个这两个输入,所以我想知道是否有人可以建议如何并行运行它们。 单次运行看起来像: python stable.py KOG_1
每天我都必须更新一堆存储库,并在其中一些中执行另一个命令(来自 CARTON,Perl 模块依赖管理器)。我总是使用循环来执行此操作,但我想与 并行执行GNU 并行 如果可能,但我不太了解它的tuto
正如标题所说:@parallel 之间究竟有什么区别?和 pmap ?我的意思不是明显的一个是循环的宏,另一个适用于函数,我的意思是它们的实现究竟有什么不同,我应该如何使用这些知识在它们之间进行选择?
我有一些矩阵乘法运算。我想通过多个处理器并行执行这些操作。这可以使用 MPI(消息传递接口(interface))在高性能计算集群上完成。 同样,我可以使用多个辅助角色在云中进行一些并行化吗?有什么办
joblib模块提供了一个简单的帮助程序类,以使用多处理并行编写循环的循环。 这段代码使用列表推导来完成这项工作: import time from math import sqrt from job
我的问题是这样的one .但我想做一些不同的事情... 例如,在我的并行区域内,我想在 4 个线程上运行我的代码。当每个线程进入 for 循环时,我想在 8 个线程上运行我的代码。像 #pramga
我正在尝试使用 ipython 并行库中的并行计算。但是我对此知之甚少,而且我发现很难从对并行计算一无所知的人那里阅读该文档。 有趣的是,我发现的所有教程都只是重复使用文档中的示例,并使用相同的解释,
我的项目结构看起来像 Root + subproj1 + subproj2 在每个子项目中定义了自己的任务 run(){}。 我想要做的是从 Root 项目的运行任务并行运行 :subpro
我有一个 Foo ID 的列表。我需要为每个 ID 调用一个存储过程。 例如 Guid[] siteIds = ...; // typically contains 100 to 300 elemen
我是一名优秀的程序员,十分优秀!