Hi, I did this:
if (!fileName.isEmpty())
im_banda1.load(fileName);
ban
=im_banda1.
convertToFormat(QImage::Format_Indexed8);
int matrix[100][100];
for(int i=0;i<100;i++){
for(int j=0;j<100;j++){
matrix[i][j]=ban.pixel(i,j);
}
}
QString fileName = QFileDialog::getOpenFileName(this, title,QString(),tr("Images (*.tif)"));
if (!fileName.isEmpty())
im_banda1.load(fileName);
QImage ban;
ban=im_banda1.convertToFormat(QImage::Format_Indexed8);
int matrix[100][100];
for(int i=0;i<100;i++){
for(int j=0;j<100;j++){
matrix[i][j]=ban.pixel(i,j);
}
}
To copy to clipboard, switch view to plain text mode
and works, the problem is that the pixels are not the same as the original image, ie in the original image I have values 0-255, here too but only 4 wide range, which would seem to lose informaicion.
Bookmarks