Opens the default camera while adjusting its resolution
433794
public static Webcam openDefault( int desiredWidth , int desiredHeight) {
		Webcam webcam = Webcam.getDefault();

		// Webcam doesn't list all available resolutions. Just pass in a custom
		// resolution and hope it works
		adjustResolution(webcam,desiredWidth,desiredHeight);

		webcam.open();
		return webcam;
	}
1248092
def move_camera(action, action_space, minimap):
  """"""
  minimap.assign_to(spatial(action, action_space).camera_move.center_minimap)
1168745
private void setUpAndConfigureCamera() {
		// Open and configure the camera
		mCamera = openConfigureCamera(mCameraInfo);
		setCameraDisplayOrientation(mCameraInfo,mCamera);

		// Create an instance of Camera
		mPreview.setCamera(mCamera);

		if( processing != null ) {
			processing.init(mDraw,mCamera,mCameraInfo,previewRotation);
		}
	}
31686
def _panel_settings(setting, value, validate_value):
        """"""
        if validate_value:
            if (setting == CONST.SETTING_CAMERA_RESOLUTION
                    and value not in CONST.SETTING_ALL_CAMERA_RES):
                raise AbodeException(ERROR.INVALID_SETTING_VALUE,
                                     CONST.SETTING_ALL_CAMERA_RES)
            elif (setting in
                  [CONST.SETTING_CAMERA_GRAYSCALE,
                   CONST.SETTING_SILENCE_SOUNDS]
                  and value not in
                  CONST.SETTING_DISABLE_ENABLE):
                raise AbodeException(ERROR.INVALID_SETTING_VALUE,
                                     CONST.SETTING_DISABLE_ENABLE)

        return {setting: value}
671218
function(resolution) {
  this.width = canvas.width = window.innerWidth;
  this.height = canvas.height = window.innerHeight;
  this.resolution = resolution;
  this.spacing = this.width / resolution;
  this.focalLen = this.height / this.width;
  this.range = isMobile ? 9 : 18;
  this.lightRange = 9;
  this.scale = canvas.width / 1200;
}
1110601
function () {
    var el = this.el;
    var savedPose = this.savedPose;

    if (!this.hasSavedPose) { return; }

    // Reset camera orientation.
    el.object3D.position.copy(savedPose.position);
    el.object3D.rotation.copy(savedPose.rotation);
    this.hasSavedPose = false;
  }
51619
function (oldData) {

    this.position_control_from_camera();

    this.bar.setAttribute("height", this.data.size/4.0);
    this.bar.setAttribute("width", this.data.size);
    this.bar.setAttribute("position", "0.0 0.0 0");


    this.play_image.setAttribute("height", this.data.size/4.0);
    this.play_image.setAttribute("width", this.data.size/4.0);
    this.play_image.setAttribute("position", ((-this.data.size/2.0) * 1.4) + " 0 0");


  }
787557
protected void reopenCameraAtResolution(int cameraWidth, int cameraHeight) {

		if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
			throw new RuntimeException("Attempted to reopenCameraAtResolution main looper thread!");
		}

		boolean releaseLock = true;
		open.mLock.lock();
		try {
			if (verbose)
				Log.i(TAG, "Reopening camera is null == " + (open.mCameraDevice == null)+" state="+open.state+
				" activity="+getClass().getSimpleName());

			if( open.state != CameraState.OPEN )
				throw new RuntimeException("BUG! Attempted to re-open camera when not open");

			if (null == open. mCameraDevice) {
				throw new RuntimeException("Can't re-open a closed camera");
			}
			closePreviewSession();
			open.mCameraSize = null;
			firstFrame = true;

			CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
			if (manager == null)
				throw new RuntimeException("Null camera manager");

			try {
				open.mPreviewReader = ImageReader.newInstance(
						cameraWidth, cameraHeight,
						ImageFormat.YUV_420_888, 2);
				// Do the processing inside the the handler thread instead of the looper thread to avoid
				// grinding the UI to a halt
				open.mPreviewReader.setOnImageAvailableListener(onAvailableListener, mBackgroundHandler);
				configureTransform(viewWidth, viewHeight);
				manager.openCamera(open.cameraId, mStateCallback, null);
				releaseLock = false;
			} catch (IllegalArgumentException e) {
				Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
				finish();
			} catch (CameraAccessException e) {
				e.printStackTrace();
			}
		} finally {
			if(releaseLock)
				open.mLock.unlock();
		}
	}
929444
function() {
    if (!this._resize) {
      return;
    }
    this._resize = false;
    this._cam.setViewportSize(this._canvas.viewportWidth(), 
                              this._canvas.viewportHeight());
    this._pickBuffer.resize(this._options.width, this._options.height);
  }
1295222
function (args) {
    args = args || {}
    if (typeof args !== 'object') {
      console.error('not supported camera view point: ' + args)
      return
    }
    var posChange = args.position || {}
    var rotChange = args.rotation || {}

    this._isPlaying = false
    // apply changes to current camera position
    var pos = defaults({}, posChange, clone(this.el.getAttribute('position')))
    var rot = defaults({}, rotChange, clone(this.el.getAttribute('rotation')))

    var target = {
      position: pos,
      rotation: rot
    }
    this.animate(target)
  }
180322
function (renderer, scene, camera, opts) {
        opts = opts || {};

        var gl = renderer.gl;

        var frameBuffer = this._frameBuffer;
        var viewport = frameBuffer.viewport;

        var renderList = scene.updateRenderList(camera, true);

        var opaqueList = renderList.opaque;
        var transparentList = renderList.transparent;

        var offset = 0;
        var gBufferRenderList = this._gBufferRenderList;
        for (var i = 0; i < opaqueList.length; i++) {
            if (!opaqueList[i].ignoreGBuffer) {
                gBufferRenderList[offset++] = opaqueList[i];
            }
        }
        if (this.renderTransparent) {
            for (var i = 0; i < transparentList.length; i++) {
                if (!transparentList[i].ignoreGBuffer) {
                    gBufferRenderList[offset++] = transparentList[i];
                }
            }
        }
        gBufferRenderList.length = offset;

        gl.clearColor(0, 0, 0, 0);
        gl.depthMask(true);
        gl.colorMask(true, true, true, true);
        gl.disable(gl.BLEND);

        var enableTargetTexture1 = this.enableTargetTexture1;
        var enableTargetTexture2 = this.enableTargetTexture2;
        var enableTargetTexture3 = this.enableTargetTexture3;
        var enableTargetTexture4 = this.enableTargetTexture4;
        if (!enableTargetTexture1 && !enableTargetTexture3 && !enableTargetTexture4) {
            console.warn('Can\'t disable targetTexture1, targetTexture3, targetTexture4 both');
            enableTargetTexture1 = true;
        }

        if (enableTargetTexture2) {
            frameBuffer.attach(opts.targetTexture2 || this._gBufferTex2, renderer.gl.DEPTH_STENCIL_ATTACHMENT);
        }

        function clearViewport() {
            if (viewport) {
                var dpr = viewport.devicePixelRatio;
                // use scissor to make sure only clear the viewport
                gl.enable(gl.SCISSOR_TEST);
                gl.scissor(viewport.x * dpr, viewport.y * dpr, viewport.width * dpr, viewport.height * dpr);
            }
            gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
            if (viewport) {
                gl.disable(gl.SCISSOR_TEST);
            }
        }

        function isMaterialChanged(renderable, prevRenderable) {
            return renderable.material !== prevRenderable.material;
        }

        // PENDING, scene.boundingBoxLastFrame needs be updated if have shadow
        renderer.bindSceneRendering(scene);
        if (enableTargetTexture1) {
            // Pass 1
            frameBuffer.attach(opts.targetTexture1 || this._gBufferTex1);
            frameBuffer.bind(renderer);

            clearViewport();

            var gBufferMaterial1 = this._gBufferMaterial1;
            var passConfig = {
                getMaterial: function () {
                    return gBufferMaterial1;
                },
                getUniform: getGetUniformHook1(this._defaultNormalMap, this._defaultRoughnessMap, this._defaultDiffuseMap),
                isMaterialChanged: isMaterialChanged,
                sortCompare: renderer.opaqueSortCompare
            };
            // FIXME Use MRT if possible
            renderer.renderPass(gBufferRenderList, camera, passConfig);

        }
        if (enableTargetTexture3) {

            // Pass 2
            frameBuffer.attach(opts.targetTexture3 || this._gBufferTex3);
            frameBuffer.bind(renderer);

            clearViewport();

            var gBufferMaterial2 = this._gBufferMaterial2;
            var passConfig = {
                getMaterial: function () {
                    return gBufferMaterial2;
                },
                getUniform: getGetUniformHook2(this._defaultDiffuseMap, this._defaultMetalnessMap),
                isMaterialChanged: isMaterialChanged,
                sortCompare: renderer.opaqueSortCompare
            };
            renderer.renderPass(gBufferRenderList, camera, passConfig);
        }

        if (enableTargetTexture4) {
            frameBuffer.bind(renderer);
            frameBuffer.attach(opts.targetTexture4 || this._gBufferTex4);

            clearViewport();

            // Remove jittering in temporal aa.
            // PENDING. Better solution?
            camera.update();

            var gBufferMaterial3 = this._gBufferMaterial3;
            var cameraViewProj = mat4.create();
            mat4.multiply(cameraViewProj, camera.projectionMatrix.array, camera.viewMatrix.array);
            var passConfig = {
                getMaterial: function () {
                    return gBufferMaterial3;
                },
                afterRender: function (renderer, renderable) {
                    var isSkinnedMesh = renderable.isSkinnedMesh();
                    if (isSkinnedMesh) {
                        var skeleton = renderable.skeleton;
                        var joints = renderable.joints;
                        if (joints.length > renderer.getMaxJointNumber()) {
                            var skinMatricesTexture = skeleton.getSubSkinMatricesTexture(renderable.__uid__, joints);
                            var prevSkinMatricesTexture = renderable.__prevSkinMatricesTexture;
                            if (!prevSkinMatricesTexture) {
                                prevSkinMatricesTexture = renderable.__prevSkinMatricesTexture = new Texture2D({
                                    type: Texture.FLOAT,
                                    minFilter: Texture.NEAREST,
                                    magFilter: Texture.NEAREST,
                                    useMipmap: false,
                                    flipY: false
                                });
                            }
                            if (!prevSkinMatricesTexture.pixels
                                || prevSkinMatricesTexture.pixels.length !== skinMatricesTexture.pixels.length
                            ) {
                                prevSkinMatricesTexture.pixels = new Float32Array(skinMatricesTexture.pixels);
                            }
                            else {
                                for (var i = 0; i < skinMatricesTexture.pixels.length; i++) {
                                    prevSkinMatricesTexture.pixels[i] = skinMatricesTexture.pixels[i];
                                }
                            }
                            prevSkinMatricesTexture.width = skinMatricesTexture.width;
                            prevSkinMatricesTexture.height = skinMatricesTexture.height;
                        }
                        else {
                            var skinMatricesArray = skeleton.getSubSkinMatrices(renderable.__uid__, joints);
                            if (!renderable.__prevSkinMatricesArray || renderable.__prevSkinMatricesArray.length !== skinMatricesArray.length) {
                                renderable.__prevSkinMatricesArray = new Float32Array(skinMatricesArray.length);
                            }
                            renderable.__prevSkinMatricesArray.set(skinMatricesArray);
                        }
                    }
                    renderable.__prevWorldViewProjection = renderable.__prevWorldViewProjection || mat4.create();
                    if (isSkinnedMesh) {
                        // Ignore world transform of skinned mesh.
                        mat4.copy(renderable.__prevWorldViewProjection, cameraViewProj);
                    }
                    else {
                        mat4.multiply(renderable.__prevWorldViewProjection, cameraViewProj, renderable.worldTransform.array);
                    }
                },
                getUniform: function (renderable, gBufferMat, symbol) {
                    if (symbol === 'prevWorldViewProjection') {
                        return renderable.__prevWorldViewProjection;
                    }
                    else if (symbol === 'prevSkinMatrix') {
                        return renderable.__prevSkinMatricesArray;
                    }
                    else if (symbol === 'prevSkinMatricesTexture') {
                        return renderable.__prevSkinMatricesTexture;
                    }
                    else if (symbol === 'firstRender') {
                        return !renderable.__prevWorldViewProjection;
                    }
                    else {
                        return gBufferMat.get(symbol);
                    }
                },
                isMaterialChanged: function () {
                    // Always update prevWorldViewProjection
                    return true;
                },
                sortCompare: renderer.opaqueSortCompare
            };

            renderer.renderPass(gBufferRenderList, camera, passConfig);
        }

        renderer.bindSceneRendering(null);
        frameBuffer.unbind(renderer);
    }
184435
def get_default_cam_pos(self):
        
        focal_pt = self.center
        return [np.array(rcParams['camera']['position']) + np.array(focal_pt),
                focal_pt, rcParams['camera']['viewup']]
20426
public static void fullViewLeft(CameraPinholeBrown paramLeft,
									FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight,
									FMatrixRMaj rectifyK)
	{
		ImplRectifyImageOps_F32.fullViewLeft(paramLeft, rectifyLeft, rectifyRight, rectifyK);
	}
1268916
public void cameraIntrinsicNominal(CameraPinhole intrinsic ) {
		open.mLock.lock();
		try {
			// This might be called before the camera is open
			if (open.mCameraCharacterstics != null) {
				SizeF physicalSize = open.mCameraCharacterstics.get(CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE);
				Rect activeSize = open.mCameraCharacterstics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
				Size pixelSize = open.mCameraCharacterstics.get(CameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE);
				float[] focalLengths = open.mCameraCharacterstics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS);
				if (focalLengths != null && focalLengths.length > 0 && physicalSize != null && activeSize != null && pixelSize != null ) {
					float fl = focalLengths[0];

					float widthToPixel = pixelSize.getWidth() / physicalSize.getWidth();
					float heightToPixel = pixelSize.getHeight() / physicalSize.getHeight();

					float s = open.mCameraSize.getWidth()/(float)activeSize.width();

					intrinsic.fx = fl*widthToPixel*s;
					intrinsic.fy = fl*heightToPixel*s;
					intrinsic.skew = 0;
					intrinsic.cx = activeSize.centerX()*s;
					intrinsic.cy = activeSize.centerY()*s;
					intrinsic.width = open.mCameraSize.getWidth();
					intrinsic.height = open.mCameraSize.getHeight();
					return;
				}
			}
			// 60 degrees seems reasonable for a random guess
			PerspectiveOps.createIntrinsic(open.mCameraSize.getWidth(),open.mCameraSize.getHeight(),
					UtilAngle.radian(60));
		} finally {
			open.mLock.unlock();
		}
	}
652363
def zoom(self, factor):
        
        camera = self.ren.GetActiveCamera()
        camera.Zoom(factor)
        self.ren_win.Render()
1242677
def redraw(self, reset_camera=False):
        
        self.ren.RemoveAllViewProps()
        self.picker = None
        self.add_picker_fixed()
        self.helptxt_mapper = vtk.vtkTextMapper()
        tprops = self.helptxt_mapper.GetTextProperty()
        tprops.SetFontSize(14)
        tprops.SetFontFamilyToTimes()
        tprops.SetColor(0, 0, 0)

        if self.structure is not None:
            self.set_structure(self.structure, reset_camera)

        self.ren_win.Render()
62109
function () {
    var cameraEls;
    var newActiveCameraEl;
    cameraEls = this.sceneEl.querySelectorAll('[camera]');
    newActiveCameraEl = cameraEls[cameraEls.length - 1];
    newActiveCameraEl.setAttribute('camera', 'active', true);
  }