c++ - OpenCV Error "Sizes of input arguments do not match" in my SIFT algorithm -


#include "stdafx.h" #include <iostream>  #include <stdio.h> #include <vector> #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/features2d/features2d.hpp" #include <iomanip> #include <fstream>  using namespace std; using namespace cv;   /// global variables  int delay_caption = 1500;  int delay_blur = 100;  int max_kernel_length = 31;  mat src; mat   dst_inv,dst,dest[12],dog[8],grad_x,grad_x_2,grad_x_2_1,temp,p1,p2,x_max,hess[5]; char window_name[] = "smoothing demo";  /// function headers int display_caption(const char* caption); int display_dst(int delay); double k,v; int width,height,m = 0,m1 = 0,width2,height2; int sum1,r = 10,g = 0,c = 0; /**  * function main  */ int main(void) { namedwindow(window_name, window_autosize); ofstream outputfile; outputfile.open("data4.txt");  /// load source image src = imread("c:/users/adithyaanirudhha/documents/visual studio 2015/projects/consoleapplication2/pa.jpg", 1);  if (display_caption("original image") != 0) { return 0; }  dst = src.clone(); width = src.size().width; height = src.size().height; size size(height,width); if (display_dst(delay_caption) != 0) { return 0; } cvtcolor(src, src, cv_rgb2gray); /// applying gaussian blur   //for(int j=0;j<4;j++) //{ //resize(src, src, size / 2); k = 2 ^ (1 / 2); for(int i=0;i<3;i++) { //if (display_caption("gaussian blur") != 0) { return 0; } gaussianblur(src, dst, size(), 1.6*k, 1.6*k); if (display_dst(delay_blur*10) != 0) { return 0; } k = k * k; dst.copyto(dest[m]); //dest[m] = dst; m++; } //}  mat dog_inv; (int n = 0; n < 2; n++) {     if(m1!=3 || m1 != 6 || m1 != 9)     subtract(dest[m1 + 1], dest[m1], dog[n],noarray(),-1); } imshow(window_name, dog[1]); (int = 0; < 2; i++) {     sobel(dog[1], grad_x, cv_16s, 1, 0, 3, 1, 0, border_default);     convertscaleabs(grad_x, grad_x);     transpose(grad_x, temp);     sobel(dog[1], grad_x_2, cv_16s, 2, 0, 3, 1, 0, border_default);     mat tmp;     dog[1].convertto(tmp, cv_32f);     convertscaleabs(grad_x_2, grad_x_2);     c = invert(tmp,dog_inv, decomp_svd);     //imshow(window_name,src);     sobel(dog[1], grad_x_2_1, cv_16s, 2, 0, 3, 1, 0, border_default);     convertscaleabs(grad_x_2_1, grad_x_2_1);     //imshow(window_name,src);     //grad_x_2_1 = grad_x_2_1.inv(cv_32f);     multiply(grad_x_2_1,grad_x,x_max, 1, 1);     multiply(temp, x_max, p1, 1, 1);     transpose(x_max,temp);     multiply(temp, grad_x_2, p2, 1, 1);     multiply(p2, x_max, p2, 1, 1);     imshow(window_name, dog[1]);      /*for (int y = 0; y < dog[i].rows; y++)     {         (int x = 0; x < dog[i].cols; x++)         {             dog[i].at<vec3b>(y, x) = (-1 * (p1.at<vec3b>(y, x)) + 0.5*(p2.at<vec3b>(y, x)) + dog[i].at<vec3b>(y, x));         }     }*/     //imshow(window_name, dog[1]);     //imshow(window_name, src);     /*  (i = 0; i<2; i++)     {     v = determinant(dog[i]);     }     (int h = 0; h < dog[1].rows; h++)     {     sum1 = dog[1].at<uchar>(h, h);     }     }     if ((sum1 ^ 2) / v >((r + 1) ^ 2) / r)     {     hess[g] = dog[1];     }     */     /// wait until user press key     //display_caption("end: press key!");          //imshow(window_name, dog[1]);         //waitkey(0);     //outputfile << dog[0] << endl;     //cout << "m = " << endl << " " << dest[0] << endl << endl; } waitkey(0); return 0;  }     /** * @function display_caption */      int display_caption(const char* caption)     {         dst = mat::zeros(src.size(), src.type());         puttext(dst, caption,             point(src.cols / 4, src.rows / 2),             font_hershey_complex, 1, scalar(255, 255, 255));          imshow(window_name, dst);         int c = waitkey(delay_caption);         if (c >= 0) { return -1; }         return 0;      }   /** * @function display_dst */ int display_dst(int delay) {     imshow(window_name, dst);     int c = waitkey(delay);     if (c >= 0) { return -1; }     return 0; } 

error :***** videoinput library - 0.1995 - tfw07 *****

opencv error: sizes of input arguments not match (the operation neither 'array op array' (where arrays have same size , same number of channels) , nor 'array op scalar', nor 'scalar op array') in cv::arithm_op, file c:\builds lave64\win64_amdocl\master_packslave-win64-vc14-shared\opencv\modules\core\src\a rithm.cpp, line 639 press key continue . . .

please thank :)


Comments