How do I get Camera properties from a scene camera? - blender

In order to get the camera, I can use bpy.data.objects["Camera"]. This returns a Camera object corresponding to the camera named Camera.
However, when getting this camera from the scene, it does not get a Camera type but an Object type. print(bpy.data.scenes["Scene"].camera) returns <bpy_struct, Object("Camera") at 0x14c170608>.
I wish I could use this Object as a camera, but it does not provide the Camera properties I need.
Why is the camera I got from the scene an Object instead of a Camera, and how do I access the Camera properties I need from the scene?

You can find the camera properties in bpy.data.scenes["Scene"].camera.data.

Related

Camera Stacking in AR Game to Apply Overlay

I'm trying to create an AR game (similar to FPS), which requires camera stacking to allow for an AR base camera, as well as an overlay camera with overlays such as health points, bullet count etc. However, upon creating an empty GameObject and adding a camera component, I realise that I do not see the Render Type option in the inspector pane.
May I know what went wrong? Or how should I go about creating an AR game with a live AR camera feed with an overlay displaying health points etc?
Thanks and cheers!
enter image description here

How to create camera view in Objective-C

How can I just display a live feed of the rear camera in Objective-C? What do I need to add to my storyboard and what do I need to add to my ViewController? Any examples would be great.
You would need to use AVFoundation, specifically look at AVCaptureSession, AVCaptureDeviceInput, which you can use in order to get access to the cameras and look into AVCaptureVideoPreviewLayer which will allow you to draw the camera input to the screen
EDIT :
There's a step by step tutorial in Obj-C about it :
https://www.appcoda.com/ios-programming-camera-iphone-app/

How to change the augmented reality camera in three.js?

As the example, I try to set up the AR scene in three.js.
I use "jsartoolkit" to do that.
WebAR
I load a JSON model into the AR scene, and it does work.
Now I wonder how could I do to change the camera?
When I open the AR webpage, it always turn on the front device camera of my mobile phone.
I want to use the back device camera to show my WebAR scene.
How should I do?
Using cameraParam as a property name in your call to getUserMediaThreeScene may be incorrect.
Change:
cameraParam: 'Data/camera_para-iPhone 5 rear 640x480 1.0m.dat'
To:
video: { facingMode: { exact: "environment" }}
Reference: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

Is there a way I can let the camera zoom but not rotate?

Is there a way I can let the SceneKit's camera zoom but not rotate? And how can I delimitate the maximum and minimum zoom the user can do with the camera?
It depends what you mean by zoom – if you mean to do the same thing as 'zooming' a camera lens, you want to modify the yFov and xFov (field of view) attributes of the SCNCamera object. The camera stays in the exact same location, but changes its field of view like a zoom lens.
I cannot see how you can rotate the camera while zooming it – I’d need to see more context of where you’re using the camera. If you don’t touch the SCNNode the camera is attached to, you can’t possibly rotate it.
You're talking about user camera movement with allowsCameraControl, right? I don't think that's really meant to be the basis for a sophisticated user camera movement scheme, more of a simple debugging aid. If you really want fine control over how the user can move the camera, you're best served by creating your own camera node and moving it / changing its properties in response to whatever user input you want to handle (gesture recognizers, game controllers, etc).
I suppose you might be able to constrain the automatic user camera by implementing a scene renderer delegate willRenderScene method. You'd have to get the current pointOfView node, check its position and camera parameters, and change them if they're outside whatever bounds you want. But A) I'm not sure this would work, and B) it's probably not a great idea — it's sort of like messing with the internal view hierarchy of a system control class.

Taking Control of ARCamera on Unity3D with Vuforia

The position and rotation of Vuforia's ARcam are determined by their algorithms to give the AR effect. I'd like to know how to do the following:
When some object is clicked the camera goes to some specific position (for that I need to somehow take control of the camera).
Also have to possibility to yield control of the camera back to Vuforia.
You'll want to use a second camera in this instance. Position the second camera at the AR Camera position, then adjust the depths to make the new camera the view that you see. Then you can tween its position to the predefined one you have.
Do the reverse to get control back to the AR Camera.