我刚刚开始学习opencv并使用python学习。
我找到了轮廓,但是我想切成三个区域,因为这是三个骰子
原始:
想要这样更改:
如何修复我的代码?
我将VS CODE与opencv4和python3一起使用
Traceback (most recent call last):
File "D:/PyCharm/exercise/numpy_exercise/pandas_py.py", line 1, in
<module>
import matplotlib.pyplot as plt
File "C:\Users\smile\AppData\Roaming\Python\Python37\site-
packages\matplotlib\__init__.py", line 143, in <module>
from matplotlib import ft2font
ImportError: cannot import name 'ft2font' from 'matplotlib'
(C:\Users\smile\AppData\Roaming\Python\Python37\site-
packages\matplotlib\__init__.py)
Error showing on Jupyter Notebook
<ipython-input-1-1842680e3d86> in <module>
1 import pandas as pd
2 import numpy as np
----> 3 import matplotlib.pyplot as plt
4 get_ipython().run_line_magic('matplotlib', 'inline')
5
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\pyplot.py in
<module>
30 from cycler import cycler
31 import matplotlib
---> 32 import matplotlib.colorbar
33 import matplotlib.image
34 from matplotlib import rcsetup, style
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\colorbar.py
in <module>
25
26 import matplotlib as mpl
---> 27 import matplotlib.artist as martist
28 import matplotlib.cbook as cbook
29 import matplotlib.collections as collections
ModuleNotFoundError: No module named 'matplotlib.artist'
答案 0 :(得分:1)
根据您的问题,我的解决方案是找到外部轮廓,然后将其分成3个相同大小的部分,因为您的对象具有相同的宽度。但通常,您必须提供更多测试图像。