好吧,所以我决定使用定向梯度直方图是一种更好的图像指纹识别方法,而不是创建索贝尔衍生物的直方图.我想我终于弄明白了,但是当我测试我的代码时,我得到以下内容:
OpenCV错误:断言失败((winSize.width - blockSize.width)%blockStride.width == 0 &&(winSize.height - blockSize.height)%blockStride.height == 0).
截至目前,我只想弄清楚如何正确计算HOG并查看结果; 但是在视觉上,我只想要一些非常基本的输出来查看是否创建了HOG.然后我会弄清楚如何在图像比较中使用它.
这是我的示例代码:
using namespace cv;
using namespace std;
int main(int argc, const char * argv[])
{
// Initialize string variables.
string thePath, img, hogSaveFile;
thePath = "/Users/Mikie/Documents/Xcode/images/";
img = thePath + "HDimage.jpg";
hogSaveFile = thePath + "HDimage.yml";
// Create mats.
Mat src;
// Load image as grayscale.
src = imread(img, CV_LOAD_IMAGE_GRAYSCALE);
// Verify source loaded.
if(src.empty()){
cout << "No image data. \n ";
return -1;
}else{
cout << …Run Code Online (Sandbox Code Playgroud)