Ask Your Question

sinaras's profile - activity

2016-01-21 10:30:59 -0500 received badge  Student (source)
2013-09-04 08:24:32 -0500 commented answer ELSE runs even after IF runs!

I get it. and most of the time I get check my program via cout, .... I'm aware that code/binary aligning is sometimes replaced and not accurate. Using cout, I found out where the problem is in my final excutable (release) and then focused on these particular part of the code. The debugging example is just to show what my problem is (I'm used to this type of debugging since I am a PHP programmer :) )

2013-09-04 04:25:37 -0500 commented answer ELSE runs even after IF runs!

@StevenPuttemans: I exactly did this. The reason for debugging a release code is that the release code doesn't execute properly while the debug code does. Funny thing is, this problem is now solved in debugging mode of visual studio for release, but occurs every 3 out of 10 executions of the code. I still suspect the core release library that is responsible for creation of Mat objects.

2013-09-03 16:13:09 -0500 answered a question ELSE runs even after IF runs!

PROBLEM SOLVED! Thanks to all you friends for helping me out. I changed my compiler options as suggested by @Notas, and everything is now OK :) Property Pages -> C++ -> Optimization. set optimization to Disabled(/Od). My code now runs perfectly in release mode and I don't feel any changes in speed. This little change cost me 3 weeks of code search and compiler testing. Thanks all again :)

2013-09-03 16:02:44 -0500 commented answer ELSE runs even after IF runs!

@StevenPuttemans: Thanks for watching the video thoroughly. You're right, that's why I suspected opencv core libraries since it cannot initialize a Mat object for the result variables.

2013-09-03 01:35:35 -0500 received badge  Self-Learner (source)
2013-09-02 08:49:56 -0500 answered a question ELSE runs even after IF runs!

Please see this 1 minute video... It explains my problem... http://www.youtube.com/watch?v=nJWDN01-dAI

2013-08-27 18:13:02 -0500 commented answer ELSE runs even after IF runs!

@sammy please note that the statements in IF and ELSE are both run!

2013-08-26 07:32:03 -0500 commented answer ELSE runs even after IF runs!

Thanks Moster. But the problem is, this happens even after I build my project in RELEASE mode and not just when tracing it. That is, my program never captures a frame from camera (it actually captures, but the image is corrupted during this process).

2013-08-26 06:17:48 -0500 commented answer ELSE runs even after IF runs!

Thanks Steven, but the second structure couldn't fix that either. The funny thing is that if I replace the following line in my code: result = imread(imageList[atImageList++], CV_LOAD_IMAGE_COLOR); with this: cout<<"blah blah";

then the second IF wouldn't validate! and the program would run perfectly! in your code (on top of this comment), after the first IF validates, the trace will go to ELSE and without checking the condition 2 for IF would directly run it's code (i.e. result = imread(imageList[atImageList++], CV_LOAD_IMAGE_COLOR);) !!! This is the weirdest thing I have seen until now. I changed it with this: imread(imageList[atImageList++], CV_LOAD_IMAGE_COLOR).copyTo( result);

Still runs! but place cout<<"Blah Blah" and comment the above line, and the cout<< wouldn't run! :(

2013-08-26 02:28:25 -0500 commented answer ELSE runs even after IF runs!

That's right. But remember condition for IF is true (which is isOpen()) and that's why it runs the lines inside its bracket. But it also runs the line for ELSE. this means that the return value from isOpen from highgui library is somehow corrupted and thus makes Visual Studio validate it as true and false at the same time! I posted it here because I think this is related to highgui library. My settings for Debug and Release are 100% correct and work perfectly for other programs I write (which do not access IO devices)

2013-08-26 02:25:18 -0500 commented question ELSE runs even after IF runs!

Sorry, I just added what the editor suggested, nothing from myself. I'll consider this in future. Thanks for noting.

2013-08-26 01:06:51 -0500 received badge  Editor (source)
2013-08-26 01:05:29 -0500 asked a question ELSE runs even after IF runs!

Hey Guys & Gals! I have an odd problem with OpenCV.

I am trying to implement a calibration program based on calibration example of opencv but with more features. The problem is, when in class "Settings" the program reaches the following line in Debug mode, it runs perfectly:

Mat nextImage()
{
Mat result;
if( inputCapture.isOpened() )
{
   Mat view0;
   inputCapture >> view0;
   view0.copyTo(result);
}
else if( atImageList < (int)imageList.size() )
   result = imread(imageList[atImageList++], CV_LOAD_IMAGE_COLOR);
        return result;
}

Assuming I am taking images from my WebCam, when I am trying to trace the code in Release mode, after IF validates (isOpened()==true) and filling the Result with view0, OpenCV runs the ELSE part too!!!, and thus destoying the result and creating an empty view!. As far as I know if IF validates, ELSE shouldn't validate! :)) but I've no idea why this happens! Remember that my code runs perfectly in Debug mode!

OpenCV:2.4.6 / Visual Studio 2012 / Windows 7 SP1 64bit / Active Configuration: 64bit