问题标签 [opencvsharp]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
490 浏览

opencv - 统一使用opencvsharp裁剪多边形图像?

我正在传递四个坐标,因此裁剪部分不是矩形或正方形,所以我不能统一使用 getpixels()。

谁能告诉我如何通过统一传递四个坐标来裁剪图像。

或者通过统一使用 opencvsharp 通过传递四个坐标来裁剪图像。

提前致谢。

0 投票
0 回答
311 浏览

c#-4.0 - 使用 OpenCVsharp 分离图像中的对象

我正在尝试将一些叶子(图像中的对象)从如下图像中分离出来

输入图像

输出应该如下图所示

输出图像

我在 Visual Studio 2010(C# 语言)中使用 OpenCvsharp 我想分离 4-5 个叶子,这些叶子在图像中超过 80% 的完整叶子可见,并将输出图像作为第二个图像。请有人告诉我如何实现这一目标?我使用了这里描述的分水岭算法

但我无法得到任何片段,而不是一个片段覆盖整个图像。我想知道是否有更好的方法(算法)来做到这一点?

我正在做这种事情,因为在我分离了 4-5 片叶子之后,该图像再次被处理为那些叶子上的褐色斑点和边缘的形状,以再次使用图像处理来识别一些疾病。请有这方面知识的人帮助我..

0 投票
1 回答
2038 浏览

c# - 如何使用 OpenCVSharp 在 C# 中找到最小面积矩形?

我需要从白色位图画布中提取黑白图像(签名)并将其调整为特定尺寸。图像 (sig) 保证在白色背景上是黑色的。

原因是当我们捕获签名时,有些人写得很小,有些人会填满捕获区域。但是,我需要它们全部填充另一个图像的边缘以进行进一步处理。

我需要找到签名的 X/Y 坐标/矩形边界,这样我就可以只提取画布的那一部分,而不会得到很多周围的空白。

我在另一个项目中注意到了这一点,并想知道如何在 OpenCVSharp 中实现。

http://www.emgu.com/wiki/index.php/Minimum_Area_Rectangle_in_CSharp

谢谢。

0 投票
1 回答
1434 浏览

c# - OpenCvSharp installed using NUGET PAckage Manager not detecting a CUDA Device

I am trying to include GPU using OpenCvSharp. I installed the OpenCvSharp by using Nuget Package Manager in Microsoft Visual Studio 2013.

I have included these lines already

but when i check the device count

it always returns 0.

Now it also says if OpenCv is not compiled with CUDA then it always returns 0. it does not even get DeviceDetails.

0 投票
0 回答
666 浏览

c# - OpenCvSharp,尝试读取或写入受保护的内存

大家好,这是我的第一个问题。

我正在使用 OpenCvSharp 开发一个软件,显然,在 c# 中,该软件的目标是将中值模糊过滤器应用于通过内存工作的位图。

代码示例:

Cv2.MedianBlur(matImgSrc, matImgDst, 9);我收到错误的行中(尝试读取或写入受保护的内存)

拜托,有人可以帮助我吗?

谢谢你和问候。

0 投票
2 回答
6451 浏览

c# - OpenCVSharp3 MatchTemplate 中的多个结果

我正在尝试在图像中查找图像出现。我编写了以下代码来使用 OpenCVSharp3 获得单个匹配项:

如何根据阈值获得更多匹配?

谢谢!

0 投票
1 回答
441 浏览

opencv - 从图像 OpenCvSharp 中提取线条

在这里,我试图从图像中追踪线条。我使用了以下步骤

  1. 阈值图像
  2. 扩张图像
  3. 图像变薄
  4. 从图像中查找轮廓

在这里,我在线条边缘的两侧得到矢量线。但我想在每条线的中间生成一条矢量线。

任何人都可以帮助我如何做到这一点。

下面是我得到的结果。

在此处输入图像描述

0 投票
2 回答
1818 浏览

opencv - Undistort distortion parameters

I'm trying to undistort an image with OpenCV (through OpenCVSharp's wrapper) and i'm having trouble figuring out the correct format for the matrices, i'm improting them through the CvFileStorage as used in the undistort sample however i'm getting really unexpected results.

From another software i use i get the following data (which should be right as that software undistorts the iamge just fine with those parameters)

i'm using the following code to undistort the images, the intrinsic matrix is fine (gives the expected result when applying no distortion) however the distortion matrix is giving me issues, from what i understand of the expected layout (didn't find any samples but that's what i gather from the OpenCV source) a 4X1 matrix with k1k2p1p2 should work so i have this in my configuration file:

Code :

However i'm getting completly distorted images (Whirlpool) , do i have the matrix order wrong? is there any code sample (i couldn't find any) with a matrix constructed from named parameters (all i found was a sample using a sample file with a matrix in it and no documentation on the component orders)?

0 投票
2 回答
849 浏览

c# - 如何在 OpenCVSharp 代码中使用新的 C++ 风格 API?

我正在使用 OpenCVSharp,但目前我的一半代码在 C 中,另一半在 C++ API 中,我试图将其全部移植到 C++ 版本以避免不推荐使用的 API 以及避免加载图像两次(共享而不是每张图像Mat一个Mat和一个)CvMat

这是我的有效代码:

并且代码(在我输入时似乎是一个明显的端口)不起作用(我最终得到了场景中存在的颜色的单一彩色图像):

我是否错误地设置了值?移植不是那么简单吗?

0 投票
1 回答
656 浏览

c# - OpenCvSharp PCA 异常:输入和输出数组格式的不支持组合

我正在使用 OpenCVSharp(OpenCvSharp3-AnyCPU 版本 3.0.0.20150823 在 Visual Studio 2015 中运行并通过 NuGet 安装)从 C# 访问 OpenCV,但是在调用时Cv2.PCACompute我得到一个通用的OpenCVException,指出我的输入和输出数组格式的组合不受支持.

我的目标是使用 PCA 找到像素斑点的主轴。这是我目前的(精简)代码:

我还没有找到任何关于如何初始化均值和特征向量垫的文档,或者我调用 PCACompute 的方式是否正确。深入了解使用 PCACompute 的正确过程将非常有帮助。