c++ - imshow is not working -


i used loop reading 300 frames , accumulating them.i gave imshow command inside print frames continuously not printed during loop processing comes single image

here's code:

enter code here  #include<iostream> #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include<stdlib.h> #include<stdio.h> using namespace cv; using namespace std; int main() {   char k;   int learningframes=300;   videocapture cap(0);   if(cap.isopened()==0)   {     cout<<"error";     return -1;   }    //while(1)   //{   mat frame;   cap>>frame;   mat frameaccf,frameacc,framethr32,framehsv,framethr;   frameaccf=mat::zeros(frame.size(),cv_32fc1);   for(int i=0;i<=learningframes;i++)   {     cap>>frame;     imshow("nn",frame);      cvtcolor(frame,framehsv,cv_bgr2hsv);      inrange(framehsv,scalar(0,30,0),scalar(50,150,255),framethr);      framethr.convertto(framethr,cv_32f);        accumulate(framethr,frameaccf);   }   frameaccf=frameaccf/300;   frameaccf.convertto(frameaccf,cv_8u);   imshow("frame",frame);   imshow("frameacc",frameaccf);      waitkey(0);   //if(k=='q')   //break;   //}    return 0;   } 

you need put waikey() inside loop

for(int i=0;i<=learningframes;i++)   {     cap>>frame;     imshow("nn",frame);      cvtcolor(frame,framehsv,cv_bgr2hsv);      inrange(framehsv,scalar(0,30,0),scalar(50,150,255),framethr);      framethr.convertto(framethr,cv_32f);        accumulate(framethr,frameaccf);      waitkey(0);   } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -