codes after waitKey(0) not running
code:
while(1) {
double alpha = -1; // initially invalid
while ( alpha < 0.0 || alpha > 1.0) {
cout << endl;
cout << "Enter Your Blend Value from 0.0 to 1.0" << endl;
cin >> alpha; // while your console window has the focus !
}
addWeighted(img, alpha, img2, 1.0 - alpha, 0, des);
imshow("img", img);
imshow("ime1", img2);
imshow("Blended", des);
waitKey(0);
cout<<"This is just a sample<<endl;
}
after the three images has been displayed the code beneath it wont run, like the cout, except i close the images or terminate the program all together.. Thanks in advance
as a rule of thumb: you only need
1
waitKey(0) call, ever.this simply looks like broken programming logic, to me ;)
why do you need a
cin
AND a waitKey() there ? (they also work on different windows)i need it to be able to close the program, then i put the waitKey(0) before the two imshow it, am able to go down the code but the cin>> isn't working..
again, see answer below.
you'll also need to switch the focus between the console window for cin to work, and the highgui one for waitKey() !
@Allaye you changed your question : comments and answer are unintelligible. Please go back and post a new question with a full error message