parse error EXpected"("got new line with text
时间: 2024-04-12 10:34:30 浏览: 280
看起来是在/opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeconfig.cmake文件的第113行有一个语法错误。它期望一个"("符号,但实际上得到的是一个换行符和一些文本。
请检查cv_bridgeconfig.cmake文件的第113行,并确保语法正确。可能需要添加或修改一些符号或文本以解决这个问题。如果你能提供更多的上下文或代码段,我可能能够提供更具体的帮助。
相关问题
CMake Error at CMakeLists.txt:125: Parse error. Expected "(", got unquoted argument with text "catkin_DIR=/path/to/catkinConfig.cmake/directory".
I apologize for the confusion. The error you encountered is due to incorrect syntax in the CMakeLists.txt file. To resolve this issue, you need to update the CMakeLists.txt file with the correct syntax for setting the "catkin_DIR" variable.
Here's the correct syntax for setting the "catkin_DIR" variable in the CMakeLists.txt file:
```cmake
set(catkin_DIR "/path/to/catkinConfig.cmake/directory")
```
Replace "/path/to/catkinConfig.cmake/directory" with the actual path to the directory containing "catkinConfig.cmake".
Make sure to place this line of code before the line where the error is occurring (at line 125 in your case). After making this change, try building your project again.
Traceback (most recent call last): File "D:\python project\tommyself.py", line 28, in <module> borders = cv2.boxPoints(borders) cv2.error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'boxPoints' > Overload resolution failed: > - Can't parse 'box' as RotatedRect. Expected sequence length 3, got 4 > - Can't parse 'box' as RotatedRect. Expected sequence length 3, got 4 这段代码出现了以下报错应该怎么改
这个报错可能是因为 `cv2.boundingRect()` 返回的 `borders` 数组长度不正确,导致在调用 `cv2.boxPoints()` 函数时出错。
你可以检查一下 `borders` 数组的长度是否为 4,如果是的话,你可以尝试修改代码为:
```
# 获取边框
x, y, w, h = cv2.boundingRect(opened)
borders = np.array([[x, y], [x, y+h], [x+w, y+h], [x+w, y]])
# 绘制边框线
cv2.polylines(frame, [borders], True, (0, 0, 255), 2)
# 获取边框线坐标
points = borders.reshape(4, 2)
```
这里使用 `cv2.boundingRect()` 函数返回的矩形的左上角坐标 `(x, y)`、宽度 `w` 和高度 `h` 来计算边框的四个顶点坐标,然后将这些坐标存储在一个 4x2 的数组中,并将其传递给 `cv2.polylines()` 函数来绘制边框线。
如果上述方法还是无法解决问题,你可以尝试升级 OpenCV 版本或者尝试其他的解决方案。
阅读全文