Skip to content

Commit

Permalink
src:Fix YUV export sequence mix-up
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoming <[email protected]>
  • Loading branch information
QQxiaoming committed Nov 7, 2023
1 parent 9cb8c46 commit f73acef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ImgExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ void ImgExport::export_yuv(QImage *Img, const QString &sequence, const QString &
} else if(sequence == "4:4:4") {
cvtColor(rgbImg, yuvImg, cv::COLOR_RGB2YUV);
save.write((const char *)yuvImg.data,Img->height()*Img->width()*3);
} else if(sequence == "nv21") {
} else if(sequence == "nv12") {
cvtColor(rgbImg, yuvImg, cv::COLOR_RGB2YUV_YV12);
save.write((const char *)yuvImg.data,Img->height()*Img->width());
for(int i=0;i<Img->height()*Img->width()/2;i++) {
save.write((const char *)&yuvImg.data[i+Img->height()*Img->width()],1);
save.write((const char *)&yuvImg.data[i+Img->height()*Img->width()*5/4],1);
}
} else if(sequence == "nv12") {
} else if(sequence == "nv21") {
cvtColor(rgbImg, yuvImg, cv::COLOR_RGB2YUV_I420);
save.write((const char *)yuvImg.data,Img->height()*Img->width());
for(int i=0;i<Img->height()*Img->width()/2;i++) {
Expand Down

0 comments on commit f73acef

Please sign in to comment.