I read an image with:
tr
("Open File"),
QDir::currentPath());
if (!fileName.isEmpty()) {
imageLabel
->setPixmap
(QPixmap::fromImage(image
));
scaleFactor = 1.0;
printAct->setEnabled(true);
fitToWindowAct->setEnabled(true);
updateActions();
if (!fitToWindowAct->isChecked())
imageLabel->adjustSize();
}
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open File"), QDir::currentPath());
if (!fileName.isEmpty()) {
QImage image(fileName);
imageLabel->setPixmap(QPixmap::fromImage(image));
scaleFactor = 1.0;
printAct->setEnabled(true);
fitToWindowAct->setEnabled(true);
updateActions();
if (!fitToWindowAct->isChecked())
imageLabel->adjustSize();
}
To copy to clipboard, switch view to plain text mode
Now I want to change the values of the pixels of this image with new values. They are contained in an matrix[][] of int representing the same image equalized with my function.
The range of values in this matrix is 0-255.
I tried with:
for( int i = 0; i < r; i++ )
for(int j = 0; j < c; j++)
image.setPixel(j,i,(uint)matrix[i][j]);
for( int i = 0; i < r; i++ )
for(int j = 0; j < c; j++)
image.setPixel(j,i,(uint)matrix[i][j]);
To copy to clipboard, switch view to plain text mode
but don't work, infact if I try to view it, I get a white image
Hepl me!!Thanks.
Bookmarks