Ask Your Question

Revision history [back]

convert matlab code to opencv c code

hi everyone i am currently converting the matlab code into opencv

    the matlab code
  Il = imread('left.png');
   Ir = imread('right.png');

      [D,W,x,w,K,SEEDs] = gcs( Il,Ir,[]);


    figure(1);
           imagesc(Il); axis image; colormap gray(256); hold on
      plot(SEEDs(:,1),SEEDs(:,3),'b+'); 
        title 'Left image'  

    figure(2);
     imagesc(D); axis image; colormap(jet); set(gca,'clim',[-100,100]);
      title 'Disparity map';

    figure(3);
    imagesc(W); axis image; colormap(jet);
       title  'Correlation map';

this is my opencv code

             void main()
           {

      //for the stereo camera
               CvCapture *frame1=cvCaptureFromCAM(1);
              CvCapture *frame2=cvCaptureFromCAM(2);

           while(1)  
        {

            cvNamedWindow("Leftplane", 1);
            cvNamedWindow("Rightplane",1);
           cvNamedWindow("disparitymap",1);
            cvNamedWindow("correlationmap",1);


        IplImage *src1=cvQueryFrame(frame1);//left sided image
       IplImage *src2=cvQueryFrame(frame2);//right sided image

//now the disparity algo will be applied on each and every frame received

             [D,W,x,w,K,SEEDs] = gcs(frame1,frame2,[]);//[]->refers to a si mple harris

prematcher

             cvShowImage("Leftplane",frame1);

            cvShowImage("Leftplane",frame2);

           cvShowImage("disparitymap",D);

           cvShowImage("correlationmap",W);

      cvWaitKey(10);

         }


        }
      But i am stuck in the plotiing of seeds part how do i write this expression plot(SEEDs(:,1),SEEDs(:,3),'b+'); in      

       opencv and also how to create a colomap jet as like in matlab for real time through stereo cam

pls also tell me how do we assign an axis to an image like in matlab x axis and y axis with scale