Skip to content

Commit

Permalink
修复报错
Browse files Browse the repository at this point in the history
今天无聊就看了看之前的代码,结果捉到个小虫。说起来也是当时马虎了——
  • Loading branch information
sxjeru authored Aug 5, 2023
1 parent 7c307e8 commit 02b646f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions merge-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ void merge1() {
Mat imgO = imread(imgOpath);
Mat imgD = imread(imgDpath);
if (!imgO.data || !imgD.data) {
goto jump; //判断图片是否存在
empty = true;
goto jump; //判断图片是否存在
}
int x = stoi(para[j * 10 + 3]), y = stoi(para[j * 10 + 4]), w = stoi(para[j * 10 + 5]), h = stoi(para[j * 10 + 6]); //string -> int
Mat roi(imgO(Rect(x, y, w, h)));
Expand All @@ -107,8 +107,8 @@ void merge1() {
else {
Mat imgO = imread(imgOpath);
if (!imgO.data) {
goto jump; //判断图片是否存在
empty = true;
goto jump; //判断图片是否存在
}
namedWindow("Viewer", WINDOW_NORMAL);
resizeWindow("Viewer", 1200, 675);
Expand Down
4 changes: 2 additions & 2 deletions merge-2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ void merge2() {
Mat imgO = imread(imgOpath, IMREAD_UNCHANGED); //读取透明png
Mat imgD = imread(imgDpath, IMREAD_UNCHANGED);
if (!imgO.data || !imgD.data) {
goto jump; //判断图片是否存在
empty = true;
goto jump; //判断图片是否存在
}
if (imgD.channels() != 4) {
cvtColor(imgD, imgD, COLOR_BGR2BGRA); //RGB -> RGBA
Expand All @@ -123,8 +123,8 @@ void merge2() {
else {
Mat imgO = imread(imgOpath, IMREAD_UNCHANGED);
if (!imgO.data) {
goto jump; //判断图片是否存在
empty = true;
goto jump; //判断图片是否存在
}
namedWindow("Viewer", WINDOW_NORMAL);
resizeWindow("Viewer", imgO.cols / 5.5, imgO.rows / 5.5);
Expand Down

0 comments on commit 02b646f

Please sign in to comment.