Profactor / cv-plot

fast modular opencv plotting library
MIT License
159 stars 30 forks source link

How can I show two CvPlot windows at the same time? #38

Open rolly-ng opened 1 year ago

rolly-ng commented 1 year ago

Hi, I am trying to show two windows at the same time, one is for the data and the other is for the histogram of data. Now I can only show the first window and if I close the first, then the second window appears. Thanks!

auto axes_1 = CvPlot::makePlotAxes();
axes_1.create<CvPlot::Series>(xdata, cv_tdata, "-g").setName("Data");   
sprintf(windowname, "Pixel phase at (v%ld, h%ld)", tdata_v, tdata_h);   
axes_1.title(windowname);
axes_1.create<Legend>()._parentAxes = &axes_1;
cv::Mat mat_1 = axes_1.render(300, 400); //plot to a cv::Mat
CvPlot::show("Sensorgram", axes_1);       //or show the 1st with interactive viewer

auto axes_2 = CvPlot::makePlotAxes();
axes_2.create<CvPlot::Series>(hdata_range, hdata_count, "-b").setName("Histogram"); 
sprintf(windowname, "Pixel histogram at (v%ld, h%ld)", tdata_v, tdata_h);   
axes_2.title(windowname);
axes_2.create<Legend>()._parentAxes = &axes_2;
cv::Mat mat_2 = axes_2.render(700, 400); //plot to a cv::Mat
CvPlot::show("Historgram", axes_2);         //or show the 2nd with interactive viewer