Incompréhension pour réaliser une sous-image à partir d'un élément MAT
Bonjour,
J'utilise QT 4.8.3, OpenCV 2.4.3 sous Win 7 64bits.
Le but de mon programme est, à partir d'images d'une caméra logitech (C920), d'obtenir des échantillons d'image. Je récupère et j'affiche correctement l'image.
Les échantillons récupérés sont inexploitable, comme ci les lignes de l'image étaient décalées.
Dans un timer de 60ms je fais :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| _loopTimer.stop();
QList<Mat*> myimgROS;
Mat curFrame;
bool bStatus = _capt->grab();
_capt->retrieve(curFrame);
if (bStatus)
{
cvtColor(curFrame, curFrame, CV_BGR2RGB);
_frame = curFrame.clone();
//Sauvegarde des échantillons
for(int i =0;i<lsRect.count();i+=1)
{
Point p1 = Point(lsRect.at(i)->x,lsRect.at(i)->y);
Point p2 = Point(lsRect.at(i)->x+lsRect.at(i)->width,lsRect.at(i)->y+lsRect.at(i)->height);
myimgROS << new Mat(_frame,Rect(lsRect.at(i)->x,lsRect.at(i)->y,lsRect.at(i)->width,lsRect.at(i)->height));
}
//Affichage de l'image acquise
QPixmap pm;
pm.convertFromImage(QImage((uchar*)curFrame.data, curFrame.cols, curFrame.rows,QImage::Format_RGB888));
this->setPixmap(pm);
}
//Envoie de la QList<QMat*>
//Clean QList
myimgROS.clear();
_loopTimer.start(); |
Est ce que la réalisation de l'échantillonnage est bon?
Avez vous une idée de savoir ce qui se passe pour que mon objet Mat soit inexploitable?
Merci de votre aide