Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Error at run-time

I have this error:

  OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array') in arithm_op, file /build/buildd/opencv-2.3.1/modules/core/src/arithm.cpp, line 1253
  terminate called after throwing an instance of 'cv::Exception'
  what():  /build/buildd/opencv-2.3.1/modules/core/src/arithm.cpp:1253: error: (-209) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function arithm_op

I m sure is generated in a function I use because I used a print function after using that function. Originally what I have to do is translate to C with openCV this matlab's code:

   function Xdecorr= color Decorrelation(X,numChannels)

    if numChannels >1
    mu=mean(X);
    X=bsxfun(@minus,X,mu);
    A=X'*X;
    [V,D,notused]=svd(A);
    Xdecorr=X*V;

    else
     Xdecorr=Xdecorr;
    end

I translated in C as:

      Mat colorDecorrelation(Mat img,int numColComp){

      Mat V,D,A,mu,Xdecorr,img_tr;
      SVD svd;

       if(numColComp>1){

        mu=mean(img);
        subtract(img,mu,img);
        transpose(img,img_tr);
            A = img*img_tr;
            V = svd(A).u;
            Xdecorr = img*V;
       }
       else
       Xdecorr = img;

        return Xdecorr;
        }

I suppose I dont use well svd function!

OpenCV Error at run-time

I have this error:

  OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array') in arithm_op, file /build/buildd/opencv-2.3.1/modules/core/src/arithm.cpp, line 1253
  terminate called after throwing an instance of 'cv::Exception'
  what():  /build/buildd/opencv-2.3.1/modules/core/src/arithm.cpp:1253: error: (-209) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function arithm_op

I m sure is generated in a function I use because I used a print function after using that function. Originally what I have to do is translate to C with openCV this matlab's code:

   function Xdecorr= color Decorrelation(X,numChannels)

    if numChannels >1
    mu=mean(X);
    X=bsxfun(@minus,X,mu);
    A=X'*X;
    [V,D,notused]=svd(A);
    Xdecorr=X*V;

    else
     Xdecorr=Xdecorr;
    end

I translated in C as:

      Mat colorDecorrelation(Mat img,int numColComp){

      Mat V,D,A,mu,Xdecorr,img_tr;
      SVD svd;

       if(numColComp>1){

        mu=mean(img);
        subtract(img,mu,img);
        transpose(img,img_tr);
            A = img*img_tr;
            V = svd(A).u;
            Xdecorr = img*V;
       }
       else
       Xdecorr = img;

        return Xdecorr;
        }

I suppose I dont use well svd function!