opencv中的SIFT无法正常工作

时间:2018-05-04 16:40:53

标签: opencv parameters sift

我在python中使用opencv和SIFT。

从典型示例开始,我确实遇到了具有明确(在我看来)场景中的对象的问题。这似乎是缩放的问题,或者可能只是错误的参数。

我尝试在此object中找到此image,但只获取此result

基本上我合作:

public void onFrameProcessed( ITextCaptureService.TextLine[] lines,
        ITextCaptureService.ResultStabilityStatus resultStatus, ITextCaptureService.Warning warning )
    {
        // Frame has been processed. Here we process recognition results. In this sample we
        // stop when we get stable result. This callback may continue being called for some time
        // even after the service has been stopped while the calls queued to this thread (UI thread)
        // are being processed. Just ignore these calls:
        if( !stableResultHasBeenReached ) {
            if( resultStatus.ordinal() >= 3 ) {
                // The result is stable enough to show something to the user
                surfaceViewWithOverlay.setLines( lines, resultStatus );

            } else {
                // The result is not stable. Show nothing
                surfaceViewWithOverlay.setLines( null, ITextCaptureService.ResultStabilityStatus.NotReady );
            }

            // Show the warning from the service if any. The warnings are intended for the user
            // to take some action (zooming in, checking recognition language, etc.)
            warningTextView.setText( warning != null ? warning.name() : "" );

            if( resultStatus == ITextCaptureService.ResultStabilityStatus.Stable ) {
                // Stable result has been reached. Stop the service
                stopRecognition();
                stableResultHasBeenReached = true;

                // Show result to the user. In this sample we whiten screen background and play
                // the same sound that is used for pressing buttons
                surfaceViewWithOverlay.setFillBackground( true );
                startButton.playSoundEffect( android.view.SoundEffectConstants.CLICK );
            }
        }
    }

我真的很绝望,因为有时(与其他类似的对象[统治者])它有效,有时不行,即使情况在视觉上清晰。

1 个答案:

答案 0 :(得分:1)

不确定是否可以使用SIFT或其他探测器/描述符对匹配您的对象和场景。你的物体是完美的黑白,但你的场景不是。

为了使用匹配的参数和方法,我推荐Find-Object(http://introlab.github.io/find-object/)。

也许你必须以某种方式准备你的场景图像。例如。使用阈值生成bw图像。我在图像中搜索Photomodeller标记(http://www.photomodeler.com/products/pm_automation.html)时这样做了。自适应阈值(https://docs.opencv.org/3.2.0/d7/d4d/tutorial_py_thresholding.html)效果最好。

您可能会看一下标记检测算法。例如https://docs.opencv.org/3.1.0/d5/dae/tutorial_aruco_detection.html。如果您的目标具有已知标记位置,则可以提取比例。