使用来自poitr的OPENCV代码进行图像比较
IMAGE COMPARISON USING OPENCV code from poitr
HI我找到了这个代码来比较图像
cv::Mat img1 = ...
cv::Mat img2 = ...
cv::Mat result = ...
int threshold = (double)(img1.rows * img1.cols) * 0.7;
cv::compare(img1 , img2 , result , cv::CMP_EQ );
int similarPixels = countNonZero(result);
if ( similarPixels > threshold ) {
cout << "similar" << endl;
}
但由于我是OPENCV的新手,我不知道"cv::Mat img1=…"的值是什么请帮助我,并尝试使用图像路径作为值的代码,但它给出了一个错误
void compare(const MatND& src1, const MatND& src2, MatND& dst, int cmpop)
compare函数取4个参数,这是;
•src1 – The first source array
•src2 – The second source array; must have the same size and same type as src1
•value – The scalar value to compare each array element with
•dst – The destination array; will have the same size as src1 and type= CV_8UC1
据我所知,这张照片有一些类似fiducial points
的坐标系(X / Y )
例如;
1 45 123
2 56 164
3 64 147
并将这些点存储在数组中,然后将数组发送到比较函数中,以找到匹配器。
如果你想进行图像比较,我的建议是你可以搜索feret database
,它可以免费用于研究。
您可以使用imread将图像加载到cv::Mat img1
,例如
cv::Mat img1 = imread("c:\test.bmp"); // To load an RGB image
相关文章:
- 将图像魔术转换命令转换为魔术++c++代码
- 如何通过用C++编写的代码将位图图像保存在Android设备中
- 如何将 MATLAB 图像处理库内置函数转换为 MATLAB 编码器代码生成不支持的 C++?
- 无法编译此图像旋转代码
- Qt QML:由c++代码提供的具有动态图像数量的UI
- 无法使用cv :: imwrite保存垫子图像在JNI本机代码OPENCV中
- 图像打开时出错(使用打开的 CV C++代码)
- 在C 或MATLAB中用于图像的CRF实现的代码
- 了解图像处理代码
- 现代 c++ 编译器是否自动矢量化代码以进行 24 位图像处理
- C ++或MATLAB代码来计算图像的类似HAAR的特征
- 使用 CMake 将资源(例如着色器代码、图像)嵌入到可执行文件/库中
- OpenCV代码将存储在列表中的描述符与新的图像描述符进行比较
- 包装使用OpenCV进行图像处理的C代码,以便与同样使用OpenCV的Python一起使用
- Julia 集的代码总是在 CUDA C 中生成灰色图像
- 如何使用 OPENCV 显示我的代码中的图像
- 无法将像素以正确的形状从 cv 代码传输到 cv2 代码的正确图像
- 用于删除图像中的非文本区域的开源代码
- 如何使用 ASCII 代码在输出屏幕上显示图像C++
- gstreamer 管道代码,用于通过来自相机的实时流式传输而不是图像显示文本