问题标签 [mat]

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 投票
1 回答
510 浏览

opencv - Opencv - 从其他矩阵创建矩阵时遇到问题(malloc.c:2451: sSYSMALLOc: Assertion)

我正在Mat通过跳跃原始图像的像素来创建一个新图像,但出现此错误:

我的代码是:

我也尝试过使用uchar* ptr = img.ptr<uchar>(i)ptr[j]因此可以直接访问数据,但我收到同样的错误。

我正在搜索,并尝试了一些“解决方案”,例如sSYSMALLOc: Assertion Failed error in opencv,但问题不断出现。

0 投票
0 回答
1112 浏览

c++ - OpenCV - IplImage/Mat 具有 1 位深度的边缘图?

我目前正在使用 cvCreateImage 和 IplImages 将我的边缘图存储在我的代码中。这些是通过 Canny 边缘检测生成的,并且生成的地图要么有像素,要么有像素。从这些我执行一些霍夫变换,其阈值设置取决于图像中边缘像素的数量。所以我将图像中所有像素的强度相加。但是,最低的 IplImage 类型似乎具有 8 位的深度。显然,在数学上做出简单的改变来解释这一点并不难,但这似乎是一个不必要的步骤。是否有一种内置方法可以创建每像素 1 位深度的 IplImage 或 Mat?非常感谢!

0 投票
1 回答
636 浏览

ios - OpenCV - 无法访问 Mat 中的所有像素

我正在尝试手动更改 Mat 中的每个像素。
为简单起见,假设我想将每个像素着色为黑色。我正在使用以下方法:

从逻辑上讲,这似乎应该遍历垫子中的每个像素,因为它读取行/列的所有可能组合。
不幸的是,这不起作用。对于每张图片,我都缺少一个“块”列。例如,在加载此图像时:
在此处输入图像描述
结果是这样的:
在此处输入图像描述
无论我使用什么图像,我缺少的这个“块”都是相同的大小。我似乎无法理解其中的原因。我知道“at”函数的行/列的顺序是(行,列),但我尝试切换它们只是为了踢球,结果当然更糟。

我在这里想念什么?循环遍历所有行/列还不够吗?

0 投票
1 回答
1023 浏览

android - Mat 不适用于 Android OpenCV 中的位图

我正在尝试在 Android 中使用 OpenCV 在位图中实现一些过滤器,第一步是检测人脸并分成 2 张图像(眼睛)。但是当我尝试实现一个 Mat 函数来做一些图像处理时,它就死了。

错误文本是这样的:

08-05 17:54:58.659: E/AndroidRuntime(11005): java.lang.UnsatisfiedLinkError: n_Mat

代码是这样的,我对 OpenCV 越来越着迷了。

0 投票
2 回答
638 浏览

c++ - Mat初始化的双指针

我正在尝试Mat使用 OpenCV 制作一个数组。该数组用于存储一些N感兴趣的区域,对于每个区域我必须存储最后 5 帧的信息。我正在尝试使用指向Mat. 问题是如何初始化它?我正在尝试这样的事情:

在类的标题中:Mat *Objs_avgwB[25];

并在源文件中初始化:vseg.Objs_avgwB = new Mat[vseg.avgw][25];

0 投票
0 回答
61 浏览

vector - 在 opencv 中将 matix 转换为向量

我已经编写了一个代码来创建一个描述视频中特征的矩阵。我使用 ROI 来裁剪图像中的特征并将其保存在一个矩阵中。整个程序在一个 for 循环中。现在如何使用 imshow 绘制这些矩阵..

0 投票
1 回答
1254 浏览

opencv - 如何从深度相机访问深度图值?

我目前正在使用来自 softkinetics 的 Depthsense 325。我对深度相机和openCV很陌生。我想访问每个像素的深度值,因此,我稍微修改了给定的控制台演示程序来测试代码。代码如下。

但是,它一直显示错误消息:opencv 错误断言失败。任何人都请让我知道我的代码有什么问题。我的系统是window 7,Microsoft Visual Studio 2010,opencv 2.4.6

0 投票
1 回答
725 浏览

objective-c - I get the following error [NSImage CVMat]: unrecognized selector sent to instance

First a disclaimer: I am new to Cocoa and Objective-C. I am trying to learn to work with Cocoa and Opencv so I don't have to deal with Qt. So if there is an easier way to achieve what I'm trying to do, I'd welcome any tips on that. Also, if this question has already been answered, I'd appreciate it if someone could point me to the answer.

I am using the code from this post: NSImage to cv::Mat and vice versa to try and convert my NSImage to Mat and back. The problem is, I always end up getting the unrecognized selector sent to instance error. As far as I understand this error, it is thrown when a method that doesn't exist is called. But the method that I am calling does exist. I'm at a complete loss here and would really appreciate some help in dumbed down words. The code is exactly the same as the post linked to above. The error is as follows:

This error is always thrown at the following line:

Which I'm assuming means that Xcode can't see the CVMat method. However, Xcode lists that method as one of the methods for the project when I try to call it with an instance of NSImage.

Here's the code from the other post that I linked to in case people don't want to click over:

The implementation file:

My use of the file:

PS: I have tried adding the "-all_load" to "Other Linker Flags" but that doesn't work either.

0 投票
1 回答
3319 浏览

c# - Saving data in MAT format in C#

I need to save some data in C#.NET and then access them with MATLAB for further process. Is there a way to create the .mat file in C#?

The data I am trying to save are as follows in xml format:

0 投票
2 回答
4992 浏览

python - PyQt/PySide:如何将 QImage 转换为 OpenCV 的 MAT 格式

我正在寻找从 PyQt 中将 QImage 转换为 OpenCV (CV2) Mat 格式的函数。

我该怎么做呢?到目前为止,我一直在使用的输入图像是作为 QImage 加载的 PNG(RGB 或 RGBA)。

最终,我想获取两个 QImage 并使用 matchTemplate 函数在另一个图像中找到一个图像,所以如果有比我现在找到的更好的方法来做到这一点,我也愿意接受。但是能够轻松地在两者之间来回转换将是理想的。

谢谢你的帮助,