# Revision history [back]

### waitKey(1) freezes display output, is there a fix?

I'm using opencv(4.1.1) with ubuntu(18.04), as I understand my build uses GTK, so it uses that libraries function for reading the keypresses?

My problem now is that when you hold a key down, the frames no longer get drawn on screen. I suspect this has to do with waitkey not getting enough time to do the drawing, but how do you go about solving this?

The reason I want this is to control parameters using key inputs but having a freeze happen when sending many inputs is not preferable.

### waitKey(1) freezes display output, is there a fix?

I'm using opencv(4.1.1) with ubuntu(18.04), as I understand my build uses GTK, so it uses that libraries function for reading the keypresses?

My problem now is that when you hold a key down, the frames no longer get drawn on screen. I suspect this has to do with waitkey not getting enough time to do the drawing, but how do you go about solving this?

The reason I want this is to control parameters using key inputs but having a freeze happen when sending many inputs is not preferable.

The code is as follows:

   //create rtspsrc gstreamer pipe
std::string pipe =  "rtspsrc location=rtsp://192.168.1.113:554/user=admin_password=_channel=1_OSD_stream=1.sdp latency=0 ! decodebin ! videoconvert ! appsink ";
cam = new cv::VideoCapture(pipe, cv::CAP_GSTREAMER);

while(true){


currentFrame = cam->returnFrame(); markerFrame = markerFilter->processFrame(currentFrame); cv::imshow("out", currentFrame); cv::imshow("markerInfo", markerFrame); //control1.pollInput(); //If not using control, use cv::waitKey(10); //getchar //char c=getchar(); // if(c=='x'){ // cout << " x is pressed" << endl; // } waitKeyEx(1); }

### waitKey(1) freezes display output, is there a fix?

I'm using opencv(4.1.1) with ubuntu(18.04), as I understand my build uses GTK, so it uses that libraries function for reading the keypresses?

My problem now is that when you hold a key down, the frames no longer get drawn on screen. I suspect this has to do with waitkey not getting enough time to do the drawing, but how do you go about solving this?

The reason I want this is to control parameters using key inputs but having a freeze happen when sending many inputs is not preferable.

The code is as follows:

   //create rtspsrc gstreamer pipe
std::string pipe =  "rtspsrc location=rtsp://192.168.1.113:554/user=admin_password=_channel=1_OSD_stream=1.sdp latency=0 ! decodebin ! videoconvert ! appsink ";
cam = new cv::VideoCapture(pipe, cv::CAP_GSTREAMER);

while(true){


cap->grab(); cap->retrieve(currentframe); currentFrame = cam->returnFrame(); markerFrame = markerFilter->processFrame(currentFrame); cv::imshow("out", currentFrame); cv::imshow("markerInfo", markerFrame); //control1.pollInput(); //If not using control, use cv::waitKey(10); //getchar //char c=getchar(); // if(c=='x'){ // cout << " x is pressed" << endl; // waitKeyEx(1); } waitKeyEx(1); }

### waitKey(1) freezes display output, is there a fix?

I'm using opencv(4.1.1) with ubuntu(18.04), as I understand my build uses GTK, so it uses that libraries function for reading the keypresses?

My problem now is that when you hold a key down, the frames no longer get drawn on screen. I suspect this has to do with waitkey not getting enough time to do the drawing, but how do you go about solving this?

The reason I want this is to control parameters using key inputs but having a freeze happen when sending many inputs is not preferable.

The code is as follows:

   //create rtspsrc gstreamer pipe
std::string pipe =  "rtspsrc location=rtsp://192.168.1.113:554/user=admin_password=_channel=1_OSD_stream=1.sdp latency=0 ! decodebin ! videoconvert ! appsink ";
cam cap = new cv::VideoCapture(pipe, cv::CAP_GSTREAMER);

while(true){
cap->grab();
cap->retrieve(currentframe);
currentFrame = cam->returnFrame();
cv::imshow("out", currentFrame);
waitKeyEx(1);
}


### waitKey(1) freezes display output, is there a fix?

I'm using opencv(4.1.1) with ubuntu(18.04), as I understand my build uses GTK, so it uses that libraries function for reading the keypresses?

My problem now is that when you hold a key down, the frames no longer get drawn on screen. I suspect this has to do with waitkey not getting enough time to do the drawing, but how do you go about solving this?

The reason I want this is to control parameters using key inputs but having a freeze happen when sending many inputs is not preferable.

The code is as follows:

   //create rtspsrc gstreamer pipe
std::string pipe =  "rtspsrc location=rtsp://192.168.1.113:554/user=admin_password=_channel=1_OSD_stream=1.sdp latency=0 ! decodebin ! videoconvert ! appsink ";
cap = new cv::VideoCapture(pipe, cv::CAP_GSTREAMER);

while(true){
cap->grab();
cap->retrieve(currentframe);
currentFrame = cam->returnFrame();
cv::imshow("out", currentFrame);
waitKeyEx(1);
}


### waitKey(1) freezes display output, is there a fix?

I'm using opencv(4.1.1) with ubuntu(18.04), as I understand my build uses GTK, so it uses that libraries function for reading the keypresses?

My problem now is that when you hold a key down, the frames no longer get drawn on screen. I suspect this has to do with waitkey not getting enough time to do the drawing, but how do you go about solving this?

The reason I want this is to control parameters using key inputs but having a freeze happen when sending many inputs is not preferable.

The code is as follows:

   //create rtspsrc gstreamer pipe
//basic needed classes
#include <iostream>
#include <string>

#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/opencv.hpp>
#include "opencv2/imgcodecs.hpp"

using namespace cv;

Mat currentFrame;

int main(){
std::string pipe =  "rtspsrc location=rtsp://192.168.1.113:554/user=admin_password=_channel=1_OSD_stream=1.sdp latency=0 ! decodebin ! videoconvert ! appsink ";
VideoCapture cap = new cv::VideoCapture(pipe, cv::CAP_GSTREAMER);
while(true){
cap->grab();
cap->retrieve(currentframe);
cap.grab();
cap.retrieve(currentFrame);
cv::imshow("out", currentFrame);
waitKeyEx(1);
}
return 0;
}


### waitKey(1) freezes display output, is there a fix?

I'm using opencv(4.1.1) with ubuntu(18.04), as I understand my build uses GTK, so it uses that libraries function for reading the keypresses?

My problem now is that when you hold a key down, the frames no longer get drawn on screen. I suspect this has to do with waitkey not getting enough time to do the drawing, but how do you go about solving this?

The reason I want this is to control parameters using key inputs but having a freeze happen when sending many inputs is not preferable.

The code is as follows:

//basic needed classes
#include <iostream>
#include <string>

#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/opencv.hpp>
#include "opencv2/imgcodecs.hpp"

using namespace cv;

Mat currentFrame;

int main(){
//create gstreamer rtspsrc pipe
std::string pipe =  "rtspsrc location=rtsp://192.168.1.113:554/user=admin_password=_channel=1_OSD_stream=1.sdp latency=0 ! decodebin ! videoconvert ! appsink ";
VideoCapture cap = cv::VideoCapture(pipe, cv::CAP_GSTREAMER);
while(true){
cap.grab();
cap.retrieve(currentFrame);
cv::imshow("out", currentFrame);
waitKeyEx(1);
}
return 0;
}


### waitKey(1) freezes display output, is there a fix?

I'm using opencv(4.1.1) opencv(4.1.2) with ubuntu(18.04), as I understand my build uses GTK, so it uses that libraries function for reading the keypresses?

My problem now is that when you hold a key down, the frames no longer get drawn on screen. I suspect this has to do with waitkey not getting enough time to do the drawing, but how do you go about solving this?

The reason I want this is to control parameters using key inputs but having a freeze happen when sending many inputs is not preferable.

The code is as follows:

//basic needed classes
#include <iostream>
#include <string>

#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/opencv.hpp>
#include "opencv2/imgcodecs.hpp"

using namespace cv;

Mat currentFrame;

int main(){
//create gstreamer rtspsrc pipe
std::string pipe =  "rtspsrc location=rtsp://192.168.1.113:554/user=admin_password=_channel=1_OSD_stream=1.sdp latency=0 ! decodebin ! videoconvert ! appsink ";
VideoCapture cap = cv::VideoCapture(pipe, cv::CAP_GSTREAMER);

while(true){
cap.grab();
cap.retrieve(currentFrame);
cv::imshow("out", currentFrame);
waitKeyEx(1);
}
return 0;
}