Ask Your Question

residentelvio's profile - activity

2020-10-07 17:15:50 -0600 received badge  Notable Question (source)
2020-04-12 04:00:38 -0600 received badge  Popular Question (source)
2020-03-16 00:48:37 -0600 received badge  Famous Question (source)
2019-10-23 04:41:53 -0600 received badge  Famous Question (source)
2017-09-25 13:48:03 -0600 received badge  Notable Question (source)
2017-08-05 02:22:11 -0600 received badge  Notable Question (source)
2017-05-16 08:16:35 -0600 received badge  Popular Question (source)
2017-03-20 17:06:00 -0600 received badge  Notable Question (source)
2016-07-21 14:00:13 -0600 received badge  Famous Question (source)
2016-06-26 06:38:13 -0600 received badge  Popular Question (source)
2015-12-20 05:52:22 -0600 received badge  Popular Question (source)
2015-12-10 15:23:44 -0600 received badge  Notable Question (source)
2015-12-09 09:52:45 -0600 received badge  Popular Question (source)
2015-12-09 03:56:21 -0600 received badge  Notable Question (source)
2015-08-25 23:17:54 -0600 received badge  Popular Question (source)
2015-04-08 05:39:41 -0600 received badge  Popular Question (source)
2015-04-02 04:18:04 -0600 received badge  Popular Question (source)
2014-12-09 13:53:51 -0600 marked best answer Run time error

I have this error:

OpenCV Error: Assertion failed (type == B.type() && (type == CV_32FC1 || type == CV_64FC1 ||
type == CV_32FC2 || type == CV_64FC2)) in gemm, file /build/buildd/opencv-
2.3.1/modules/core/src/matmul.cpp, line 701 terminate called after throwing an instan
ce of 'cv::Exception' what(): /build/buildd/opencv-2.3.1/modules/core/
src/matmul.cpp:701: error: (-215) type == B.type() && (type == CV_32FC1 || 
type == CV_64FC1 || type == CV_32FC2 || type == CV_64FC2) in function gemm

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_tr*img;
        V = svd(A).u;
        Xdecorr = img*V;
   }
   else
   Xdecorr = img;

    return Xdecorr;
    }

The error is for sure when I do : A=img_tr*img

2014-12-09 13:53:29 -0600 marked best answer Is this line code correct?

I

I have a Mat object and a bidimensional array. I need to multiply them and have a new Mat object. I had to realize imf=imf.*filt in Matlab

for(m=0;m<rows;m++){
  for(n=0;n<cols;n++){

    imfft= imfft*filter[m][n];

   }
 }
2014-12-09 13:53:20 -0600 marked best answer Rows,cols,channels

Hi people,

I have a question.

Code:

  int rows= img.rows;
  int cols= img.cols;
  int channels=img.channels();

Does this code give to me the numbers of rows,cols and channels of an image I read with imread function? Does the image I use must be in the same path of the project to be read?

2014-12-09 13:53:09 -0600 marked best answer Error running program

Hi i m running a programm I finish . I see this as error:

   OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or
   unsupported array type) in cvGetMat, file
   /build/buildd/opencv-2.3.1/modules/core/src/array.cpp, line 2482 terminate
   called after throwing an instance of 'cv::Exception' what():
  /build/buildd/opencv-2.3.1/modules/core/src/array.cpp:2482: error: (-206)
  Unrecognized or unsupported array type in function cvGetMat

I suppose it s an error about the type of image I use. What I do is take an image and work with it in two different ways, for if the image is in grey scale or RBG. I suppose I did some errors with some functions need in paramethers the type. For example:

  img= image.zeros(rows,cols,CV_32F);

I don t know the difference in the last paramether (the type), can I use for example image.type() ? There is something it explain good the type in openCV. Thanks

2014-09-22 05:57:25 -0600 marked best answer Reshape function

Hi I have to translate from MAtlav to C this lines:

 x=reshape(img,r*c,numChannels);
 x=reshape(img,r,c,numChannels);
 x=reshape(img,r,c);
 x=reshape(img,r*c,scalesNumber);

I didn t understand well this function, but I tried with:

 x=img.reshape(numColComp,rows*cols);
 x=img.reshape(numColComp,rows);
 x=img.reshape(numColComp,rows); //or x=img.reshape(0,rows)
 x=img.reshape(0,rows);

I suppose I m doing it bad

2014-03-11 06:37:22 -0600 commented question Read an image with imread()

I mean why argv[1] is the path of an image passed by command line?

2014-03-11 06:35:00 -0600 commented question Read an image with imread()

Load an image by passing the path or by a command line interface (I don t know if the right term in English) . Howewer the code works.I just want to understand better why is used in that way. How is used about the command line loading in that way

2014-03-11 06:33:36 -0600 answered a question Read an image with imread()

Load an image by passing the path or by a command line interface (I don t know if the right term in English) . Howewer the code works.I just want to understand better why is used in that way. How is used about the command line loading in that way

2014-03-10 14:11:37 -0600 asked a question Read an image with imread()

Hi people, I have this part of code and I d like to undrestand better it.

  Mat img=imread(".....");   //... is a path

  if(argc>1)
    img=imread(argv[1]);

  if(img.empty(){
    cerr <<" Error message:" << argv[1];
    return 1;
  }

  if (img.empty(){
    cout << "the image is empty\n";
    return -1;
  }

First line load an image by passing directly the path of the image. After it load an image if is passed by command line, as cmd, or terminal. Can I understand better how. Why is it used argv[1]? Is it a need to use 2 time the control about if the imafe is loaded? I understand is a control firstly for the second kind of loading image and after for the 1st (load by adding path)

2014-03-05 11:33:32 -0600 asked a question Recognize some part of a picture

Hi perople,

do you know if exist some code or just tell me some function of openCv can be used to recognize some part of a picture. I mean the target is:

from a picture ( for example a face of a person) underline or point out some parts I want (for example nose, eyes...etc).

Thank you

2014-02-27 17:20:02 -0600 commented answer Install OpenCV 2.4.8 ubuntu

I solved all the problems . Thanks

2014-02-27 15:21:21 -0600 commented answer Install OpenCV 2.4.8 ubuntu

I did some modification in the file opened with

sudo gedit /etc/ld.so.conf.d/opencv.conf

I added: / /usr/local/opencv/ then type: sudo ldconfig

Now Consolle in Eclipse give me : CAN NOT OPEN IMAGE FILE :

2014-02-27 14:44:52 -0600 commented answer Install OpenCV 2.4.8 ubuntu

Ok. I had the same problems and same errors. But adding libraries in setting of the cpp file it does not show any error now. But compiling I have this error in the Consolle (using Eclipse):

/home/elvio/workspace/main-cpp/Debug/main-cpp: error while loading shared libraries: libopencv_core.so.2.4: cannot open shared object file: No such file or directory

2014-02-27 13:01:09 -0600 commented answer Install OpenCV 2.4.8 ubuntu

it shows:

/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so -lrt -lpthread -lm -ldl

2014-02-27 11:14:42 -0600 commented answer Install OpenCV 2.4.8 ubuntu

HI man, I did how you said. Now I recompile (a project that must work) and I have 100 errors of same type:

undefined reference to 'cv:: .......... " , where ....is a function with his input's type.

Maybe is it because I have to add in PROJECT-->PROPERTIES-->C/C++ BUILD-->SETTINGS the various libraries and includes....where can I find it?

2014-02-27 08:54:07 -0600 commented answer Install OpenCV 2.4.8 ubuntu

Do I have to delete the previous version?

2014-02-27 08:30:55 -0600 asked a question Install OpenCV 2.4.8 ubuntu

I try with http://answers.opencv.org/question/26250/opencv-linux-installation/

but doesn t workk. Howewer I had a previous version on my ububtu. do I have ti delete it before? How?

2014-02-14 13:52:17 -0600 asked a question Decorrelation on RGB components

I have to do:

Initial decorrelation on RGB color components of each image / frame to have an efficient codification ( without duplication ) of the input data through analysis of the principal components (PCA ), adapted to local image statistics ( rbgDecorr in AWS.m of Matlab ) .We obtain the three components Z1 , Z2 and Z3 in the block figure Whitening Color . This operation is performed by colorDecorrelation( ) function . image description I have yet done colorDecorrelation function and it works. But in main I don t know how to do all is written before and in the image. P.D. All must done in a MAT object

2014-02-14 13:15:40 -0600 asked a question Retribution to correct a project doen t work

Hi,

I have a project on image processing. It doesn' t work. It s finished, but I don' t understand how correct the error. the project is very short, about 300 lines. The project come from a work (it works well) in Matlab and so I did a sort of translation from Matlab I have a documentation that explain what to do too and I can explain what t do. knowledge of : OpenCV,C++ and eventually Matlab

Contact to : [email protected]

2014-02-05 10:52:17 -0600 commented question Image processing project with an error I can not solve

Oh, maybe I understand reading better. 1 grayscale image for each mono colored picture, as in the picture attached.if you open it, you ll understan easily. Thanks

2014-02-05 04:20:36 -0600 commented question Image processing project with an error I can not solve

I did not understand your answer. Howewer we have an image.from this we obtain Rgb images inthe same array 3dimensional. In 3rd dimension you have the 3 images. After the matrix is whitened for every pixel.

2014-02-04 06:24:00 -0600 commented question Image processing project with an error I can not solve

do you know how can I solve this part?

2014-02-03 03:44:20 -0600 commented question Image processing project with an error I can not solve

Yes it s more or less what u said. the C is the operation of whitening. It s done in the function colorDecorrelation. The work done in Matlab works , so it can be just a translation from it to C++ as I done in code. I suppose it s right this part. It s the first & second part I didn t do. Thanks to help me

2014-02-01 09:00:09 -0600 commented question Image processing project with an error I can not solve

Hello keghn. Thanks for reply. You are very close. A & B ok. The whitening procedure consisting in decorrelation and variance normalization is simply applied to the r, g, b components of the image. Being x1=r, x2=g and x3=b the RGB coordinates of any pixel in the image, they are involved in the transformation (x1,x2,x3)→(z1,z2,z3). Thereby I obtain z contain z1 to z3 components.Z is whitened with a new vector associated to each pixel. If x is the representation of the image in the original space, y the representation in principal components, and z (z-scores) the corresponding representation in the whitened coordinates. That is, x = (xj) →y = (yj) →z = (zj) with j=1…M, where M is the number of components. Look the picture I attached to understand better

2014-01-31 14:13:07 -0600 asked a question Image processing project with an error I can not solve

Hi people. I hope you can help me to solve this problem I can not solve from long time. I have to finish a project about image processing and I saw an error in the initial step. I have a code in Matlab I have to obtain it in C++ with OpenCV. I did not study Matlab and C++ neither too (just C) , so I don t know how continue my work. Please help.

As in this picture : C:\fakepath\imag.png

the initial target is :

Initial decorrelation on RGB color components of each image/frame to have an efficient codification (without duplication)of the input data through analysis of the principal components(PCA),adapted to local image statistics (rgbDecorr in Matlab's code). We obtain so 3 components Z1,Z2,Z3 in the image attached in the block figure Whitening color. This operation is performed by colorDecorrelaion function().

Matlab' s code :

 //initial stuff
 numColComp = compc; % 3 in case of color images, 1 in grayscale images
 inComp = reshape(im, r*c, numColComp);

 Decorr=colorDecorrelation(inComp,numColComp);

 rgbDecorr= reshape(Decorr, r, c, numColComp); //HERE

 clear Decorr;

 % Fourier transform of the achromatic component
 [imfft,sz2filt,padSize]=FourierTransform2D(rgbDecorr(:,:,1),achrLambda_max);

 //more stuff

 conspic2 = zeros(r,c);

   for i_c_comp=2:numColComp

     % FILTERING CHROMATIC COMPONENT rgbDecorr(:,:,2) and  rgbDecorr(:,:,2)
    [imfft,sz2filt,padSize]=FourierTransform2D(rgbDecorr(:,:,i_c_comp),chrLambda_max);

I don t understand in Matlab where is obtained the 3 components. I supposed where I commented HERE and I suppose but I m not sure that is created a 3dimensional array where in a dimension is located the 3 components. Am I right? How to do it and how to obtain this stuff? I don t understan where it obtain this 3 images of the image attached by the input image:

Howewer here the colorDecorrelation function MAtlab's code:

function Xdecorr=colorDecorrelation(X,numColComp){

 if numColComp>1  %color images                  
 mu = mean(X); %mean of each feature of the original data
 X = bsxfun(@minus, X, mu);
 A = X'*X; 
 [V,D,notused] = svd(A);

 Xdecorr=X*V;

 else % in case of a grayscale image
   Xdecorr = X;
   end

So In C++ what I did is:

//initial statements and Image control if empty or not

inCompImg = img.reshape(numColComp,(img.rows)*(img.cols));
imgDecorr = colorDecorrelation(inCompImg,img.channels());

 // TO RETURN INITIAL VALUES BEACUSE I HAD TO CHANGE IT IN COLORDECORRELATION FUNCTION
 imgDecorr.convertTo(rgbDecorrImg,CV_8UC3); 

 //HERE ERROR FOR SURE
 rgbDecorrImg = rgbDecorrImg.reshape(numColComp,imgDecorr.rows);


...
...

 Mat colorDecorrelation(Mat img,int numColComp){

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

  if(numColComp>1){

    //I have to convert because of gemm function need a float
    img.convertTo(img_f,CV_32FC3);
    img_f=img_f.reshape(1,img.rows*img.cols); // 1 channel

     mu=mean(img_f); //media degli elementi della matrice
     subtract(img_f,mu,img_f);
    transpose(img_f,img_tr);
     A = img_tr * img_f;
    V = svd(A).u; 
    Xdecorr = img_f*V;

  }
   else 
    Xdecorr=img;

     return Xdecorr;
   }
2014-01-31 04:11:25 -0600 asked a question Color Decorrelation

Hi people. Im doing a translation from Matlab to C++. That' s code in Matlab I have to put in C++

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Color Decorrelation
 % Input Parameters:
 %  im           - image matrix
 %  numColComp   - number of image channels
 %
 % Output value:
 %  Xdecorr  - decorrelated image, same dimensions as the original one
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 function Xdecorr=colorDecorrelation(X,numColComp)

 if numColComp>1  %color images
 mu = mean(X); %mean of each feature of the original data
 X = bsxfun(@minus, X, mu);
 A = X'*X;   %cavariance matrix
 [V,D,notused] = svd(A);

 Xdecorr=X*V;

 else % in case of a grayscale image
    Xdecorr = X;
 end

My translation in C++

 Mat colorDecorrelation(Mat img,int numColComp){

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

 if(numColComp>1){

    //I have to convert because of gemm function need a float
    img.convertTo(img_f,CV_32FC3);
    img_f=img_f.reshape(1,img.rows*img.cols); // 1 channel

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

 }
  else 
   Xdecorr=img;

 return Xdecorr;
 }

Do you think is it ok?