Questions tagged [qimage]

A QImage is a class from the Qt toolkit which provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.

Qt provides four classes for handling image data: QImage, QPixmap, QBitmap and QPicture. QImage is designed and optimized for I/O, and for direct pixel access and manipulation.

Because QImage is a QPaintDevice subclass, QPainter can be used to draw directly onto images. When using QPainter on a QImage, the painting can be performed in another thread than the current GUI thread.

The QImage class supports several image formats, including monochrome, 8-bit, 32-bit and alpha-blended images.

QImage provides a collection of functions that can be used to obtain a variety of information about the image. There are also several functions that enable transformation of the image.

QImage objects can be passed around by value since the QImage class uses implicit data sharing. QImage objects can also be streamed and compared.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

549 questions
4
votes
1 answer

How can access to pixel data with PYQt' QImage scanline()

I need to access the pixel data in a qimage object with PyQt4. The .pixel() is too slow so the docs say to use the scanline() method. In c++ I can get the pointer returned by the scanline() method and read/write the pixel RGB value from the…
risinglf
  • 41
  • 1
  • 2
4
votes
2 answers

Better way to load QPixmap data

Better way to do it (without QImage)?: QImage image(width, height, QImage::Format_RGB888); memcpy(image.bits(), m_frameRGB->data[0], height * width * 3); QPixmap pixmap = QPixmap::fromImage(image); I don't see any reason to use QImage as…
DEgITx
  • 960
  • 1
  • 13
  • 24
4
votes
6 answers

Qimage to cv::Mat convertion strange behaviour

I am trying to create an application where I am trying to integrate opencv and qt. I managed successfully to convert a cv::Mat to QImage by using the code below: void MainWindow::loadFile(const QString &fileName) { cv::Mat tmpImage =…
ttsesm
  • 917
  • 5
  • 14
  • 28
3
votes
1 answer

Qt QImage pixel manipulation problems

I'm currently in the process of writing a steganography application with Qt. I am trying to hide my message bits in the least significant bit of the blue colour of the pixel. From debugging I can tell that this section is working as it should.…
mdec
  • 5,122
  • 4
  • 25
  • 26
3
votes
1 answer

QT multithreaded QImage change

I am writing a software which does a lot of image operations / compositing on a lot of (potential big) images. Multi threading helps a lot speed wise, but QT does not allow using multiple QPainter on the same image at the same time. So i would have…
SleepProgger
  • 364
  • 6
  • 20
3
votes
4 answers

Convert IplImage to Qpixmap

How do we convert IplImage to a QPixmap or QImage? If the only answer is save the Iplimage then load it to the QPixmap, then how do we do that?
hamza
  • 2,714
  • 3
  • 19
  • 14
3
votes
1 answer

show matplotlib imshow output in Qt

I have a 2D numpy array of type np.float64, and I want to show it as an image in a QLabel (or any other valid way): self.img = np.rot90(get_my_data()) # this line returns a 2D numpy array of type np.float64 self.qimg = QtGui.QImage(self.img,…
catfour
  • 119
  • 3
  • 10
3
votes
2 answers

Identical images have different pixel data when loaded as a QImage in Release

Comparing two identical images which are loaded in the format QImage::Format_Indexed8 have different pixel data only when running in Release mode. The following code shows differences when running in Release, but not when running in Debug: int…
Harry
  • 1,362
  • 12
  • 19
3
votes
1 answer

How to set a QImage object to QML's Image element from C++ side multiple times?

I am have a QImage object in my Qt app on the C++ side of code. Image { id: my_image source: "" } I have the QML Connections element in which I am getting a QImage sent Connections { target: qimage_supplier onNewQImage: { …
TheWaterProgrammer
  • 7,055
  • 12
  • 70
  • 159
3
votes
1 answer

displaying image using a label

I have converted a numpy array into a pixmap to display it on a label within my GUI. When I run the program, the GUI closes for some reason (no error messages). height, width = input_image.shape bytesPerLine = 3 * width qImg =…
Senyokbalgul
  • 1,058
  • 4
  • 13
  • 37
3
votes
2 answers

Compressing DDS images using QImageWriter

The documentation for Qt says that QImageWriter has a setCOmpression method and that this method depends on the chosen image format. For example, for tiff images, 0 means no compression and 1 means LZW compression. By the same token, I am setting my…
meguli
  • 1,426
  • 1
  • 18
  • 35
3
votes
1 answer

Qt rotated image -> polygon

I have a QImage with center at (x,y) and with size (w,h). I apply a rotation and eventually scaling using QTransform. Now is easy to me to put the new image (rotated/scaled) centered at (x,y). QTransform transform =…
Junior
  • 507
  • 5
  • 19
3
votes
3 answers

QImage file path

I don't see this in the documentation anywhere, so it probably doesn't exist, but just in case: I have a function that accepts as a parameter a vector of QImages. Each QImage was loaded from disk at some point and has not been edited--it is just…
John
  • 2,012
  • 2
  • 21
  • 33
3
votes
3 answers

How to check that QImage::save() has finished writing to disk?

I have a program where I am now saving large, 18 megapixel or less images to the disk. Along the way I convert them to a QImage, display the QImage in a subclass of a QDialog, and then prompt the user to save them. I wanted to have some sort of…
Kettamon
  • 97
  • 8
3
votes
1 answer

from cvMat to QImage

i want to convert an image from cvMat type to Qimage , with my actual code the application does not work; i have did it the other way (Qimage to Mat it work fine) please tell me what is going on wrong with my code here is my code for Qimage to Mat :…
ner
  • 711
  • 3
  • 13
  • 30