There are many place for you to improve your code, such as this line, it would be better to write it this way in C++, since the int and float/double convert might lose precision, which would make the inference wrong.
int top = dh / 2;
int bottom = dh - top;
int left = dw / 2;
int right = dw - left;
Thanks for your sharing, the repo helps me a lot.
There are many place for you to improve your code, such as this line, it would be better to write it this way in C++, since the
int
andfloat/double
convert might lose precision, which would make the inference wrong.