我正在尝试使用Apple的教程创建一个USDZ对象从照片创建三维对象。我在这个示例项目中使用了新的摄影测量会话:摄影测量命令行应用程序。
这就是代码:
let inputFolderUrl = URL(fileURLWithPath: "/tmp/MyInputImages/")
let url = URL(fileURLWithPath: "MyObject.usdz")
var request = PhotogrammetrySession.Request.modelFile(url: url,
detail: .full)
guard let session = try PhotogrammetrySession(input: inputFolderUrl) else {
return
}
我得到以下错误:
2021-06-12 21:53:56.968490+0200 HelloPhotogrammetry[15294:190841] ERROR cv3dapi.pg: Internal codes (1): 4011
2021-06-12 21:53:56.972113+0200 HelloPhotogrammetry[15294:190841] [Photogrammetry] No SfM map found in native output!
2021-06-12 21:53:56.972909+0200 HelloPhotogrammetry[15294:190841] [Photogrammetry] Got error in completion: reconstructionFailed(RealityFoundation.PhotogrammetrySession.Request.modelFile(url: OutputAR.usdz -- file:///Users/jonasdeichelmann/Library/Developer/Xcode/DerivedData/HelloPhotogrammetry-ghttmmgcrrhywqeebbrstrvxoikh/Build/Products/Debug/, detail: RealityFoundation.PhotogrammetrySession.Request.Detail.medium, geometry: nil), "Reconstruction failed!")
Request modelFile(url: OutputAR.usdz -- file:///Users/jonasdeichelmann/Library/Developer/Xcode/DerivedData/HelloPhotogrammetry-ghttmmgcrrhywqeebbrstrvxoikh/Build/Products/Debug/, detail: RealityFoundation.PhotogrammetrySession.Request.Detail.medium, geometry: nil) had an error: reconstructionFailed("Reconstruction failed!")
Processing is complete!
我使用的是M1 iMac,带有macOS Monterey 12.0 Beta(21A5248p(和Xcode 13.0 Beta(13A5154h(。
tl;dr:尝试另一组图像,可能是您的图像有问题。
除了一个例子,我已经成功地让它工作了,我收到了和你一样的错误。我想出于某种原因,它不喜欢我为那个特定物体拍摄的那组照片。你可以试着只拍摄另一个简单物体的几张照片,然后再试一次,看看这是否是你第一次跑步的问题。