Displaying a large QImage on ImageOverlay

832
6
09-25-2021 04:06 AM
FatmaAkdemir
Occasional Contributor II

We have a constantly changing radar image which is 8000x8000 pixels. Whenever the radar image changes, a slot function  is executed as below:

void MainMapWidget::slotRadarImageChanged(const QImage &image){
	 std::unique_ptr<ImageFrame> m_imageFrame = std::make_unique<ImageFrame>(image, m_ImageOverlayEnvelope, this);
	 m_imageOverlay->setImageFrame(m_imageFrame.get());
}

This slotRadarImageChanged is not being called after each radar echo, instead we wait 30 echoes to be received and after that imageChanged signal is emitted. We detected that this function occupies CPU so much, causing a bottleneck in our program. If the image is 2000x2000 it does not cause any delays.

 

In short, we want to find a way to optimize passing our QImage to ImageOverlay. If there are any other alternative ways to do this, please share with us.

0 Kudos
6 Replies
KoushikHajra
Esri Contributor

Hi FatmaAkdemir,

I want to make sure that I understand your question. So, this slot is not being called every time there's a radar echo and an image changes. It's called once in every 30 times. Is that right? 

So, it only seems to be a bottleneck when the image is really high resolution (8kx8k)? There could be some optimization we could do on our end for this. We haven't had anyone request something with that high resolution. In our internal testing, we have used images upto 1k resolution. Is it possible to share an image with us so that we could take a look? I think the CPU usage is all about trying to load that large image. 

What you're doing is correct and should work. So, I will log a bug in any case for us to take a look and see what's going on. 

0 Kudos
FatmaAkdemir
Occasional Contributor II

Hi @KoushikHajra ,

Yeah, it's called once in every 30 radar pulse. Unfortunately I can not send the radar image since it is a real time stream data. Instead a test with 8k x 8k dummy QImage should be sufficient.

miWidth = 8000;
miHeight = 8000;

    try {
        mpImage = new QImage(QSize(miWidth, miHeight), QImage::Format_ARGB32);
    }
    catch (exception &e) {
        cout << "Exception in ImageItem::ImageItem : " << e.what() << endl;
    }
// Create a red QImage
    mpImage->fill(qRgba(255, 0, 0, 255));
0 Kudos
KoushikHajra
Esri Contributor

Thank you! We will test that out and see what we find on your end. Can you please let me know the specs and OS of your hardware? It would help me know if we are comparing on similar specs or worse.

0 Kudos
FatmaAkdemir
Occasional Contributor II

Hi @KoushikHajra ,

Specs and OS of our hardware is below:

1) 32 GB Memory

2) Intel Core i7 - 10700 CPU 2.9 GHz x16

3) GeForce RTX 2060 SUPER / PCIe / SSE2 / NVIDIA TU106 (8GB Graphics Card)

4) Ubuntu Linux OS 20.0.4 64 bit

0 Kudos
FatmaAkdemir
Occasional Contributor II

Hi @KoushikHajra ,

We have some additional questions concerning this issue:

1) While rendering the QImage on ImageOverlay, does ArcGIS utilize the GPU?

2) If we have used QML instead of C++, would it help our slot to be executed faster? Currently, slotRadarImageChanged() function takes about 200 msecs to execute.

3) As a commercial customer of ArcGIS Runtime Library, we would appreciate if you could open a bug report or an optimization item for the further releases about this issue.

 

Thanks for your support!

0 Kudos
KoushikHajra
Esri Contributor

1.  does ArcGIS utilize the GPU?

Yes, we do. We use the GPU to draw the image. 

2. I don't think QML would solve that problem. 

3. I'm going to log an issue for this for the development team to look at, but it would be best if you can also log a support request with Esri Support so they can create a public bug that can be monitored/tracked and other customers can be attached.

Thank you very much for bringing this up. 

0 Kudos