1

i am trying to make a very simple program that invert the pixels position using Opencv .. however it seems that the code doez not compute for some reason , i have noticed a lot of Missing PDB files & i made a little research but i havent find any thing to help me solve the problem i am using VS 2010 with Opencv 2.2

#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include <iostream>

using namespace std ;

int _tmain(int argc, _TCHAR* argv[]){


    IplImage *image = cvLoadImage("mra.jpg");
    if (!image) {
            cout<<"Error: Couldn't open the image file.\n"<<endl ;
            return 1;
    }
    IplImage *new_image = cvCreateImage(cvGetSize(image) , image->depth , 1 );

    CvScalar pix ;
    int position = 0 ;

    for(int i = 0 ; i < image->height ; i++ ){
        for (int j = 0 ; j < image->width ; j++ ){
            pix = cvGet2D(image , i , j ) ;     

            if ( i = 0 ){
                position = image->height - 1 ;
            }else if ((position >= 2)) {
                position = position - 2 ;
            }
            cvSet2D(new_image , position , j , pix );
        }
    }


    cvNamedWindow("1111", CV_WINDOW_AUTOSIZE);
    cvNamedWindow("2222", CV_WINDOW_AUTOSIZE);
    cvShowImage("1111", image);
    cvShowImage("2222", new_image);

    // Wait for the user to press a key in the GUI window.
    cvWaitKey(0);

    // Free the resources.
    cvDestroyAllWindows ;
    cvReleaseImage(&image);
    cvReleaseImage(&new_image);

    return 0;
}

thanks in advance

hamza
  • 2,714
  • 3
  • 19
  • 14
  • 2
    "the code doez not compute for some reason" - is this a troll? It is certainly not a question. What doesn't work? Is there an error? – Mitch Wheat Jan 17 '11 at 00:51
  • 1
    @Mitch Wheat: location: Algeria. Maybe his English is not as good as your Algerian? Agreed the question is not clear, but... – JimR Jan 17 '11 at 01:28
  • @Mitch : the built step went fine however the images does not show , no thing appear in the consol window & i have noticed in VS output area a lot of warning with messages such as :'OpencvInvert.exe': Loaded 'C:\Users\75\Documents\Visual Studio 2010\Projects\OpencvInvert\Debug\OpencvInvert.exe', Symbols loaded. 'OpencvInvert.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file 'OpencvInvert.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file other Codes worked with such worning but if this help i can post the complete list of missing pdb – hamza Jan 17 '11 at 16:31
  • i am sure the the problem is in those lines if ( i = 0 ){ position = image->height - 1 ; }else if ((position >= 2)) { position = position - 2 ; } but i cannot find it – hamza Jan 17 '11 at 16:42
  • This is the answer to the missing pdb files: http://stackoverflow.com/a/8138518/1627959 – Tim Sep 23 '14 at 10:07

1 Answers1

1

if (i = 0)

will assign 0 to i. It should be (i == 0). Are you by any chance getting an endless loop?

Dan Cristoloveanu
  • 1,974
  • 1
  • 13
  • 20