Official document: https://docs.python.org/zh-cn/3/library/ctypes.html
ctypes defines some basic data types compatible with C
Step on the pit 1:
sheetDeteInterface.h
// define
char* detectSheet(const char* imagePath, bool flag, const double angle=0.0);
python call (error example)
from ctypes import *
from ctypes import cdll
solib = cdll.LoadLibrary(so_path)
solib.detectSheet(c_char_p(image_path.encode('utf-8')), c_bool(flag), angle=c_double(angle))
python call (correct example)
from ctypes import *
from ctypes import cdll
solib = cdll.LoadLibrary(so_path)
solib.detectSheet(c_char_p(image_path.encode('utf-8')), c_bool(flag), c_double(angle))
Because when calling the function, the keyword of python syntax is used to pass parameters, so the value corresponding to angle is not passed into the dynamic library, but the program does not report an error, so I searched for it for a long time.
Therefore, you cannot use python keywords to pass parameters when calling dynamic library functions.