小编P S*_*tar的帖子

在 SCNNode / ARKit Swift 中获取图像的大小

我正在尝试扫描参考图像,然后在打印的参考图像上方显示图像本身。“虚拟”图像尺寸应与打印尺寸相同。

我的想法:获取打印的参考图像的大小,然后将图像缩放SCNNode到此大小(或将 SCNNode 缩放到此大小?)

但是:1-> 如何获得打印图像的大小,2-> 缩放SCNNode我也需要这个节点的大小。如何获得?

import UIKit
import SceneKit
import ARKit
import AVKit
import AVFoundation

class ViewController: UIViewController, ARSCNViewDelegate {

@IBOutlet var sceneView: ARSCNView!
private var planeNode: SCNNode?
private var imageNode: SCNNode?
private var animationInfo: AnimationInfo?
private var currentMediaName: String?
private var scrollView: UIScrollView!

override func viewDidLoad() {
    super.viewDidLoad()

    let scene = SCNScene()
    sceneView.scene = scene
    sceneView.delegate = self

}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    // Load reference images to look for …
Run Code Online (Sandbox Code Playgroud)

uiimage swift scnnode arkit

2
推荐指数
1
解决办法
1988
查看次数

标签 统计

arkit ×1

scnnode ×1

swift ×1

uiimage ×1