Ask Your Question

Revision history [back]

Runing python Surface-Matching sample code leads to different result

I run the sample code of surface matching with python, but get the difference result with official website.

image description

here is my code:

def Match(modelname, surfacename, resultname): N = 2 detector = cv.ppf_match_3d_PPF3DDetector(0.025, 0.05) model = cv.ppf_match_3d.loadPLYSimple(modelname, 1) detector.trainModel(model) pcTest = cv.ppf_match_3d.loadPLYSimple(surfacename, 1) results = detector.match(pcTest, 1.0 / 40.0, 0.05) icp = cv.ppf_match_3d_ICP(100) _, results = icp.registerModelToScene(model, pcTest, results[:N]) for i, result in enumerate(results): print("\n-- Pose to Model Index %d: NumVotes = %d, Residual = %f\n%s\n" % ( result.modelIndex, result.numVotes, result.residual, result.pose)) if i == 0: pct = cv.ppf_match_3d.transformPCPose(model, result.pose) cv.ppf_match_3d.writePLY(pct, resultname)

and the model and scene I used

https://github.com/opencv/opencv_contrib/blob/master/modules/surface_matching/samples/data/parasaurolophus_6700.ply

https://github.com/opencv/opencv_contrib/blob/master/modules/surface_matching/samples/data/rs1_normals.ply

could any one give me some tips?

Runing python Surface-Matching sample code leads to different result

I run the sample code of surface matching with python, but get the difference result with official website.

image description

here is my code:

def Match(modelname, surfacename, resultname):
    N = 2
    detector = cv.ppf_match_3d_PPF3DDetector(0.025, 0.05)
    model = cv.ppf_match_3d.loadPLYSimple(modelname, 1)
    detector.trainModel(model)
    pcTest = cv.ppf_match_3d.loadPLYSimple(surfacename, 1)
    results = detector.match(pcTest, 1.0 / 40.0, 0.05)
    icp = cv.ppf_match_3d_ICP(100)
    _, results = icp.registerModelToScene(model, pcTest, results[:N])
    for i, result in enumerate(results):
        print("\n-- Pose to Model Index %d: NumVotes = %d, Residual = %f\n%s\n" % (
        result.modelIndex, result.numVotes, result.residual, result.pose))
        if i == 0:
            pct = cv.ppf_match_3d.transformPCPose(model, result.pose)
            cv.ppf_match_3d.writePLY(pct, resultname)

resultname)

and the model and scene I used

https://github.com/opencv/opencv_contrib/blob/master/modules/surface_matching/samples/data/parasaurolophus_6700.ply

https://github.com/opencv/opencv_contrib/blob/master/modules/surface_matching/samples/data/rs1_normals.ply

could any one give me some tips?

Runing python Surface-Matching sample code leads to different result

I run the sample code of surface matching with python, but get the difference result with official website.

image description

here is my code:

def Match(modelname, surfacename, resultname):
    N = 2
    detector = cv.ppf_match_3d_PPF3DDetector(0.025, 0.05)
    model = cv.ppf_match_3d.loadPLYSimple(modelname, 1)
    detector.trainModel(model)
    pcTest = cv.ppf_match_3d.loadPLYSimple(surfacename, 1)
    results = detector.match(pcTest, 1.0 / 40.0, 0.05)
    icp = cv.ppf_match_3d_ICP(100)
    _, results = icp.registerModelToScene(model, pcTest, results[:N])
    for i, result in enumerate(results):
        print("\n-- Pose to Model Index %d: NumVotes = %d, Residual = %f\n%s\n" % (
        result.modelIndex, result.numVotes, result.residual, result.pose))
        if i == 0:
            pct = cv.ppf_match_3d.transformPCPose(model, result.pose)
            cv.ppf_match_3d.writePLY(pct, resultname)

and the model and scene I used

https://github.com/opencv/opencv_contrib/blob/master/modules/surface_matching/samples/data/parasaurolophus_6700.ply

https://github.com/opencv/opencv_contrib/blob/master/modules/surface_matching/samples/data/rs1_normals.ply

could any one give me some tips?image description