OpenCV for Android:非法转发引用



我使用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 Android 3.0和Java 7.80

您的声明顺序错误。应该是这样的:

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;

相关内容

  • 没有找到相关文章

最新更新