Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay video using QImage in the same window?
    primarykey
    data
    text
    <p>I am trying to display the video taken by a simulator. I am implementing the QT code in ROS by including its header file. My code is running. PROBLEM:: Everytime the new window is opened to display the frame. I have kept cvWaitKey(10000) so that new windows will come after a time delay. But the updated frames should come inside the same window. Pls suggest how can i do it?? My code is following:</p> <pre><code> void imageCallback( const sensor_msgs::ImageConstPtr&amp; msg) //const sensor_msgs::ImageConstPtr&amp; { imagePublisher.publish (cv_ptr-&gt;toImageMsg()); QImage temp(&amp;(msg-&gt;data[0]), msg-&gt;width, msg-&gt;height, QImage::Format_RGB888); QImage image; image=temp; // QT Layout with button and image static QWidget *window = new QWidget; static QLabel *imageLabel= new QLabel; static QPushButton* quitButton= new QPushButton("Quit"); static QPushButton* exitButton= new QPushButton("Exit Image"); QVBoxLayout* layout= new QVBoxLayout; imageLabel-&gt;setPixmap(QPixmap::fromImage(image)); layout-&gt;addWidget(imageLabel); layout-&gt;addWidget(exitButton); layout-&gt;addWidget(quitButton); window-&gt;setLayout(layout); QObject::connect(quitButton, SIGNAL(clicked()),window, SLOT(close())); // Adding Buttons QObject::connect(exitButton, SIGNAL(clicked()),imageLabel, SLOT(close())); window-&gt;show(); cvWaitKey(1); } </code></pre> <p>int main(int argc, char **argv) {</p> <pre><code> ros::init(argc, argv, "imageSelectNode"); ros::NodeHandle n("~"); image_transport::ImageTransport it(n); image_transport::Subscriber sub = it.subscribe("/camera/image_raw",1, imageCallback); imagePublisher = it.advertise("imagePublisherTopic", 1); //Publish the image in 'imagePublisherTopic' node QApplication a(argc, argv); ros::spin(); return 0; </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload