img = cv2.imread(image_path+key) ~~~~~~~~~~^~~~ TypeError: can only concatenate str (not "dict") to str
时间: 2023-10-23 17:08:38 浏览: 123
浅谈cv2.imread()和keras.preprocessing中的image.load_img()区别
5星 · 资源好评率100%
这个错误是由于错误的字符串拼接导致的。在代码中,img变量是一个字典,而image_path是一个字符串。所以在拼接时出现了类型错误。要解决这个问题,需要将字典中的某个键值提取出来,然后与字符串拼接。请检查代码中img和image_path的定义并进行修正。可以使用适当的键来提取image_path所需的值。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [opencv-python图像预处理后处理记录](https://blog.csdn.net/baidu_40840693/article/details/110877503)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文