diff --git a/source/main.cpp b/source/main.cpp index f02be7f07c2140cb47f70cd5adfdc43780c23f9e..d252d81a0347cf2c477e4940ce97c7b078c8cf27 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -201,6 +201,13 @@ int main() } if (ch == true) { + printf("x: %d, y: %d\n", max_point.x, max_point.y); + if (templ.cols < templ.rows) { + //max_point.x = (int)(check-4 *(floor((double)max_point.x / (double)(check-4)+ 0.5))); + max_point.y = (int)((templ.rows+2) *(floor((double)max_point.y / (double)(templ.rows+2) + 0.5))); + } + else + max_point.x = (int)((templ.cols+2) *(floor((double)max_point.x / (double)(templ.cols+2) + 0.5))); rectangle(final, Rect(max_point.x, max_point.y, templ.cols - 4, templ.rows - 4), Scalar(100, 100, 100), 1); rectangle(img, Rect(max_point.x, max_point.y, templ.cols, templ.rows), Scalar(0, 255, 0), 1); } @@ -246,6 +253,14 @@ int main() } if (ch==true) { + + if (templ2.cols < templ2.rows) { + //max_point.x = (int)(check-4 *(floor((double)max_point.x / (double)(check-4)+ 0.5))); + max_point.y = (int)(templ2.rows *(floor((double)max_point.y / (double)(templ2.rows)+0.5))); + } + else + max_point.x = (int)(templ2.cols *(floor((double)max_point.x / (double)(templ2.cols)+ 0.5))); + rectangle(final, Rect(max_point.x, max_point.y, templ2.cols - 4, templ2.rows - 4), Scalar(100, 100, 100), 1); rectangle(img, Rect(max_point.x, max_point.y, templ2.cols, templ2.rows), Scalar(0, 255, 0), 1); } @@ -267,11 +282,13 @@ int main() printf("adsf"); printf("!!"); putText(img, "Finish", Point(30, 70), 2, 0.4, Scalar(0, 0, 255), 1); - + //int aaa = 133,bbb = 9; + //printf("\n********값 : %d더블값:%lf 반올림값 : %lf",aaa,(double)aaa,floor(aaa/(double)bbb+0.5)); + //printf("\n%d", (int)floor(aaa / (double)bbb + 0.5)); imshow("final", img);// } waitKey(0); return 0; -} \ No newline at end of file +}