hi
how can i use QImage::scanLine() to compare pixel data of 2 images.
QImage image
("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Winter.jpg");
int height=image.height();
int width=image.width();
QImage image1
("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Winter.jpg");
int height1=image1.height();
int width1=image1.width();
if(height1!=height||width1!=width){
qDebug()<<"Images are different";
}
else
for(int i=0,j=0;i<height,j<height1;i++,j++){
QRgb * img=(QRgb *)image.scanLine(i);
QRgb * img1=(QRgb *)image.scanLine(j);
if(*img==*img1){
qDebug()<<"images matched:";
}
else
qDebug()<<"images do not match";
}
QImage image("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Winter.jpg");
int height=image.height();
int width=image.width();
QImage image1("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Winter.jpg");
int height1=image1.height();
int width1=image1.width();
if(height1!=height||width1!=width){
qDebug()<<"Images are different";
}
else
for(int i=0,j=0;i<height,j<height1;i++,j++){
QRgb * img=(QRgb *)image.scanLine(i);
QRgb * img1=(QRgb *)image.scanLine(j);
if(*img==*img1){
qDebug()<<"images matched:";
}
else
qDebug()<<"images do not match";
}
To copy to clipboard, switch view to plain text mode
i know this code is error prone, kindly explain to me how scanLine works
thanx
Bookmarks