Set the camera intrinsics from an info msg.
519115
def _set_camera_properties(self, msg):
        
        focal_x = msg.K[0]
        focal_y = msg.K[4]
        center_x = msg.K[2]
        center_y = msg.K[5]
        im_height = msg.height
        im_width = msg.width
        self._camera_intr = CameraIntrinsics(self._frame, focal_x, focal_y,
                                             center_x, center_y,
                                             height=im_height,
                                             width=im_width)
288750
def initialize(self):
        """"""
        device_info = self.get_device_info()

        if device_info is None:
            self.name = None
            self.cam_id = None
            self.event_states = None
            return

        for key in device_info:
            if key == 'deviceName':
                self.name = device_info[key]
            elif key == 'deviceID':
                if len(device_info[key]) > 10:
                    self.cam_id = device_info[key]
                else:
                    self.cam_id = uuid.uuid4()

        events_available = self.get_event_triggers()
        if events_available:
            for event, channel_list in events_available.items():
                for channel in channel_list:
                    try:
                        self.event_states.setdefault(
                            SENSOR_MAP[event.lower()], []).append(
                                [False, channel, 0, datetime.datetime.now()])
                    except KeyError:
                        # Sensor type doesn't have a known friendly name
                        # We can't reliably handle it at this time...
                        _LOGGING.warning(
                            'Sensor type "%s" is unsupported.', event)

            _LOGGING.debug('Initialized Dictionary: %s', self.event_states)
        else:
            _LOGGING.debug('No Events available in dictionary.')

        self.get_motion_detection()
636179
def setupScene(self):
        ""
        if self.m_pHMD is None:
            return
        vertdataarray = list()
        matScale = Matrix4()
        matScale.scale( self.m_fScale, self.m_fScale, self.m_fScale )
        matTransform = Matrix4()
        matTransform.translate([
            -( float(self.m_iSceneVolumeWidth) * self.m_fScaleSpacing ) / 2.0,
            -( float(self.m_iSceneVolumeHeight) * self.m_fScaleSpacing ) / 2.0,
            -( float(self.m_iSceneVolumeDepth) * self.m_fScaleSpacing ) / 2.0 ])
        mat = matScale * matTransform
        for z in range(self.m_iSceneVolumeDepth):  # @UnusedVariable
            for y in range(self.m_iSceneVolumeHeight):  # @UnusedVariable
                for x in range(self.m_iSceneVolumeWidth):  # @UnusedVariable
                    self.addCubeToScene( mat, vertdataarray )
                    mat = mat * Matrix4().translate( [self.m_fScaleSpacing, 0, 0] )
                mat = mat * Matrix4().translate( [-(float(self.m_iSceneVolumeWidth)) * self.m_fScaleSpacing, self.m_fScaleSpacing, 0] )
            mat = mat * Matrix4().translate( [0, -(float(self.m_iSceneVolumeHeight)) * self.m_fScaleSpacing, self.m_fScaleSpacing] )
        self.m_uiVertcount = len(vertdataarray)/5
        self.m_unSceneVAO = glGenVertexArrays(1)
        glBindVertexArray( self.m_unSceneVAO )
        self.m_glSceneVertBuffer = glGenBuffers(1)
        glBindBuffer( GL_ARRAY_BUFFER, self.m_glSceneVertBuffer )
        vertdataarray = numpy.array(vertdataarray, numpy.float32) # convert to numpy array at last possible moment
        glBufferData( GL_ARRAY_BUFFER, sizeof(ctypes.c_float) * len(vertdataarray), vertdataarray, GL_STATIC_DRAW)
        glBindBuffer( GL_ARRAY_BUFFER, self.m_glSceneVertBuffer )
        stride = sizeof(VertexDataScene)
        offset = 0
        glEnableVertexAttribArray( 0 )
        glVertexAttribPointer( 0, 3, GL_FLOAT, False, stride , offset)
        offset += sizeof(Vector3)
        glEnableVertexAttribArray( 1 )
        glVertexAttribPointer( 1, 2, GL_FLOAT, False, stride, offset)
        glBindVertexArray( 0 )
        glDisableVertexAttribArray(0)
        glDisableVertexAttribArray(1)
1159852
def update(self):
        
        if self.var_info.bits_per_pixel == 1:
            b = self._img.tobytes("raw", "1;R")
            self.mmap[:len(b)] = b

        elif self.var_info.bits_per_pixel == 16:
            self.mmap[:] = self._img_to_rgb565_bytes()

        elif self.var_info.bits_per_pixel == 32:
            self.mmap[:] = self._img.convert("RGB").tobytes("raw", "XRGB")

        else:
            raise Exception("Not supported - platform %s with bits_per_pixel %s" %
                (self.platform, self.var_info.bits_per_pixel))
1258978
public void setIntrinsic(CameraPinholeBrown intrinsic) {
		planeProjection.setIntrinsic(intrinsic);
		normToPixel = LensDistortionFactory.narrow(intrinsic).distort_F64(false,true);
		pixelToNorm = LensDistortionFactory.narrow(intrinsic).undistort_F64(true,false);

		// Find the change in angle caused by a pixel error in the image center.  The same angle error will induce a
		// larger change in pixel values towards the outside of the image edge.  For fish-eyes lenses this could
		// become significant.  Not sure what a better way to handle it would be
		thresholdFarAngleError = Math.atan2(thresholdPixelError, intrinsic.fx);
	}
1264804
public void setProjectionMatrix(float x1, float y1, float z1, float w1,
            float x2, float y2, float z2, float w2, float x3, float y3,
            float z3, float w3, float x4, float y4, float z4, float w4) {
        NativeCustomCamera.setProjectionMatrix(getNative(), x1, y1, z1, w1, x2,
                y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4);
    }
943715
def _update_camera(self, camera_center):
    """"""
    self._world_tl_to_world_camera_rel.offset = (
        -self._world_to_world_tl.fwd_pt(camera_center) *
        self._world_tl_to_world_camera_rel.scale)

    if self._feature_screen_px:
      camera_radius = (self._feature_screen_px / self._feature_screen_px.x *
                       self._feature_camera_width_world_units / 2)
      center = camera_center.bound(camera_radius,
                                   self._map_size - camera_radius)
      self._camera = point.Rect(
          (center - camera_radius).bound(self._map_size),
          (center + camera_radius).bound(self._map_size))
73419
def update(self):
        """"""
        current_time = int(time.time())
        last_refresh = 0 if self._last_refresh is None else self._last_refresh

        if current_time >= (last_refresh + self._refresh_rate):
            self.get_cameras_properties()
            self.get_ambient_sensor_data()
            self.get_camera_extended_properties()
            self._attrs = self._session.refresh_attributes(self.name)
            self._attrs = assert_is_dict(self._attrs)
            _LOGGER.debug("Called base station update of camera properties: "
                          "Scan Interval: %s, New Properties: %s",
                          self._refresh_rate, self.camera_properties)
1274729
def _load_calib(self):
        """"""
        # We'll build the calibration parameters as a dictionary, then
        # convert it to a namedtuple to prevent it from being modified later
        data = {}

        # Load the rigid transformation from IMU to velodyne
        data['T_velo_imu'] = self._load_calib_rigid('calib_imu_to_velo.txt')

        # Load the camera intrinsics and extrinsics
        data.update(self._load_calib_cam_to_cam(
            'calib_velo_to_cam.txt', 'calib_cam_to_cam.txt'))

        # Pre-compute the IMU to rectified camera coordinate transforms
        data['T_cam0_imu'] = data['T_cam0_velo'].dot(data['T_velo_imu'])
        data['T_cam1_imu'] = data['T_cam1_velo'].dot(data['T_velo_imu'])
        data['T_cam2_imu'] = data['T_cam2_velo'].dot(data['T_velo_imu'])
        data['T_cam3_imu'] = data['T_cam3_velo'].dot(data['T_velo_imu'])

        self.calib = namedtuple('CalibData', data.keys())(*data.values())
787284
public void setPerspective() {
		double cameraZ = ((height / 2.0) / Math.tan(Math.PI * 60.0 / 360.0));
		matrixMode(MatrixMode.PROJECTION);
		resetMatrix();
		glu.gluPerspective(Math.PI / 3.0, this.width
				/ this.height, cameraZ / 10.0, cameraZ * 10.0);
		matrixMode(MatrixMode.MODELVIEW);
		resetMatrix();
	}
239939
def _depth_image_callback(self, image_msg):
        
        encoding = image_msg.encoding
        try:
            depth_arr = self._bridge.imgmsg_to_cv2(image_msg, encoding)
            import pdb; pdb.set_trace()

        except CvBridgeError as e:
            rospy.logerr(e)
        depth = np.array(depth_arr*MM_TO_METERS, np.float32)
        self._cur_depth_im = DepthImage(depth, self._frame)
519726
def setMeta(self, title=None, description=None):
        """"""
        method = 'flickr.photos.setMeta'

        if title is None:
            title = self.title
        if description is None:
            description = self.description
            
        _dopost(method, auth=True, title=title, \
               description=description, photo_id=self.id)
        
        self.__title = title
        self.__description = description
197535
public static void computeCameraControl(double beta[],
											List<Point3D_F64> nullPts[],
											FastQueue<Point3D_F64> cameraPts ,
											int numControl )
	{
		cameraPts.reset();
		for( int i = 0; i < numControl; i++ ) {
			cameraPts.grow().set(0,0,0);
		}

		for( int i = 0; i < numControl; i++ ) {
			double b = beta[i];
//			System.out.printf("%7.3f ", b);

			for( int j = 0; j < numControl; j++ ) {
				Point3D_F64 s = cameraPts.get(j);
				Point3D_F64 p = nullPts[i].get(j);
				s.x += b*p.x;
				s.y += b*p.y;
				s.z += b*p.z;
			}
		}
	}
729196
def system(self, object, highlight=None, alpha=1.0, color=None, 
                     transparent=None):
        ''''''
        if self.backend == 'povray':
            kwargs = {}
            if color is not None:
                kwargs['color'] = color
            else:
                kwargs['color'] = default_colormap[object.type_array]
            
            self.plotter.camera.autozoom(object.r_array)
            self.plotter.points(object.r_array, alpha=alpha, **kwargs)
            return self
668301
public void process(CameraPinholeBrown intrinsic , List<BufferedImage> colorImages ) {

		DetectDescribePoint detDesc = FactoryDetectDescribe.surfStable(null, null, null, GrayF32.class);
		ScoreAssociation scorer = FactoryAssociation.defaultScore(detDesc.getDescriptionType());
		AssociateDescription<TupleDesc> associate =
				FactoryAssociation.greedy(scorer, Double.MAX_VALUE, true);
		PairwiseImageMatching<GrayF32> imageMatching = new PairwiseImageMatching<>(detDesc,associate);
		imageMatching.setVerbose(System.out,0);

		String cameraName = "camera";
		imageMatching.addCamera(cameraName, LensDistortionFactory.narrow(intrinsic).undistort_F64(true,false),intrinsic);

		for (int i = 0; i < colorImages.size(); i++) {
			BufferedImage colorImage = colorImages.get(i);
			if( colorImage.getWidth() != intrinsic.width || colorImage.getHeight() != intrinsic.height )
				throw new RuntimeException("Looks like you tried to hack this example and run it on random images. Please RTFM");
			GrayF32 image = ConvertBufferedImage.convertFrom(colorImage, (GrayF32) null);
			imageMatching.addImage(image,cameraName);
		}

		if( !imageMatching.process() ) {
			throw new RuntimeException("Failed to match images! total="+colorImages.size());
		}

		EstimateSceneCalibrated estimateScene = new EstimateSceneCalibrated();
		estimateScene.setVerbose(System.out,0);

		if( !estimateScene.process(imageMatching.getGraph()))
			throw new RuntimeException("Scene estimation failed");

		// get the results
		SceneStructureMetric structure = estimateScene.getSceneStructure();
		SceneObservations observations = estimateScene.getObservations();

		// Configure bundle adjustment
		ConfigLevenbergMarquardt configLM = new ConfigLevenbergMarquardt();
		configLM.dampeningInitial = 1e-12;
		configLM.hessianScaling = true;
		ConfigBundleAdjustment configSBA = new ConfigBundleAdjustment();
		configSBA.configOptimizer = configLM;

		BundleAdjustment<SceneStructureMetric> sba = FactoryMultiView.bundleSparseMetric(configSBA);
		sba.configure(1e-10,1e-10,100);
		sba.setVerbose(System.out,0);

		// Scale to improve numerical accuracy
		ScaleSceneStructure bundleScale = new ScaleSceneStructure();

		PruneStructureFromSceneMetric pruner = new PruneStructureFromSceneMetric(structure,observations);

		// Requiring 3 views per point reduces the number of outliers by a lot but also removes
		// many valid points
		pruner.prunePoints(3);

		// Optimize the results
		int pruneCycles=5;
		for (int i = 0; i < pruneCycles; i++) {
			System.out.println("BA + Prune iteration = "+i+"  points="+structure.points.length+"  obs="+observations.getObservationCount());
			bundleScale.applyScale(structure,observations);
			sba.setParameters(structure,observations);
			if( !sba.optimize(structure) ) {
				throw new RuntimeException("Bundle adjustment failed!");
			}

			bundleScale.undoScale(structure,observations);

			if( i == pruneCycles-1 )
				break;

			System.out.println("Pruning....");
			pruner.pruneObservationsByErrorRank(0.97);  // Prune outlier observations
			pruner.prunePoints(3,0.4);            // Prune stray points in 3D space
			pruner.prunePoints(2);                           // Prune invalid points
			pruner.pruneViews(10);                           // Prune views with too few observations
		}

		visualizeResults(structure,colorImages);
		System.out.println("Done!");
	}
341835
function () {
            var self = this;

            // add all defined cameras
            this.settings.cameras.forEach(function(camera) {
                self.cameras.set(camera.name, camera);
            });

            // empty or no default camera
            if (this.cameras.has("default") === false) {
                if (typeof default_camera === "undefined") {
                    var width = me.video.renderer.getWidth();
                    var height = me.video.renderer.getHeight();
                    // new default camera instance
                    default_camera = new me.Camera2d(0, 0, width, height);
                }
                this.cameras.set("default", default_camera);
            }

            // reset the game manager
            me.game.reset();

            // call the onReset Function
            this.onResetEvent.apply(this, arguments);
        }
1168044
public boolean process(CameraPinholeBrown intrinsic , Se3_F64 planeToCamera )
	{
		proj.setPlaneToCamera(planeToCamera,true);
		proj.setIntrinsic(intrinsic);

		// find a bounding rectangle on the ground which is visible to the camera and at a high enough resolution
		double x0 = Double.MAX_VALUE;
		double y0 = Double.MAX_VALUE;
		double x1 = -Double.MAX_VALUE;
		double y1 = -Double.MAX_VALUE;

		for( int y = 0; y < intrinsic.height; y++ ) {
			for( int x = 0; x < intrinsic.width; x++ ) {
				if( !checkValidPixel(x,y) )
					continue;

				if( plane0.x < x0 )
					x0 = plane0.x;
				if( plane0.x > x1 )
					x1 = plane0.x;
				if( plane0.y < y0 )
					y0 = plane0.y;
				if( plane0.y > y1 )
					y1 = plane0.y;
			}
		}

		if( x0 == Double.MAX_VALUE )
			return false;

		// compute parameters with the intent of maximizing viewing area
		double mapWidth = x1-x0;
		double mapHeight = y1-y0;
		overheadWidth = (int)Math.floor(mapWidth/cellSize);
		overheadHeight = (int)Math.floor(mapHeight* viewHeightFraction /cellSize);
		centerX = -x0;
		centerY = -(y0+mapHeight*(1- viewHeightFraction)/2.0);

		return true;
	}