Ask Your Question

Revision history [back]

Solution that was suggested in the comment and seemed to fix the problem.

After looking into your problem, you are using a wrong if - else structure. By using the else if functionality, you force the second condition to be checked every single time. If you want the else structure to only check that condition if the first if wasn't used you need something like this:

 if (first condition) {
    //do bla bla bla
 }
 else{
    // Call this bla bla bla if first one fails
    if (condition 2){
       // If condition is also correct, do this
    }
 }

Solution that was suggested in the comment and seemed to fix the problem.

After looking into your problem, you are using a wrong if - else structure. By using the else if functionality, you force the second condition to be checked every single time. If you want the else structure to only check that condition if the first if wasn't used you need something like this:

 if (first condition) {
    //do bla bla bla
 }
 else{
    // Call this bla bla bla if first one fails
    if (condition 2){
       // If condition is also correct, do this
    }
 }

About your remark on getting crazy, no you are just using the wrong if - else - else if loop statement. Changing your code to something like this would have solved the problem also:

Solution that was suggested in the comment and seemed to fix the problem.

After looking into your problem, you are using a wrong if - else structure. By using the else if functionality, you force the second condition to be checked every single time. If you want the else structure to only check that condition if the first if wasn't used you need something like this:

 if (first condition) {
    //do bla bla bla
 }
 else{
    // Call this bla bla bla if first one fails
    if (condition 2){
       // If condition is also correct, do this
    }
 }

About your remark on getting crazy, no you are just using the wrong if - else - else if loop statement. Changing your code to something like this would have solved the problem also:

else if( (atImageList < (int)imageList.size()) AND !inputCapture.isOpened() )
    result = imread(imageList[atImageList++], CV_LOAD_IMAGE_COLOR);
    return result;
}

But actually that is a very bad solution. using an elseif statement should almost never been done, since it is mostly bad programming when people resort to it :)

Solution that was suggested in the comment and seemed to fix the problem. Removed some remarks that were actually wrong, sorry for that.

After looking into By introducing some extra brackets, you can solve your problem, you are using a wrong if - else structure. By using the else if functionality, you force the second condition to be checked every single time. If you want the else structure to only check that condition if the first if wasn't used you need something like this:problem.

 if (first condition) {
    //do bla bla bla
 }
 else{
    // Call this bla bla bla if first one fails
    if (condition 2){
       // If condition is also correct, do this
    }
 }

About your remark on getting crazy, no you are just using the wrong if - else - else if loop statement. Changing your code to something like this would have solved the problem also:

else if( (atImageList < (int)imageList.size()) AND !inputCapture.isOpened() )
    result = imread(imageList[atImageList++], CV_LOAD_IMAGE_COLOR);
    return result;
}

But actually that is a very bad solution. using an elseif statement should almost never been done, since it is mostly bad programming when people resort to it :)