I have to transform a QVector
2d into a QImage
to display the image in a label. The QVector
in this case is an array of integers with value from 0 to 255 representing an image in PGM or PPM, this vector makes grayscale or RGB transformations that are necessary for PDI exercises, but to make it a little easier and the easiest generic methods to use, I decided to put the image in a QImage and present the changes.
The question is how can I move QVector<QVector<int> >
to QImage
, where I can also add file format information, in P2
and P3
, comment line, number of rows and columns, and color scale.
It would look something like this:
P2
# Comentário do arquivo
número de linhas número de colunas
255
vetor 2d com as informações da imagem.