繁体   English   中英

python错误,尝试创建结构列表时语法无效

[英]error with python saying invalid syntax trying to create list of struct

在“相机后方交会”的关键帧中,我试图创建一个出现在帧中的点的列表,然后尝试创建一个包含以下帧中相应点的列表,以保持跟踪视频中的点以找到之间的K矩阵。他们。

我有以下课程存储每个框架中的点,并为每个框架创建一个点列表,并沿所有框架跟踪它们。

class PointsCorrespondence:
    """
    Stores the point of a specific index.
    """

    # A point is represented as (coordinate X, coordinate Y)
    Point = (float, float)

    # A point with corresponding same point is represented as (coordinates, index of the corresponding point or -1 if there is no corresponding point).
    PointWithCorrespondence = (Point, int)

    # Contains the points represented as one list of notable points for each frame.
    _pointsPerFrame : [[PointWithCorrespondence]]

    def __init__(self, pointsPerFrame : [[PointWithCorrespondence]]):
        self._pointsPerFrame = pointsPerFrame

当我尝试运行此代码以在其中存储点时,出现以下错误:

追溯(最近一次通话最后一次):导入pointTracking文件中的文件“ main.py”,第4行,行17中的“ /home/k/Desktop/CV/project/insertc/project12345/pointTracking.py”

 _pointsPerFrame : [[PointWithCorrespondence]] ^ SyntaxError: invalid syntax 

实际上,我不知道为什么会收到该错误,因此我尝试了很多方法来检查python语法样式。

我正在使用python 3.4

变量注释是Python 3.6中的新增功能 ,请参见例如新功能PEP-526 您将需要升级才能使用此语法。 注意,您正在为其他两个类属性分配 ,而不是注释类型 这大概是无意的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM