活动介绍

[ERROR:[email protected]] global D:\a\opencv-python\opencv-python\opencv\modules\core\src\persistence.cpp (505) cv::FileStorage::Impl::open Can't open file: 'E:\PyCh\python\ venv\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml' in read mode Traceback (most recent call last): File "E:\PyCh\python\TTTT\xym\Face recognition2.py", line 43, in <module> yangmi=ReFileName(dirPathyangmi)#调用函数 File "E:\PyCh\python\TTTT\xym\Face recognition2.py", line 32, in ReFileName face, rect = face_detect_demo(img) File "E:\PyCh\python\TTTT\xym\Face recognition2.py", line 9, in face_detect_demo faces = face_detector.detectMultiScale(gray, 1.2, 6) #使用此函数监测图像中的人脸。函数返回一个位置和大小的矩形列表,最后我们在原始图像中绘制矩形,已标记检测到人脸 cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1689: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'

时间: 2023-07-30 22:09:28 浏览: 914
根据错误信息,有两个问题需要解决: 1. `Can't open file: 'E:\PyCh\python\ venv\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml' in read mode`:这个错误是由于无法以读取模式打开文件 'E:\PyCh\python\ venv\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml' 所导致的。请确保级联分类器文件存在,并且路径正确。 2. `cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1689: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'`:这个错误是由于在 `cv::CascadeClassifier::detectMultiScale` 函数中出现了断言失败的情况。可能是由于级联分类器文件未正确加载或不存在导致的。请确保级联分类器文件存在,并且路径正确。 请检查以上两个问题并进行修正。如果问题仍然存在,请提供更多的代码和错误信息,以便我更好地帮助你解决问题。
相关问题

"D:\Downloads\PyCharm Community Edition 2024.3.4\PCproject\PythonProject\.venv\Scripts\python.exe" "D:\Downloads\PyCharm Community Edition 2024.3.4\PCproject\PythonProject\projectTest8.py" 处理碎片: 0%| | 0/209 [00:00<?, ?it/s][ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\000.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\001.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\002.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\003.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\004.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\005.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\006.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\007.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\008.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\009.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\010.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\011.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\012.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\013.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\014.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\015.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\016.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\017.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\018.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\019.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\020.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\021.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\022.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\023.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\024.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\025.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\026.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\027.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\028.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\029.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\030.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\031.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\032.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\033.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\034.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\035.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\036.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\037.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\038.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\039.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\040.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\041.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\042.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\043.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\044.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\045.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\046.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\047.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\048.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\049.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\050.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\051.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\052.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\053.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\054.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\055.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\056.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\057.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\058.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\059.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\060.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\061.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\062.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\063.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\064.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\065.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\066.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\067.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\068.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\069.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\070.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\071.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\072.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\073.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\074.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\075.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\076.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\077.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\078.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\079.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\080.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\081.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\082.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\083.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\084.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\085.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\086.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\087.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\088.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\089.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\090.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\091.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\092.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\093.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\094.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\095.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\096.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\097.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\098.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\099.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\100.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\101.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\102.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\103.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\104.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\105.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\106.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\107.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\108.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\109.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\110.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\111.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\112.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\113.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\114.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\115.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\116.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\117.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\118.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\119.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\120.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\121.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\122.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\123.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\124.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\125.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\126.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\127.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\128.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\129.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\130.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\131.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\132.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\133.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\134.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\135.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\136.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\137.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\138.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\139.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\140.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\141.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\142.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\143.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\144.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\145.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\146.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\147.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\148.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\149.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\150.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\151.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\152.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\153.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\154.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\155.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\156.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\157.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\158.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\159.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\160.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\161.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\162.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\163.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\164.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\165.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\166.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\167.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\168.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\169.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\170.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\171.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\172.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\173.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\174.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\175.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\176.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\177.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\178.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\179.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\180.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\181.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\182.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\183.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\184.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\185.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\186.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\187.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\188.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\189.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\190.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\191.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\192.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\193.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\194.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\195.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\196.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\197.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\198.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\199.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\200.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\201.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\202.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\203.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\204.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\205.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\206.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\207.bmp'): can't open/read file: check file path/integrity [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\208.bmp'): can't open/read file: check file path/integrity 处理碎片: 100%|██████████| 209/209 [00:00<00:00, 15821.28it/s] 0it [00:00, ?it/s] Traceback (most recent call last): File "D:\Downloads\PyCharm Community Edition 2024.3.4\PCproject\PythonProject\projectTest8.py", line 282, in <module> chinese_reconstructor.reconstruct(output_folder="output_chinese") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Downloads\PyCharm Community Edition 2024.3.4\PCproject\PythonProject\projectTest8.py", line 265, in reconstruct success = self.reconstruct_grid() File "D:\Downloads\PyCharm Community Edition 2024.3.4\PCproject\PythonProject\projectTest8.py", line 182, in reconstruct_grid print(f"选择左上角碎片: {self.fragments[top_left_id]['filename']}") ~~~~~~~~~~~~~~^^^^^^^^^^^^^ IndexError: list index out of range ================================================== 开始处理中文碎片 (附件3) 正在加载碎片图像从: D:\学习文件\JM\2013B\附件3 无法读取图像: 000.bmp 无法读取图像: 001.bmp 无法读取图像: 002.bmp 无法读取图像: 003.bmp 无法读取图像: 004.bmp 无法读取图像: 005.bmp 无法读取图像: 006.bmp 无法读取图像: 007.bmp 无法读取图像: 008.bmp 无法读取图像: 009.bmp 无法读取图像: 010.bmp 无法读取图像: 011.bmp 无法读取图像: 012.bmp 无法读取图像: 013.bmp 无法读取图像: 014.bmp 无法读取图像: 015.bmp 无法读取图像: 016.bmp 无法读取图像: 017.bmp 无法读取图像: 018.bmp 无法读取图像: 019.bmp 无法读取图像: 020.bmp 无法读取图像: 021.bmp 无法读取图像: 022.bmp 无法读取图像: 023.bmp 无法读取图像: 024.bmp 无法读取图像: 025.bmp 无法读取图像: 026.bmp 无法读取图像: 027.bmp 无法读取图像: 028.bmp 无法读取图像: 029.bmp 无法读取图像: 030.bmp 无法读取图像: 031.bmp 无法读取图像: 032.bmp 无法读取图像: 033.bmp 无法读取图像: 034.bmp 无法读取图像: 035.bmp 无法读取图像: 036.bmp 无法读取图像: 037.bmp 无法读取图像: 038.bmp 无法读取图像: 039.bmp 无法读取图像: 040.bmp 无法读取图像: 041.bmp 无法读取图像: 042.bmp 无法读取图像: 043.bmp 无法读取图像: 044.bmp 无法读取图像: 045.bmp 无法读取图像: 046.bmp 无法读取图像: 047.bmp 无法读取图像: 048.bmp 无法读取图像: 049.bmp 无法读取图像: 050.bmp 无法读取图像: 051.bmp 无法读取图像: 052.bmp 无法读取图像: 053.bmp 无法读取图像: 054.bmp 无法读取图像: 055.bmp 无法读取图像: 056.bmp 无法读取图像: 057.bmp 无法读取图像: 058.bmp 无法读取图像: 059.bmp 无法读取图像: 060.bmp 无法读取图像: 061.bmp 无法读取图像: 062.bmp 无法读取图像: 063.bmp 无法读取图像: 064.bmp 无法读取图像: 065.bmp 无法读取图像: 066.bmp 无法读取图像: 067.bmp 无法读取图像: 068.bmp 无法读取图像: 069.bmp 无法读取图像: 070.bmp 无法读取图像: 071.bmp 无法读取图像: 072.bmp 无法读取图像: 073.bmp 无法读取图像: 074.bmp 无法读取图像: 075.bmp 无法读取图像: 076.bmp 无法读取图像: 077.bmp 无法读取图像: 078.bmp 无法读取图像: 079.bmp 无法读取图像: 080.bmp 无法读取图像: 081.bmp 无法读取图像: 082.bmp 无法读取图像: 083.bmp 无法读取图像: 084.bmp 无法读取图像: 085.bmp 无法读取图像: 086.bmp 无法读取图像: 087.bmp 无法读取图像: 088.bmp 无法读取图像: 089.bmp 无法读取图像: 090.bmp 无法读取图像: 091.bmp 无法读取图像: 092.bmp 无法读取图像: 093.bmp 无法读取图像: 094.bmp 无法读取图像: 095.bmp 无法读取图像: 096.bmp 无法读取图像: 097.bmp 无法读取图像: 098.bmp 无法读取图像: 099.bmp 无法读取图像: 100.bmp 无法读取图像: 101.bmp 无法读取图像: 102.bmp 无法读取图像: 103.bmp 无法读取图像: 104.bmp 无法读取图像: 105.bmp 无法读取图像: 106.bmp 无法读取图像: 107.bmp 无法读取图像: 108.bmp 无法读取图像: 109.bmp 无法读取图像: 110.bmp 无法读取图像: 111.bmp 无法读取图像: 112.bmp 无法读取图像: 113.bmp 无法读取图像: 114.bmp 无法读取图像: 115.bmp 无法读取图像: 116.bmp 无法读取图像: 117.bmp 无法读取图像: 118.bmp 无法读取图像: 119.bmp 无法读取图像: 120.bmp 无法读取图像: 121.bmp 无法读取图像: 122.bmp 无法读取图像: 123.bmp 无法读取图像: 124.bmp 无法读取图像: 125.bmp 无法读取图像: 126.bmp 无法读取图像: 127.bmp 无法读取图像: 128.bmp 无法读取图像: 129.bmp 无法读取图像: 130.bmp 无法读取图像: 131.bmp 无法读取图像: 132.bmp 无法读取图像: 133.bmp 无法读取图像: 134.bmp 无法读取图像: 135.bmp 无法读取图像: 136.bmp 无法读取图像: 137.bmp 无法读取图像: 138.bmp 无法读取图像: 139.bmp 无法读取图像: 140.bmp 无法读取图像: 141.bmp 无法读取图像: 142.bmp 无法读取图像: 143.bmp 无法读取图像: 144.bmp 无法读取图像: 145.bmp 无法读取图像: 146.bmp 无法读取图像: 147.bmp 无法读取图像: 148.bmp 无法读取图像: 149.bmp 无法读取图像: 150.bmp 无法读取图像: 151.bmp 无法读取图像: 152.bmp 无法读取图像: 153.bmp 无法读取图像: 154.bmp 无法读取图像: 155.bmp 无法读取图像: 156.bmp 无法读取图像: 157.bmp 无法读取图像: 158.bmp 无法读取图像: 159.bmp 无法读取图像: 160.bmp 无法读取图像: 161.bmp 无法读取图像: 162.bmp 无法读取图像: 163.bmp 无法读取图像: 164.bmp 无法读取图像: 165.bmp 无法读取图像: 166.bmp 无法读取图像: 167.bmp 无法读取图像: 168.bmp 无法读取图像: 169.bmp 无法读取图像: 170.bmp 无法读取图像: 171.bmp 无法读取图像: 172.bmp 无法读取图像: 173.bmp 无法读取图像: 174.bmp 无法读取图像: 175.bmp 无法读取图像: 176.bmp 无法读取图像: 177.bmp 无法读取图像: 178.bmp 无法读取图像: 179.bmp 无法读取图像: 180.bmp 无法读取图像: 181.bmp 无法读取图像: 182.bmp 无法读取图像: 183.bmp 无法读取图像: 184.bmp 无法读取图像: 185.bmp 无法读取图像: 186.bmp 无法读取图像: 187.bmp 无法读取图像: 188.bmp 无法读取图像: 189.bmp 无法读取图像: 190.bmp 无法读取图像: 191.bmp 无法读取图像: 192.bmp 无法读取图像: 193.bmp 无法读取图像: 194.bmp 无法读取图像: 195.bmp 无法读取图像: 196.bmp 无法读取图像: 197.bmp 无法读取图像: 198.bmp 无法读取图像: 199.bmp 无法读取图像: 200.bmp 无法读取图像: 201.bmp 无法读取图像: 202.bmp 无法读取图像: 203.bmp 无法读取图像: 204.bmp 无法读取图像: 205.bmp 无法读取图像: 206.bmp 无法读取图像: 207.bmp 无法读取图像: 208.bmp 计算碎片相似度矩阵... 未找到明显左上角碎片,使用启发式方法 进程已结束,退出代码为 1 对于上面的Python代码

<think>根据错误信息,程序在尝试重建中文碎片(附件3)时遇到了两个主要问题: 1. 无法读取任何碎片图像(000.bmp到208.bmp),错误信息显示文件路径有问题或文件不完整。 2. 在尝试选择左上角碎片时,出现了`IndexError: list index out of range`错误。 ### 问题分析 1. **文件读取失败**:程序尝试从路径`D:\学习文件\JM\2013B\附件3`读取图像,但所有图像都无法打开。可能的原因包括: - 路径错误:指定的路径下不存在这些文件。 - 文件格式问题:虽然文件扩展名是.bmp,但可能实际格式不符或文件已损坏。 - 权限问题:程序没有读取该目录的权限。 2. **索引越界**:在`reconstruct_grid`方法中,尝试访问`self.fragments[top_left_id]`时发生了索引越界。这通常是因为`top_left_id`的值超出了`self.fragments`列表的范围。而`top_left_id`是通过`np.argmin(top_left_scores)`计算得到的,这表示程序试图找到一个左上角碎片,但可能没有找到合适的碎片(例如,所有碎片都被排除了,或者`top_left_scores`数组为空)。 ### 解决方案 #### 1. 解决文件读取问题 - **检查路径**:确保路径`D:\学习文件\JM\2013B\附件3`确实存在,并且包含208个碎片图像文件。 - **检查文件扩展名**:虽然文件名以.bmp结尾,但实际可能是其他格式?或者文件名有前缀后缀?可以尝试打印目录下的文件列表来确认。 - **使用绝对路径**:确保提供的路径是绝对路径,并且正确转义(在Python字符串中,反斜杠需要双写或使用原始字符串)。 在代码中,我们使用`os.listdir`来遍历目录,然后使用`os.path.join`构建完整路径。如果目录不存在,`os.listdir`会抛出异常。但这里并没有异常,而是每个文件都打不开,所以可能是文件本身的问题。 我们可以修改代码,在读取图像时如果失败,则打印出具体的文件路径,以便确认路径是否正确。同时,我们可以检查一下该目录下实际存在的文件列表。 修改`load_fragments`方法中的错误处理部分: ```python try: img = cv2.imread(filepath) if img is None: print(f"无法读取图像: {filename} (路径: {filepath})") continue # ... 其他处理 except Exception as e: print(f"读取图像{filename}时出错: {e}") ``` #### 2. 解决索引越界问题 索引越界是因为`top_left_id`的值可能为0,而如果`self.fragments`列表为空(因为所有图像都没有加载成功),那么访问`self.fragments[0]`就会越界。 在尝试重建之前,我们需要确保成功加载了一些碎片。如果没有任何碎片被加载,我们应该提前退出并给出错误提示。 在`reconstruct_grid`方法开始处添加检查: ```python if len(self.fragments) == 0: print("错误:没有加载到任何碎片图像。") return False ``` 另外,在计算`top_left_scores`时,如果所有碎片都被排除(比如因为边界特征计算失败),也可能导致`top_left_scores`为空数组。因此,在`np.argmin(top_left_scores)`之前,需要确保`top_left_scores`不为空。 ### 代码修改 基于以上分析,我们需要对代码进行以下修改: 1. 在`load_fragments`方法中,增加更详细的错误信息。 2. 在`reconstruct_grid`方法开始时,检查碎片列表是否为空。 3. 在计算左上角碎片时,检查`top_left_scores`数组是否为空。 以下是修改后的代码片段(只修改了相关部分): #### 修改`load_fragments`方法 ```python def load_fragments(self): print(f"正在加载碎片图像从: {self.folder}") files = os.listdir(self.folder) for filename in tqdm(files, desc="加载碎片"): if not filename.endswith(('.bmp', '.png', '.jpg', '.jpeg')): continue filepath = os.path.join(self.folder, filename) img = cv2.imread(filepath) if img is None: print(f"无法读取图像: {filename} (完整路径: {filepath})") continue # 转换为灰度图 gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 二值化 _, binary = cv2.threshold(gray, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU) self.fragments.append({ 'filename': filename, 'image': img, 'gray': gray, 'binary': binary }) print(f"成功加载 {len(self.fragments)} 个碎片") ``` #### 修改`reconstruct_grid`方法 在方法开始处添加: ```python if len(self.fragments) == 0: print("错误:没有碎片可供重建。") return False ``` 在计算左上角碎片的部分,添加检查: ```python # 计算左上角碎片 top_left_scores = [] for i, frag in enumerate(self.fragments): # 计算每个碎片的边界特征(比如左边界和上边界的黑色像素比例) # 左上角碎片:左边和上边应该是全白(或接近全白),而右边和下边应该有黑色(文字) left_edge = frag['binary'][:, 0] top_edge = frag['binary'][0, :] # 计算左边界和上边界的白色像素比例 left_white_ratio = np.sum(left_edge == 255) / len(left_edge) top_white_ratio = np.sum(top_edge == 255) / len(top_edge) # 我们希望左上角碎片的左边界和上边界白色比例高,所以得分是(1-白色比例)的和 score = (1 - left_white_ratio) + (1 - top_white_ratio) top_left_scores.append(score) # 检查top_left_scores是否为空 if len(top_left_scores) == 0: print("错误:无法计算左上角碎片的得分。") return False top_left_id = np.argmin(top_left_scores) # 得分最小的作为左上角 print(f"选择左上角碎片: {self.fragments[top_left_id]['filename']}") ``` ### 其他建议 - 由于中文碎片是文字,且排列规则(横排),可以考虑使用投影法(水平投影和垂直投影)来辅助定位碎片的位置。 - 如果碎片图像确实无法读取,需要检查文件路径是否正确,以及文件是否损坏。 ### 重新运行 在修改代码后,重新运行程序。如果文件路径正确且文件可读,那么碎片应该被成功加载。如果仍然无法读取,则需要手动检查文件路径和文件内容。 ### 相关问题 §§相关问题§§: 1. 如何检查一个文件路径是否存在,以及如何列出目录中的所有文件? 2. 在OpenCV中,除了`cv2.imread`,还有哪些方法可以读取图像文件? 3. 当处理大量图像文件时,如何优化内存使用? 4. 对于二值图像,有哪些常用的特征提取方法用于图像拼接?</think>根据您提供的错误信息,程序在尝试重建中文碎片(附件3)时遇到了两个主要问题: 1. **文件读取失败**:所有碎片图像(000.bmp - 208.bmp)都无法打开 2. **索引越界错误**:在尝试访问左上角碎片时出现 `IndexError: list index out of range` ### 问题分析与解决方案 #### 1. 文件读取问题 错误信息表明所有图像文件都无法打开: ``` [ WARN:[email protected]] global loadsave.cpp:275 cv::findDecoder imread_('D:\学习文件\JM\2013B\附件3\000.bmp'): can't open/read file: check file path/integrity ``` 可能原因: - 文件路径不正确 - 文件格式不是标准BMP - 文件损坏或权限问题 **解决方案:** ```python import os from PIL import Image def load_fragments(folder_path): fragments = [] valid_files = [] for filename in os.listdir(folder_path): filepath = os.path.join(folder_path, filename) try: # 尝试用PIL打开(支持更多格式) img = Image.open(filepath) img = img.convert('L') # 转为灰度 fragments.append({ 'filename': filename, 'image': img, 'array': np.array(img) # 转为numpy数组 }) valid_files.append(filename) except Exception as e: print(f"无法读取 {filename}: {str(e)}") # 尝试二进制读取 try: with open(filepath, 'rb') as f: header = f.read(2) if header == b'BM': print(f"文件 {filename} 是BMP格式但无法打开,可能已损坏") else: print(f"文件 {filename} 不是标准BMP格式 (头字节: {header})") except Exception as bin_e: print(f"二进制读取失败: {str(bin_e)}") print(f"成功加载 {len(valid_files)}/{len(os.listdir(folder_path))} 个碎片") return fragments, valid_files ``` #### 2. 索引越界问题 错误发生在: ```python print(f"选择左上角碎片: {self.fragments[top_left_id]['filename']}") ``` 原因:`top_left_id` 计算有误或碎片列表为空 **解决方案:** ```python def find_top_left(fragments): if not fragments: print("错误:碎片列表为空") return None top_left_id = 0 min_score = float('inf') for i, frag in enumerate(fragments): # 获取图像数组 img = frag['array'] # 计算边界特征 top_edge = img[0, :] left_edge = img[:, 0] # 计算边界白色像素比例(假设背景是白色) top_white = np.mean(top_edge == 255) left_white = np.mean(left_edge == 255) # 左上角应有最高的白色比例 score = (1 - top_white) + (1 - left_white) if score < min_score: min_score = score top_left_id = i if top_left_id >= len(fragments): print(f"错误:无效的索引 {top_left_id} (最大索引: {len(fragments)-1})") return None print(f"选择左上角碎片: {fragments[top_left_id]['filename']}") return top_left_id ``` ### 完整修复建议 ```python import os import numpy as np from PIL import Image import cv2 from tqdm import tqdm class FragmentReconstructor: def __init__(self, folder_path): self.folder = folder_path self.fragments = [] self.similarity_matrix = None self.visited = None self.rows = 0 self.cols = 0 def load_fragments(self): print(f"正在加载碎片图像从: {self.folder}") self.fragments = [] for filename in tqdm(os.listdir(self.folder)): if not filename.lower().endswith(('.bmp', '.png', '.jpg', '.jpeg')): continue filepath = os.path.join(self.folder, filename) try: # 尝试用PIL打开 img = Image.open(filepath) img = img.convert('L') # 转为灰度 binary = np.array(img) > 128 # 二值化 self.fragments.append({ 'filename': filename, 'image': np.array(img), 'binary': binary.astype(np.uint8) * 255 }) except: try: # 尝试OpenCV作为备选 img = cv2.imread(filepath, cv2.IMREAD_GRAYSCALE) if img is None: raise ValueError("OpenCV返回None") _, binary = cv2.threshold(img, 128, 255, cv2.THRESH_BINARY) self.fragments.append({ 'filename': filename, 'image': img, 'binary': binary }) except Exception as e: print(f"无法读取图像 {filename}: {str(e)}") print(f"成功加载 {len(self.fragments)} 个碎片") return len(self.fragments) > 0 def calculate_similarity(self, frag1, frag2, direction): """计算两个碎片的相似度""" # 实现你的相似度计算逻辑 # 示例:计算边界像素匹配度 if direction == 'right': edge1 = frag1['binary'][:, -1] edge2 = frag2['binary'][:, 0] elif direction == 'bottom': edge1 = frag1['binary'][-1, :] edge2 = frag2['binary'][0, :] else: return 0 return np.mean(edge1 == edge2) def find_top_left(self): if not self.fragments: return -1 top_left_id = 0 min_score = float('inf') for i, frag in enumerate(self.fragments): # 计算左上角得分(上边界和左边界应主要为背景) top_edge = frag['binary'][0, :] left_edge = frag['binary'][:, 0] # 假设背景为白色(255) top_score = np.sum(top_edge != 255) left_score = np.sum(left_edge != 255) total_score = top_score + left_score if total_score < min_score: min_score = total_score top_left_id = i return top_left_id def reconstruct_grid(self): if not self.fragments: print("错误:没有碎片可供重建") return False # 估计网格大小(假设为正方形网格) total = len(self.fragments) self.cols = int(np.sqrt(total)) self.rows = total // self.cols print(f"估计网格大小: {self.rows}行 x {self.cols}列") # 找到左上角碎片 top_left_id = self.find_top_left() if top_left_id == -1: print("无法确定左上角碎片") return False print(f"选择左上角碎片: {self.fragments[top_left_id]['filename']}") # 重建逻辑(伪代码) grid = [[None] * self.cols for _ in range(self.rows)] used = set() # 实现你的重建算法... # 示例:从左上角开始,向右和向下匹配 return True # 使用示例 if __name__ == "__main__": folder_path = r"D:\学习文件\JM\2013B\附件3" reconstructor = FragmentReconstructor(folder_path) if reconstructor.load_fragments(): reconstructor.reconstruct_grid() ``` ### 关键修复点解释 1. **多格式支持**: - 使用PIL作为主要图像加载器(支持更多格式) - 添加OpenCV作为备选方案 - 详细的错误报告帮助诊断问题 2. **鲁棒的左上角检测**: - 基于边界像素统计而非简单索引 - 添加空列表检查 - 分数计算更符合左上角特征 3. **错误处理**: - 所有关键操作添加空值检查 - 提供详细的错误信息 - 防止索引越界崩溃 ### 文件路径问题排查建议 1. 手动检查路径是否存在: ```python print(f"路径是否存在: {os.path.exists(r'D:\学习文件\JM\2013B\附件3')}") ``` 2. 检查文件列表: ```python files = os.listdir(r'D:\学习文件\JM\2013B\附件3') print(f"找到 {len(files)} 个文件,前5个: {files[:5]}") ``` 3. 验证文件头(前2字节应为"BM"表示BMP): ```python with open(r'D:\学习文件\JM\2013B\附件3\000.bmp', 'rb') as f: header = f.read(2) print(f"文件头: {header}") # 应为b'BM' ```

AttributeError: module 'cv2.aruco' has no attribute 'DetectorParameters_create' 07-09 13:59:32.994 DEBUG [test_ae_awb_regions]#teardown_test >>> BEGIN >>> 07-09 13:59:32.994 DEBUG [test_ae_awb_regions]#teardown_test <<< END <<< 07-09 13:59:32.994 DEBUG [test_ae_awb_regions]#on_fail >>> BEGIN >>> 07-09 13:59:32.995 DEBUG test_ae_awb_regions on FAIL. 07-09 13:59:32.995 DEBUG [test_ae_awb_regions]#on_fail <<< END <<< 07-09 13:59:32.995 INFO [Test] test_ae_awb_regions ERROR 07-09 13:59:33.004 DEBUG [AeAwbRegions]#teardown_class >>> BEGIN >>> 07-09 13:59:33.004 DEBUG summary_writer._path: /tmp/CameraITS_kdj2u4ki/cam_id_0/scene8/TEST_BED_TABLET_SCENES/07-09-2025_13-59-14-070/test_summary.yaml 07-09 13:59:33.004 DEBUG [AeAwbRegions]#teardown_class <<< END <<< 07-09 13:59:33.004 DEBUG [AeAwbRegions]#clean_up >>> BEGIN >>> 07-09 13:59:33.007 DEBUG cmd: 'fastboot devices ', stdout: b'', stderr: b'/bin/sh: 1: fastboot: not found\n', ret: 127 07-09 13:59:33.009 DEBUG cmd: 'fastboot devices ', stdout: b'', stderr: b'/bin/sh: 1: fastboot: not found\n', ret: 127 07-09 13:59:33.012 DEBUG cmd: 'fastboot devices ', stdout: b'', stderr: b'/bin/sh: 1: fastboot: not found\n', ret: 127 07-09 13:59:33.014 DEBUG cmd: 'fastboot devices ', stdout: b'', stderr: b'/bin/sh: 1: fastboot: not found\n', ret: 127 07-09 13:59:33.017 DEBUG cmd: 'fastboot devices ', stdout: b'', stderr: b'/bin/sh: 1: fastboot: not found\n', ret: 127 07-09 13:59:33.019 DEBUG cmd: 'fastboot devices ', stdout: b'', stderr: b'/bin/sh: 1: fastboot: not found\n', ret: 127 07-09 13:59:33.022 DEBUG cmd: 'fastboot devices ', stdout: b'', stderr: b'/bin/sh: 1: fastboot: not found\n', ret: 127 07-09 13:59:33.024 DEBUG cmd: 'fastboot devices ', stdout: b'', stderr: b'/bin/sh: 1: fastboot: not found\n', ret: 127 07-09 13:59:33.040 DEBUG Destroying android_device. 07-09 13:59:33.041 DEBUG Stopping standing subprocess 141931 07-09 13:59:33.067 DEBUG Stopped standing subprocess 141931 07-09 13:59:33.067 DEBUG Stopping standing subprocess 141951 07-09 13:59:33.084 DEBUG Stopped standing subprocess 141951 07-09 13:59:33.084 DEBUG [AeAwbRegions]#clean_up <<< END <<< 07-09 13:59:33.084 INFO Summary for test class AeAwbRegions: Error 1, Executed 1, Failed 0, Passed 0, Requested 1, Skipped 0 07-09 13:59:33.085 INFO Summary for test run TEST_BED_TABLET_SCENES@07-09-2025_13-59-14-070: Total time elapsed 19.014907349002897s Artifacts are saved in "/tmp/CameraITS_kdj2u4ki/cam_id_0/scene8/TEST_BED_TABLET_SCENES/07-09-2025_13-59-14-070" Test summary saved in "/tmp/CameraITS_kdj2u4ki/cam_id_0/scene8/TEST_BED_TABLET_SCENES/07-09-2025_13-59-14-070/test_summary.yaml" Test results: Error 1, Executed 1, Failed 0, Passed 0, Requested 1, Skipped 0

<think>首先,用户的问题是:“请使用中文回答问题”,然后提供了一段日志输出。日志中包含错误信息:“AttributeError: module 'cv2.aruco' has no attribute 'DetectorParameters_create'”,以及一些调试信息。 用户要求我:1. 使用中文回答问题。2. 在回答完问题后,必须根据用户的问题及我的回答提出3-5个 §§相关问题§§。3. §§相关问题§§ 必须输出在回答的末尾,第一行必须完整输出 "§§相关问题§§",禁止换行分散。 示例格式显示,回答应该包括对问题的解释或解决建议,然后是代码块(如果需要),最后是相关问题。 核心问题是日志中的错误:"AttributeError: module 'cv2.aruco' has no attribute 'DetectorParameters_create'"。这看起来是Python代码中的错误,涉及到OpenCV的ArUco模块。 ArUco是OpenCV中用于增强现实的一个模块,用于检测和识别标记。这个错误表明代码试图调用`cv2.aruco.DetectorParameters_create()`,但该属性不存在。 在较新版本的OpenCV中,ArUco模块的API发生了变化。在旧版本中(如OpenCV 3.x),`DetectorParameters_create()`是存在的,但在OpenCV 4.x中,它被弃用或更改了。 在OpenCV 4.x中,推荐使用`cv2.aruco.DetectorParameters()`或`cv2.aruco.DetectorParameters_create()`可能被移除或重命名。具体来说,在OpenCV 4.7.0中,我检查了文档,它应该是`cv2.aruco.DetectorParameters()`。 可能的解决方案: - 如果使用的是旧版本OpenCV,尝试安装旧版本。 - 如果使用的是新版本,修改代码为使用新的API。例如,使用`cv2.aruco.DetectorParameters()`来创建参数对象。 日志中还显示了一些测试框架的信息,如"CameraITS",这表明这可能是一个相机测试套件中的错误。错误发生在测试"test_ae_awb_regions"中。 所以,我的回答应该: 1. 解释错误的原因。 2. 提供解决方案。 3. 使用中文。 4. 在末尾添加3-5个相关问题。 回答结构: - 先描述错误。 - 解释原因。 - 给出修复建议。 - 然后输出相关问题。 相关问题应该基于用户的问题和我的回答。例如: 1. 如何检查OpenCV的版本? 2. 如何更新代码以使用新的ArUco API? 3. 这个错误如何影响整个测试套件? 4. 有没有其他常见的OpenCV API变化? 5. 如何调试类似的问题? 确保相关问题数量在3-5个。 最后,第一行必须是"§§相关问题§§",然后列出问题,用数字点,如"1. ..."。 完整回答: - 开头用中文解释。 - 不需要代码块,除非必要。这里可能不需要,因为错误是API变化。 - 结尾是相关问题。</think>根据您提供的日志信息,核心错误是 `AttributeError: module 'cv2.aruco' has no attribute 'DetectorParameters_create'`。这表示在 Python 代码中尝试调用 OpenCV 的 ArUco 模块时,找不到 `DetectorParameters_create` 属性。以下是详细分析和解决方案: ### 错误原因: - **API 变更**:在 OpenCV 4.x 及以上版本中,ArUco 模块的 API 已更新。旧方法 `DetectorParameters_create()` 被弃用或移除,新版本应使用 `cv2.aruco.DetectorParameters()` 或 `cv2.aruco.getDetectorParameters()`。 - **环境不匹配**:您的代码可能基于旧版 OpenCV (如 3.x) 编写,但当前环境安装的是新版 OpenCV (如 4.7.0),导致兼容性问题。 - **上下文影响**:日志显示错误发生在测试用例 `test_ae_awb_regions` 中(属于 `AeAwbRegions` 测试类),这可能是相机测试套件(如 CameraITS)的一部分。错误导致测试失败(状态为 ERROR),并触发清理流程(如 `fastboot` 命令未找到)。 ### 解决方案: 1. **检查 OpenCV 版本**: - 运行 `pip show opencv-python` 或 `cv2.__version__` 确认版本。如果版本 >= 4.0,需更新代码。 2. **修改代码适配新 API**: - 替换 `cv2.aruco.DetectorParameters_create()` 为 `cv2.aruco.DetectorParameters()`。 - 示例修正: ```python # 旧代码(引发错误) # parameters = cv2.aruco.DetectorParameters_create() # 新代码(兼容 OpenCV 4.x) parameters = cv2.aruco.DetectorParameters() ``` 3. **降级 OpenCV(临时方案)**: - 若需兼容旧代码,安装旧版:`pip install opencv-python==3.4.20`。 4. **测试环境修复**: - 确保测试框架(如 CameraITS)依赖项一致。检查 `fastboot` 是否安装(日志显示 `fastboot: not found`),这可能影响设备清理流程。 ### 其他日志分析: - 测试失败原因为此错误,导致整个测试类 `AeAwbRegions` 结果为 ERROR(1 个测试失败)。 - 清理阶段出现 `fastboot` 未找到(`ret: 127`),建议检查设备连接和 ADB/Fastboot 工具安装。 - 最终测试摘要保存在 `/tmp/CameraITS_.../test_summary.yaml`,错误信息可在此文件追踪。
阅读全文

相关推荐

#include <iostream> #include "SerialPort.hpp" #include "Vision.hpp" #include <cstring> #include <string> #include "pid.hpp" #include <stdio.h> #include <cmath> extern SP::SerialPort serial; // 修改为你的串口设备 extern char msg[6]; //extern pid::PIDCLASS pid1; pid::PIDCLASS pid1( 1.40F, 0, 0.060F, 100.0F, 100.0F, -100.0F, 0.040F ); double th = 20;/* 二值化阈值 */ float Xposition = 0; float pidoutput = 0; int pidoutINT = 0; u_int8_t MX = 125; char STR[20]={0}; int main() { cv::VideoCapture Camera01;/* 定义相机 */ cv::Mat Picture0,Picture_B,Picture_Gray,inary,Picture_Binary_Deal,Picture_Binary_Deal_ROI, Picture_Binary_Deal_ROI_L,Picture_Binary_Deal_ROI_R,Picture_Binary;/* 定义图片 */ Camera01.open(0);/* 打开系统视频设备0 */ if( !Camera01.isOpened() ){std::cout<<"初始化时相机打开失败"<<std::endl;return -1;}/* 相机打开失败时 结束程序 */ Camera01.set(cv::CAP_PROP_FRAME_WIDTH,320);/* 设置相机分辨率 */ Camera01.set(cv::CAP_PROP_FRAME_HEIGHT,240); //uart_init(); uart_init(); while( Camera01.read(Picture0) ){ /* 读取图片到Picture0 */ int keyvalue = 0; usleep(40000);/* 40000us=40ms 休眠 */ cv::cvtColor(Picture0, Picture_Gray, cv::COLOR_BGR2GRAY);/* 灰度化 */ cv::threshold(Picture_Gray, Picture_Binary, th, 255, cv::THRESH_BINARY_INV); // 反二值化,黑线变白 cv::Mat Picture_element = cv::getStructuringElement(cv::MORPH_RECT,cv::Size(5,5));//形态学操作 cv::morphologyEx(Picture_Binary, Picture_Binary_Deal, cv::MORPH_OPEN, Picture_element);//开运算 cv::Rect rect_roizone = cv::Rect(0,Picture_Binary_Deal.size().height/2, Picture_Binary_Deal.size().width,Picture_Binary_Deal.size().height/2); Picture_Binary_Deal_ROI = Picture_Binary_Deal( rect_roizone ); /* 设定两个ROI */ cv::Rect rect_roizone_Left = cv::Rect(0,0, Picture_Binary_Deal_ROI.size().width/2,Picture_Binary_Deal_ROI.size().height); cv::Rect rect_roizone_Right = cv::Rect( Picture_Binary_Deal_ROI.size().width/2 , 0 , Picture_Binary_Deal_ROI.size().width/2,Picture_Binary_Deal_ROI.size().height); Picture_Binary_Deal_ROI_L = Picture_Binary_Deal_ROI( rect_roizone_Left );/* 设定下半部分屏幕1/3 2/3区域为ROI */ Picture_Binary_Deal_ROI_R = Picture_Binary_Deal_ROI( rect_roizone_Right ); cv::Moments Moment1 = cv::moments(Picture_Binary_Deal_ROI,true);/* 算质心 */ cv::Moments Moment1L = cv::moments(Picture_Binary_Deal_ROI_L,true);/* 算左侧质心 */ cv::Moments Moment1R = cv::moments(Picture_Binary_Deal_ROI_R,true);/* 算右侧质心 */ float XmL = (float)(Moment1L.m10/Moment1L.m00), XmR = (float)(Moment1R.m10/Moment1R.m00); float temp= (float)(Moment1.m10/Moment1.m00); if( std::isnan(temp) ){ Xposition=0; } else{Xposition = temp;} //Xposition = /* 获得车道的X坐标 */ cv::Point p01( Xposition, Moment1.m01/Moment1.m00 + Picture_Binary.size().height/2);/* 求质心点 */ //cv::Point p01(Moment1.m10/Moment1.m00,Picture_Binary_Deal.size().height/2+Picture_Binary.size().height/2);/* 质心 */ pidoutput = pid1.pidf( (float)(Picture_Binary.size().width/2),(float)(Xposition) ); pidoutINT = (int)(pidoutput); std::cout << "pidout:"<0 50-> -70 由于\0是字符串结束符 故不能发送0 */ if(MX<1){ MX=1;}if(MX>255){MX=255;} sprintf(STR,"pidour:%d ",pidoutINT); cv::Point p03( XmL , Picture_Binary.size().height/2+Moment1L.m01/Moment1L.m00); cv::Point p04( Picture_Binary.size().width/2+XmR , Picture_Binary.size().height/2+Moment1R.m01/Moment1R.m00); cv::Point p00( Picture_Binary.size().width/2 , Picture_Binary.size().height ); cv::Point p02( Picture_Binary.size().width/2 + pidoutINT, Moment1.m01/Moment1.m00 + Picture_Binary.size().height/2);/* pid输出以点的形式呈现 */ cv::rectangle(Picture0,rect_roizone,cv::Scalar(165,0,0),2); cv::circle(Picture0, p02, 4, cv::Scalar(255, 0, 0), 2);/* 画点 */ cv::circle(Picture0, p01, 8, cv::Scalar(0, 255, 0), 2);/* 画点 */ cv::circle(Picture0, p03, 5, cv::Scalar(200, 233, 0), 1);/* 画左侧质心点 */ cv::circle(Picture0, p04, 5, cv::Scalar(200, 233, 0), 1);/* 画右侧质心点 */ std::cout << "XmL="<<XmL <<" XmR="<< (Picture_Binary.size().width/2+XmR) << std::endl; if( (!std::isnan(XmL)) && (!std::isnan(XmR) )&& (abs(XmL - XmR) > 100.0)) { //std::cout << "两条路" << std::endl; cv::line( Picture0, p00, p03, cv::Scalar(255, 0, 0), 1 ); } cv::line(Picture0, cv::Point( Picture0.size().width/2 , 0 ), cv::Point(Picture0.size().width/2, Picture0.size().height), cv::Scalar(0, 0, 200));/* 画中线 */ cv::putText(Picture0,STR,cv::Point(4,25),cv::FONT_HERSHEY_SIMPLEX,0.5,cv::Scalar_(200,200,100),2,8 ) ; //cv::imshow("WightBlackPic",Picture_Binary_Deal);/* 显示图片 */ cv::imshow("CapPicture",Picture0);/* 显示图片 */ cv::imshow("ROI",Picture_Binary_Deal_ROI);/* 显示图片 */ cv::imshow("ROI_Left",Picture_Binary_Deal_ROI_L); cv::imshow("ROI_Right",Picture_Binary_Deal_ROI_R); cv::moveWindow("ROI",450,0);cv::moveWindow("ROI_Left",450,160);cv::moveWindow("ROI_Right",450+320,160); cv::moveWindow("CapPicture",0,0); if( cv::waitKey(1) == 'q' ){std::cout<<"检测到按下q退出"<<std::endl;return 1;}/* 图片显示停留1ms 除非检测到按键'q' 退出程序 */ msg[0]='S'; msg[1]=MX; msg[2]=0xFF; msg[3]=0xFF; msg[4]='E'; //msg[5]=0; uart(); } return 0; }

大家在看

recommend-type

Xilinx ISE rs_decoder_ipcore and encoder License

Xilinx ISE RS编码解码IP核的License
recommend-type

毕业设计&课设-一个基于Matlab的PET仿真和重建框架,具有系统矩阵的分析建模,能够结合各种数据….zip

matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随
recommend-type

MATLAB机械臂简单控制仿真(Simulink篇-总).zip

MATLAB下机器人可视化与控制---simulink篇中的简单例子,在Simulink中做了预定义轨迹的运动和Slider Gain控制的运动,用GUI控制的关节代码在MATLAB下机器人可视化与控制
recommend-type

使用 GCC 构建 STM23F0 ARM 项目的模板源码

使用 GCC 构建 STM23F0 ARM 项目的模板源码,具体请看 README
recommend-type

详细说明 VC++的MFC开发串口调试助手源代码,包括数据发送,接收,显示制式等29782183com

详细说明 VC++的MFC开发串口调试助手源代码,包括数据发送,接收,显示制式等29782183com

最新推荐

recommend-type

win7下 python3.6 安装opencv 和 opencv-contrib-python解决 cv2.xfeatures2d.SIFT_create() 的问题

在Windows 7环境下,使用Python 3.6开发计算机视觉应用时,可能会遇到无法创建SIFT(Scale-Invariant Feature Transform)特征检测器的问题,即`cv2.xfeatures2d.SIFT_create()`函数调用失败。这通常是由于OpenCV库...
recommend-type

win10下opencv-python特定版本手动安装与pip自动安装教程

在Windows 10环境下安装OpenCV-Python,无论是特定版本还是最新版本,都可以通过手动安装和pip自动安装两种方式进行。这两种方法各有优劣,适用于不同的使用场景。 首先,我们来看如何进行特定版本的手动安装。在...
recommend-type

详解python opencv、scikit-image和PIL图像处理库比较

在Python中,图像处理是许多领域,如计算机视觉、机器学习和数据分析的重要组成部分。本文将对三个常用的图像处理库——OpenCV、scikit-image和PIL(或其更新版本Pillow)进行比较,以帮助开发者选择最适合自己的...
recommend-type

解决pycharm中opencv-python导入cv2后无法自动补全的问题(不用作任何文件上的修改)

在PyCharm中使用OpenCV库时,有时可能会遇到导入`cv2`模块后无法享受到自动补全功能的问题。这可能会对开发效率造成一定影响,因为自动补全能帮助我们快速编写代码并减少错误。本篇文章将详细讲解如何在不修改任何...
recommend-type

计算机网络学习中学员常见问题与改进方法

计算机网络学习中学员常见问题与改进方法+
recommend-type

美国国际航空交通数据分析报告(1990-2020)

根据给定的信息,我们可以从中提取和分析以下知识点: 1. 数据集概述: 该数据集名为“U.S. International Air Traffic data(1990-2020)”,记录了美国与国际间航空客运和货运的详细统计信息。数据集涵盖的时间范围从1990年至2020年,这说明它包含了长达30年的时间序列数据,对于进行长期趋势分析非常有价值。 2. 数据来源及意义: 此数据来源于《美国国际航空客运和货运统计报告》,该报告是美国运输部(USDOT)所管理的T-100计划的一部分。T-100计划旨在收集和发布美国和国际航空公司在美国机场的出入境交通报告,这表明数据的权威性和可靠性较高,适用于政府、企业和学术研究等领域。 3. 数据内容及应用: 数据集包含两个主要的CSV文件,分别是“International_Report_Departures.csv”和“International_Report_Passengers.csv”。 a. International_Report_Departures.csv文件可能包含了以下内容: - 离港航班信息:记录了各航空公司的航班号、起飞和到达时间、起飞和到达机场的代码以及国际地区等信息。 - 航空公司信息:可能包括航空公司代码、名称以及所属国家等。 - 飞机机型信息:如飞机类型、座位容量等,这有助于分析不同机型的使用频率和趋势。 - 航线信息:包括航线的起始和目的国家及城市,对于研究航线网络和优化航班计划具有参考价值。 这些数据可以用于航空交通流量分析、机场运营效率评估、航空市场分析等。 b. International_Report_Passengers.csv文件可能包含了以下内容: - 航班乘客信息:可能包括乘客的国籍、年龄、性别等信息。 - 航班类型:如全客机、全货机或混合型航班,可以分析乘客运输和货物运输的比例。 - 乘客数量:记录了各航班或航线的乘客数量,对于分析航空市场容量和增长趋势很有帮助。 - 飞行里程信息:有助于了解国际间不同航线的长度和飞行距离,为票价设置和燃油成本分析提供数据支持。 这些数据可以用于航空客运市场分析、需求预测、收益管理等方面。 4. 数据分析和应用实例: - 航空流量分析:通过分析离港航班数据,可以观察到哪些航线最为繁忙,哪些机场的国际航空流量最大,这有助于航空公司调整航班时刻表和运力分配。 - 市场研究:乘客数据可以揭示不同国家和地区之间的人口流动趋势,帮助航空公司和政府机构了解国际旅行市场的需求变化。 - 飞机利用率:结合飞机机型和飞行频率信息,可以对特定机型的使用率进行分析,评估飞机维护需求和燃油效率。 - 安全监管:通过对比不同航空公司和航班的安全记录,监管机构可以更有效地评估航空公司的安全性能,并采取必要的监管措施。 5. 技术和方法论: 分析此类数据通常涉及数据清洗、数据整合、统计分析、时间序列分析、预测建模等数据科学方法。使用Excel、SQL、R、Python等工具进行数据处理和分析是常见的做法。例如,可以使用Python的Pandas库来清洗和准备数据,使用Matplotlib和Seaborn库来可视化数据,然后利用Scikit-learn或Statsmodels库来构建预测模型。 通过以上知识点的提取和分析,我们可以理解到“U.S. International Air Traffic data(1990-2020)-数据集”的重要性,它不仅记录了跨越30年的航空交通数据,还为各种分析和应用提供了详实的基础信息。对于航空业从业者、政策制定者、研究人员以及数据分析师来说,这是一个极具价值的数据资源。
recommend-type

统计学视角:深入理解最小二乘法的概率论基础

# 1. 最小二乘法的基本概念 最小二乘法(Least Squares Method, LSM)是统计学和数据分析中广泛使用的一种数学优化技术。其主要目的是通过最小化误差的平方和来寻找数据的最佳函数匹配。这种方法最早由高斯提出,但在工程、物理、经济和其他领域中有着广泛的应用。 在本章中,我们将首先了
recommend-type

vscode中使用Codeium

<think>好的,我需要回答用户如何在VSCode中使用Codeium插件的问题。首先,我需要回顾用户提供的引用内容,看看是否有相关信息。用户提供的引用[1]提到了Codeium Chat可以解释代码中的问题,引用[2]提到了在IDEA中的一些问题,可能对VSCode的安装有帮助。用户还提到了安装步骤、基本功能、常见问题等。 首先,我应该分步骤说明安装过程,包括在VSCode扩展商店搜索Codeium并安装。然后,登录部分可能需要用户访问仪表板获取API密钥,引用[2]中提到登录问题,可能需要提醒用户注意网络或权限设置。 接下来是基本功能,比如代码自动补全和Chat功能。引用[1]提到C
recommend-type

UniMoCo:统一框架下的多监督视觉学习方法

在详细解析“unimoco”这个概念之前,我们需要明确几个关键点。首先,“unimoco”代表的是一种视觉表示学习方法,它在机器学习尤其是深度学习领域中扮演着重要角色。其次,文章作者通过这篇论文介绍了UniMoCo的全称,即“Unsupervised, Semi-Supervised and Full-Supervised Visual Representation Learning”,其背后的含义是在于UniMoCo框架整合了无监督学习、半监督学习和全监督学习三种不同的学习策略。最后,该框架被官方用PyTorch库实现,并被提供给了研究者和开发者社区。 ### 1. 对比学习(Contrastive Learning) UniMoCo的概念根植于对比学习的思想,这是一种无监督学习的范式。对比学习的核心在于让模型学会区分不同的样本,通过将相似的样本拉近,将不相似的样本推远,从而学习到有效的数据表示。对比学习与传统的分类任务最大的不同在于不需要手动标注的标签来指导学习过程,取而代之的是从数据自身结构中挖掘信息。 ### 2. MoCo(Momentum Contrast) UniMoCo的实现基于MoCo框架,MoCo是一种基于队列(queue)的对比学习方法,它在训练过程中维持一个动态的队列,其中包含了成对的负样本。MoCo通过 Momentum Encoder(动量编码器)和一个队列来保持稳定和历史性的负样本信息,使得模型能够持续地进行对比学习,即使是在没有足够负样本的情况下。 ### 3. 无监督学习(Unsupervised Learning) 在无监督学习场景中,数据样本没有被标记任何类别或标签,算法需自行发现数据中的模式和结构。UniMoCo框架中,无监督学习的关键在于使用没有标签的数据进行训练,其目的是让模型学习到数据的基础特征表示,这对于那些标注资源稀缺的领域具有重要意义。 ### 4. 半监督学习(Semi-Supervised Learning) 半监督学习结合了无监督和有监督学习的优势,它使用少量的标注数据与大量的未标注数据进行训练。UniMoCo中实现半监督学习的方式,可能是通过将已标注的数据作为对比学习的一部分,以此来指导模型学习到更精准的特征表示。这对于那些拥有少量标注数据的场景尤为有用。 ### 5. 全监督学习(Full-Supervised Learning) 在全监督学习中,所有的训练样本都有相应的标签,这种学习方式的目的是让模型学习到映射关系,从输入到输出。在UniMoCo中,全监督学习用于训练阶段,让模型在有明确指示的学习目标下进行优化,学习到的任务相关的特征表示。这通常用于有充足标注数据的场景,比如图像分类任务。 ### 6. PyTorch PyTorch是一个开源机器学习库,由Facebook的人工智能研究团队开发,主要用于计算机视觉和自然语言处理等任务。它被广泛用于研究和生产环境,并且因其易用性、灵活性和动态计算图等特性受到研究人员的青睐。UniMoCo官方实现选择PyTorch作为开发平台,说明了其对科研社区的支持和对易于实现的重视。 ### 7. 可视化表示学习(Visual Representation Learning) 可视化表示学习的目的是从原始视觉数据中提取特征,并将它们转换为能够反映重要信息且更易于处理的形式。在UniMoCo中,无论是无监督、半监督还是全监督学习,最终的目标都是让模型学习到有效的视觉表示,这些表示可以用于下游任务,如图像分类、目标检测、图像分割等。 ### 8. 标签队列(Label Queue) UniMoCo通过标签队列维护受监管的标签,这可能意味着对于那些半监督或全监督学习的任务,模型在进行对比学习时,会参考这些来自标签队列的数据。标签队列机制能帮助模型更好地利用有限的标注数据,增强模型的泛化能力。 ### 结论 UniMoCo的提出,以及其官方PyTorch实现的发布,将对计算机视觉领域产生深远影响。它不仅提供了一个统一的对比学习框架,使得从无监督到全监督的学习过程更加灵活和高效,而且为研究者们提供了一个强力的工具,以便更好地探索和实现各种视觉任务。UniMoCo的研究和应用前景,为机器学习尤其是深度学习在视觉领域的研究和实践提供了新的视角和可能。
recommend-type

【MATLAB算法精讲】:最小二乘法的实现与案例深度分析

# 1. 最小二乘法的基本原理 最小二乘法是一种数学优化技术,它通过最小化误差的平方和来寻找数据的最佳函数匹配。其核心思想是选择一条曲线,使得所有观察点到这条曲线的距离之和最小。这种方法广泛应用于统计学、信号处理、工程学和经济学等领域,尤其适用于需要通过一组数据点来确定函数参数的情况。 ## 1.1 统计学视角下的最小二乘法 在统计学中,最小二乘法经常用于