diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8ab062c..093aa9e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -67,6 +67,7 @@ jobs: ./tools/sed/sed.exe -i "s/QT_TOOLS_DIR=C:\/Qt\/Qt6.2.0\/Tools\/mingw810_32\/bin/QT_TOOLS_DIR=C:\/ProgramData\/Chocolatey\/lib\/mingw\/tools\/install\/mingw64\/bin/g" ./build_setup.bat ./tools/sed/sed.exe -i "s/OPENCV_DIR=D:\/Qt\/opencv4.2.0\/x64\/mingw\/bin/OPENCV_DIR=C:\/opencv4.0.0\/x64\/mingw\/bin/g" ./build_setup.bat ./tools/sed/sed.exe -i "s/libopencv_imgproc420/libopencv_imgproc400/g" ./build_setup.bat + ./tools/sed/sed.exe -i "s/libopencv_imgcodecs420/libopencv_imgcodecs400/g" ./build_setup.bat ./tools/sed/sed.exe -i "s/libopencv_core420/libopencv_core400/g" ./build_setup.bat ./tools/sed/sed.exe -i "s/OPENCV_DIR=D:\\Qt\\opencv4.2.0/OPENCV_DIR=C:\\opencv4.0.0/g" ./partform_win32.pri ./build_setup.bat diff --git a/YUVviewer.pro b/YUVviewer.pro index 500010f..6894642 100644 --- a/YUVviewer.pro +++ b/YUVviewer.pro @@ -93,6 +93,7 @@ unix:!macx:{ DEPENDPATH +=$${OPENCV_DIR}/include LIBS += -L $${OPENCV_DIR}/lib/ -lopencv_imgproc + LIBS += -L $${OPENCV_DIR}/lib/ -lopencv_imgcodecs LIBS += -L $${OPENCV_DIR}/lib/ -lopencv_core git_tag.commands = $$quote("cd $$PWD && git describe --always --long --dirty --abbrev=10 --tags | awk \'{print \"\\\"\"\$$0\"\\\"\"}\' > git_tag.inc") @@ -109,6 +110,7 @@ macx:{ DEPENDPATH +=$${OPENCV_DIR}/include LIBS += -L $${OPENCV_DIR}/lib/ -lopencv_imgproc + LIBS += -L $${OPENCV_DIR}/lib/ -lopencv_imgcodecs LIBS += -L $${OPENCV_DIR}/lib/ -lopencv_core git_tag.commands = $$quote("cd $$PWD && git describe --always --long --dirty --abbrev=10 --tags | awk \'{print \"\\\"\"\$$0\"\\\"\"}\' > git_tag.inc") diff --git a/build_dmg.sh b/build_dmg.sh index 976d4a3..7f86a58 100755 --- a/build_dmg.sh +++ b/build_dmg.sh @@ -31,6 +31,7 @@ cd ./build_release/out # 打包 macdeployqt YUVviewer.app cp $OPENCV_DIR/lib/libopencv_imgproc.4.0.dylib ./YUVviewer.app/Contents/Frameworks/libopencv_imgproc.4.0.dylib +cp $OPENCV_DIR/lib/libopencv_imgcodecs.4.0.dylib ./YUVviewer.app/Contents/Frameworks/libopencv_imgcodecs.4.0.dylib cp $OPENCV_DIR/lib/libopencv_core.4.0.dylib ./YUVviewer.app/Contents/Frameworks/libopencv_core.4.0.dylib otool -L ./YUVviewer.app/Contents/MacOS/YUVviewer ./build-dmg.sh YUVviewer diff --git a/build_setup.bat b/build_setup.bat index db7a2c1..c8f715a 100644 --- a/build_setup.bat +++ b/build_setup.bat @@ -41,6 +41,7 @@ xcopy /y .\test\* .\InnoSetup\build\test\ :: 使用windeployqt拷贝依赖dll库到打包目录 windeployqt --dir .\InnoSetup\build .\InnoSetup\build\YUVviewer.exe xcopy /y "%OPENCV_DIR%\libopencv_imgproc420.dll" ".\InnoSetup\build\" +xcopy /y "%OPENCV_DIR%\libopencv_imgcodecs420.dll" ".\InnoSetup\build\" xcopy /y "%OPENCV_DIR%\libopencv_core420.dll" ".\InnoSetup\build\" xcopy /y "%QT_TOOLS_DIR%\..\bin\lib*.dll" ".\InnoSetup\build\" xcopy /y "%QT_TOOLS_DIR%\..\lib\lib*.dll" ".\InnoSetup\build\" diff --git a/src/UI_YUVviewer.ui b/src/UI_YUVviewer.ui index 540d38b..f292b38 100644 --- a/src/UI_YUVviewer.ui +++ b/src/UI_YUVviewer.ui @@ -229,6 +229,11 @@ BayerGR_RAW16 + + + PNG + + diff --git a/src/YUVdecoder.cpp b/src/YUVdecoder.cpp index 40b6948..1f71594 100644 --- a/src/YUVdecoder.cpp +++ b/src/YUVdecoder.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include "YUVdecoder.h" @@ -48,6 +49,7 @@ QMap ImageDecoder::yuvdecoder_map = { {"BayerGB_RAW16", BAYER_FUNC(cv::COLOR_BayerGB2RGB,16)}, {"BayerRG_RAW16", BAYER_FUNC(cv::COLOR_BayerRG2RGB,16)}, {"BayerGR_RAW16", BAYER_FUNC(cv::COLOR_BayerGR2RGB,16)}, + {"PNG", ImageDecoder::png}, }; QList ImageDecoder::yv12(const QString &yuvfilename,int W, int H, int startframe, int totalframe) { @@ -430,3 +432,17 @@ QList ImageDecoder::bayer(const QString &yuvfilename,int W, int H, int return rgbImglist; } + +QList ImageDecoder::png(const QString &yuvfilename,int W, int H, int startframe, int totalframe) { + QList rgbImglist; + + cv::Mat *rgbImg = new cv::Mat; + *rgbImg = cv::imread(yuvfilename.toStdString()); + rgbImglist.insert(rgbImglist.constEnd(), rgbImg); + + Q_UNUSED(W); + Q_UNUSED(H); + Q_UNUSED(startframe); + Q_UNUSED(totalframe); + return rgbImglist; +} diff --git a/src/YUVdecoder.h b/src/YUVdecoder.h index 9803d56..4ca818b 100644 --- a/src/YUVdecoder.h +++ b/src/YUVdecoder.h @@ -29,6 +29,7 @@ class ImageDecoder { static QList bgr565_big_endian(const QString &yuvfilename,int W, int H, int startframe, int totalframe); static QList rgb888(const QString &yuvfilename,int W, int H, int startframe, int totalframe); static QList bayer(const QString &yuvfilename,int W, int H, int startframe, int totalframe,int code,int bit); + static QList png(const QString &yuvfilename,int W, int H, int startframe, int totalframe); static QMap yuvdecoder_map; }; diff --git a/src/YUVviewer.cpp b/src/YUVviewer.cpp index 899e2b6..3fef00e 100644 --- a/src/YUVviewer.cpp +++ b/src/YUVviewer.cpp @@ -133,6 +133,7 @@ const QList>> YUVviewer::YUVFormat_ UI_G,UI_G,UI_B,UI_B,UI_G,UI_G,UI_B,UI_B,UI_G,UI_G,UI_B,UI_B,UI_G,UI_G,UI_B,UI_B,UI_G,UI_G,UI_B,UI_B,UI_G,UI_G,UI_B,UI_B}}, {"BayerGR_RAW16", {UI_G,UI_G,UI_R,UI_R,UI_G,UI_G,UI_R,UI_R,UI_G,UI_G,UI_R,UI_R,UI_G,UI_G,UI_R,UI_R,UI_G,UI_G,UI_R,UI_R,UI_G,UI_G,UI_R,UI_R, UI_B,UI_B,UI_G,UI_G,UI_B,UI_B,UI_G,UI_G,UI_B,UI_B,UI_G,UI_G,UI_B,UI_B,UI_G,UI_G,UI_B,UI_B,UI_G,UI_G,UI_B,UI_B,UI_G,UI_G}}, + {"PNG", {UI_A}}, }; YUVviewer::YUVviewer(QWidget *parent) : @@ -583,7 +584,7 @@ void YUVviewer::openFile() { if(lastPath.isDir()) { openDir = YUVviewerConfigFile->config_dict.lastPath; } - QStringList openfile_list = QFileDialog::getOpenFileNames(this, "选择文件", openDir, "YUV files(*.yuv *.data *.raw)"); + QStringList openfile_list = QFileDialog::getOpenFileNames(this, "选择文件", openDir, "files(*.yuv *.data *.raw *.png)"); if(openfile_list.size() != 0) { QFileInfo file(openfile_list[0]); YUVviewerConfigFile->config_dict.lastPath = file.absolutePath(); @@ -603,7 +604,7 @@ void YUVviewer::openFolder() { if (!openfolder_name.isEmpty()) { YUVviewerConfigFile->config_dict.lastPath = openfolder_name; QDir dir(openfolder_name); - QStringList nameFilters = {"*.yuv","*.data","*.raw"}; + QStringList nameFilters = {"*.yuv","*.data","*.raw","*.png"}; QStringList openfilename_list = dir.entryList(nameFilters, QDir::Files|QDir::Readable, QDir::Name); QStringList openfile_list; foreach (QString file_name, openfilename_list) { diff --git a/test/640x480.png b/test/640x480.png new file mode 100644 index 0000000..f10f048 Binary files /dev/null and b/test/640x480.png differ