适用于Android的OpenCV:非法转发参考

时间:2015-10-10 05:31:32

标签: java android opencv forward-reference

我正在为我的项目使用OpenCV,除了DescriptorExtractor.java之外,一切正常。它每天都会出现以下错误:

/opencv/src/org/opencv/features2d/DescriptorExtractor.java
Error:(26, 29) error: illegal forward reference
Error:(27, 29) error: illegal forward reference
Error:(28, 28) error: illegal forward reference
Error:(29, 30) error: illegal forward reference
Error:(30, 30) error: illegal forward reference
Error:(31, 30) error: illegal forward reference
Error:(32, 30) error: illegal forward reference

该文件最初如下所示:

public class DescriptorExtractor {

    public static final int
            SIFT = 1,
            SURF = 2,
            ORB = 3,
            BRIEF = 4,
            BRISK = 5,
            FREAK = 6,
            AKAZE = 7,
            OPPONENT_SIFT = OPPONENTEXTRACTOR + SIFT,
            OPPONENT_SURF = OPPONENTEXTRACTOR + SURF,
            OPPONENT_ORB = OPPONENTEXTRACTOR + ORB,
            OPPONENT_BRIEF = OPPONENTEXTRACTOR + BRIEF,
            OPPONENT_BRISK = OPPONENTEXTRACTOR + BRISK,
            OPPONENT_FREAK = OPPONENTEXTRACTOR + FREAK,
            OPPONENT_AKAZE = OPPONENTEXTRACTOR + AKAZE;
    private static final int
            OPPONENTEXTRACTOR = 1000;
    protected final long nativeObj;

每天我都会将OPPONENTEXTRACTOR的声音移到课堂上,问题就消失了。但第二天课程恢复原状。在课堂上有一个评论

//
// This file is auto-generated. Please don't modify it!
//

我该怎么办?我该如何防止这种情况?

更新:

我正在使用OpenCV for Android 3.0和Java 7.80

1 个答案:

答案 0 :(得分:0)

您的申报顺序有误。应该是这样的:

private static final int OPPONENTEXTRACTOR = 1000;

public static final int
        SIFT = 1,
        SURF = 2,
        ORB = 3,
        BRIEF = 4,
        BRISK = 5,
        FREAK = 6,
        AKAZE = 7,
        OPPONENT_SIFT = OPPONENTEXTRACTOR + SIFT,
        OPPONENT_SURF = OPPONENTEXTRACTOR + SURF,
        OPPONENT_ORB = OPPONENTEXTRACTOR + ORB,
        OPPONENT_BRIEF = OPPONENTEXTRACTOR + BRIEF,
        OPPONENT_BRISK = OPPONENTEXTRACTOR + BRISK,
        OPPONENT_FREAK = OPPONENTEXTRACTOR + FREAK,
        OPPONENT_AKAZE = OPPONENTEXTRACTOR + AKAZE;