Dear users,
I'm currently using QCPColorMap with QCPColorScale to display an image (stored as a 1D std::vector). This image is belonging to a movie. I want to update, as fast as possible, the content of the image whenever the frame number to be displayed has been changed. Currently, I'm using the following code to update the image:
void VideoWidgetBasic::updateImage(std::vector<uint16_t> vec) { for (int xIndex=0; xIndex<nx; ++xIndex) { for (int yIndex=0; yIndex<ny; ++yIndex) { colorMap->data()->setCell(xIndex, yIndex, vec[yIndex*nx+xIndex]); } } replot(); }
The performance of this approach is really bad. To give some numbers, for 512*640 pixels images, a refresh takes about 17ms on MacOS and 30ms on Win10 (running on different machines). The same update, based on python and PyQtGraph, takes 8ms on MacOS and 10ms on Win10. What can I do to improve the performance of QCustomPlot? Is there a better way to update the content of an image?
Thanks for your time.
Regards,
Vincent