Skip to content
Snippets Groups Projects
Commit 6f76138a authored by Roh min do's avatar Roh min do
Browse files

sort Area

parent 8365883d
Branches
No related tags found
No related merge requests found
...@@ -201,6 +201,13 @@ int main() ...@@ -201,6 +201,13 @@ int main()
} }
if (ch == true) { 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(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); rectangle(img, Rect(max_point.x, max_point.y, templ.cols, templ.rows), Scalar(0, 255, 0), 1);
} }
...@@ -246,6 +253,14 @@ int main() ...@@ -246,6 +253,14 @@ int main()
} }
if (ch==true) { 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(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); rectangle(img, Rect(max_point.x, max_point.y, templ2.cols, templ2.rows), Scalar(0, 255, 0), 1);
} }
...@@ -267,7 +282,9 @@ int main() ...@@ -267,7 +282,9 @@ int main()
printf("adsf"); printf("adsf");
printf("!!"); printf("!!");
putText(img, "Finish", Point(30, 70), 2, 0.4, Scalar(0, 0, 255), 1); 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);// imshow("final", img);//
} }
waitKey(0); waitKey(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment