import cv2
import numpy as np
import matplotlib.pyplot as plt

def roberts_operator(I):
    M, N, _ = I.shape
    GX = 0
    GY = 0
    FI = 0
    T = 0
    for x in range(1, M - 1):
        for y in range(1, N - 1):
            GX = I[x - 1, y + 1] + 2 * I[x, y + 1] + I[x + 1, y + 1] - I[x - 1, y - 1] - 2 * I[x, y - 1] - I[
                x + 1, y - 1]
            GY = I[x + 1, y - 1] + 2 * I[x + 1, y] + I[x + 1, y + 1] - I[x - 1, y - 1] - 2 * I[x - 1, y] - I[
                x - 1, y + 1]
            SXY = np.sqrt(GX ** 2 + GY ** 2)
            if np.any(SXY > T):
                FI = FI + SXY ** 2
    return FI

def tenengrad_operator(I):
    M, N, _ = I.shape
    FI = 0
    for x in range(0, M - 2):
        for y in range(0, N):
            F1 = I[x + 2, y] - I[x, y]
            FI += F1 * F1
    return FI

def plot_curves():
    N1 = 15
    A = np.zeros(N1)
    B = np.zeros(N1)
    X = np.zeros(N1)
    X2 = np.zeros(N1)

    for L in range(1, N1 + 1):
        I = cv2.imread(str(L) + '.jpg')
        I = np.double(I)

        FI_roberts = roberts_operator(I)
        A[L - 1] = np.sum(FI_roberts)

        FI_tenengrad = tenengrad_operator(I)
        B[L - 1] = np.sum(FI_tenengrad)

    C = np.max(A)
    D = np.min(A)
    E = C - D
    X = (A - D) / E

    C1 = np.max(B)
    D1 = np.min(B)
    E1 = C1 - D1
    X2 = (B - D1) / E1

    x1 = np.array([1, 7, 15, 27, 34, 46, 55, 64, 78, 82, 94, 101, 121, 134, 154])
    y1 = np.array([X[0], X[1], X[2], X[3], X[4], X[5], X[6], X[7], X[8], X[9], X[10], X[11], X[12], X[13], X[14]])
    y2 = np.array([X2[0], X2[1], X2[2], X2[3], X2[4],X2[5], X2[6], X2[7], X2[8], X2[9],X2[10], X2[11], X2[12], X2[13], X2[14]])

    plt.plot(x1, y1, color='green', linestyle='o-', label='roberts')
    plt.plot(x1, y2, color='blue', label='tenengrad')
    plt.legend()
    plt.show()

plot_curves()代码运行过程中遇到问题，Traceback (most recent call last):
  File "D:\pycharm\opencv\hehe2.py", line 67, in <module>
    plot_curves()
  File "D:\pycharm\opencv\hehe2.py", line 62, in plot_curves
    plt.plot(x1, y1, color='green', linestyle='o-', label='roberts')
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\pyplot.py", line 3578, in plot
    return gca().plot(
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\axes\_axes.py", line 1721, in plot
    lines = [*self._get_lines(self, *args, data=data, **kwargs)]
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\axes\_base.py", line 303, in __call__
    yield from self._plot_args(
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\axes\_base.py", line 539, in _plot_args
    return [l[0] for l in result]
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\axes\_base.py", line 539, in <listcomp>
    return [l[0] for l in result]
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\axes\_base.py", line 532, in <genexpr>
    result = (make_artist(axes, x[:, j % ncx], y[:, j % ncy], kw,
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\axes\_base.py", line 346, in _makeline
    seg = mlines.Line2D(x, y, **kw)
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\lines.py", line 372, in __init__
    self.set_linestyle(linestyle)
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\lines.py", line 1172, in set_linestyle
    _api.check_in_list([*self._lineStyles, *ls_mapper_r], ls=ls)
  File "D:\pycharm\opencv\venv\lib\site-packages\matplotlib\_api\__init__.py", line 129, in check_in_list
    raise ValueError(msg)
ValueError: 'o-' is not a valid value for ls; supported values are '-', '--', '-.', ':', 'None', ' ', '', 'solid', 'dashed', 'dashdot', 'dotted'