use cin for choice an operation

asked 2017-06-18 05:09:27 -0600

louis89 gravatar image

updated 2017-06-18 10:34:52 -0600

hi. I have below code and i want if I entered 0 then condition if (intensity1 > intensity6) be review and if i entered 1 then condition if (intensity1 < intensity6) be rewiew. ` int main(int argc, char* argv[]) { VideoCapture cap(0); // open the video camera no. 0

if (!cap.isOpened())  // if not success, exit program
{
    cout << "Cannot open the video cam" << endl;
    return -1;
}
int Darker = 0;
int Clearer = 1;
Mat frame;
namedWindow("MyVideo", CV_WINDOW_AUTOSIZE);

cout << "Difference Intensity: " << endl
    << "0---if Darker " << endl
    << "1---if Clearer " << endl;  cin >>  Darker;cin >> Clearer;

while (1)
{

//...

`

` if (intensity1 > intensity6) {

        line(frame, pt25, pt26, Scalar(255, 255, 255), 1, 8, 0);
        line(frame, pt27, pt28, Scalar(255, 255, 255), 1, 8, 0);
        line(frame, pt29, pt30, Scalar(255, 255, 255), 1, 8, 0);
        line(frame, pt31, pt32, Scalar(255, 255, 255), 1, 8, 0);
    }
    else
        if (intensity1 < intensity6)
            cout << "lotus89" << endl;`

I am very grateful if you help me.thanks a lot..

edit retag flag offensive close merge delete

Comments

what's the problem , exactly ? (you somehow forgot to highlight it)

oh, and i'd rather have a single number with 3 states : 0:do_nothing, 1:lighter, 2:darker.

then, probably noone knows what your if (intensity1 > intensity6) be review statement means.

berak gravatar imageberak ( 2017-06-18 06:06:22 -0600 )edit

I have two ROIs and two conditions that i consider Their differences in intensity(ROIs) for chioce an operation.I want Any time i run my program,only one condition be rewiew.For this reason, I want to use cin in start my program for choice a condition only.I hope that I could explain what I want Properly.

louis89 gravatar imagelouis89 ( 2017-06-18 06:38:57 -0600 )edit

I write cout << "Difference Intensity: " << endl << "0---if Darker " << endl << "1---if Clearer " << endl; cin >> Darker;cin >> Clearer; for this reason.but I don't know what to do

louis89 gravatar imagelouis89 ( 2017-06-18 10:40:44 -0600 )edit

this code run for each condition for separate.but if I want to have both condition in program and decision that what condition Be considered,what can I do?

louis89 gravatar imagelouis89 ( 2017-06-18 11:05:05 -0600 )edit