Python TypeError: an integer is required (got type str) - knnMatch Error Solution
The error message suggests that the variable "db_descriptors_str" is of type "str", but it should be an integer. The "knnMatch" method expects the second argument to be an integer specifying the number of nearest neighbors to return. \n\nTo fix the issue, you need to make sure that "db_descriptors_str" is an integer. You can convert it to an integer by using the "int()" function. Here's an example: \n\npython\nmatches = matcher.knnMatch(query_descriptors, int(db_descriptors_str), 2)\n\n\nMake sure that "db_descriptors_str" contains a valid integer value before converting it.
原文地址: https://www.cveoy.top/t/topic/qsaL 著作权归作者所有。请勿转载和采集!