Specifies that the view uses the specified camera
@param viewIndex index of view
@param cameraIndex index of camera
357849
public void connectViewToCamera( int viewIndex , int cameraIndex ) {
		if( views[viewIndex].camera != -1 )
			throw new RuntimeException("View has already been assigned a camera");
		views[viewIndex].camera = cameraIndex;
	}
216027
public void requestCamera(int camera) {
        if (Camera.getNumberOfCameras() == 1) {
            Log.w(TAG, "Ignoring requestCamera: only one device camera available.");
            return;
        }
        mDesiredCamera = camera;
        if (mCamera != null && mDesiredCamera != mCurrentCamera) {
            // Hot swap camera
            mHandler.sendMessage(mHandler.obtainMessage(MSG_RELEASE_CAMERA));
            mHandler.sendMessage(mHandler.obtainMessage(MSG_REOPEN_CAMERA));
        }
    }
646452
public void addImage(T image , String cameraName ) {

		PairwiseImageGraph.View view = new PairwiseImageGraph.View(graph.nodes.size(),
				new FastQueue<TupleDesc>(TupleDesc.class,true) {
					@Override
					protected TupleDesc createInstance() {
						return detDesc.createDescription();
					}
				});

		view.camera = graph.cameras.get(cameraName);
		if( view.camera == null )
			throw new IllegalArgumentException("Must have added the camera first");

		view.index = graph.nodes.size();
		graph.nodes.add(view);

		detDesc.detect(image);

		// Pre-declare memory
		view.descriptions.growArray(detDesc.getNumberOfFeatures());
		view.observationPixels.growArray(detDesc.getNumberOfFeatures());

		for (int i = 0; i < detDesc.getNumberOfFeatures(); i++) {
			Point2D_F64 p = detDesc.getLocation(i);

			// save copies since detDesc recycles memory
			view.descriptions.grow().setTo(detDesc.getDescription(i));
			view.observationPixels.grow().set(p);
		}

		if( view.camera.pixelToNorm == null ){
			return;
		}

		view.observationNorm.growArray(detDesc.getNumberOfFeatures());
		for (int i = 0; i < view.observationPixels.size; i++) {
			Point2D_F64 p = view.observationPixels.get(i);
			view.camera.pixelToNorm.compute(p.x,p.y,view.observationNorm.grow());
		}

		if( verbose != null ) {
			verbose.println("Detected Features: "+detDesc.getNumberOfFeatures());
		}
	}
733906
protected void setFrameIndex (int frameIdx, boolean forceUpdate)
    {
        // make sure we're displaying a valid frame
        frameIdx = (frameIdx % _frames.getFrameCount());

        // if this is the same frame we're already displaying and we're
        // not being forced to update, we can stop now
        if (frameIdx == _frameIdx && !forceUpdate) {
            return;
        } else {
            _frameIdx = frameIdx;
        }

        // start with our old bounds
        Rectangle dirty = new Rectangle(_bounds);

        // determine our drawing offsets and rendered rectangle size
        accomodateFrame(_frameIdx, _frames.getWidth(_frameIdx),
                        _frames.getHeight(_frameIdx));

        // add our new bounds
        dirty.add(_bounds);

        // give the dirty rectangle to the region manager
        if (_mgr != null) {
            _mgr.getRegionManager().addDirtyRegion(dirty);
        }
    }
1067306
public void setIntrinsic(CameraPinholeBrown intrinsic )
	{
		normToPixel = LensDistortionFactory.narrow(intrinsic).distort_F64(false, true);
		pixelToNorm = LensDistortionFactory.narrow(intrinsic).undistort_F64(true, false);
	}
727702
private void setChildDrawableAtIndex(int index, @Nullable Drawable drawable) {
    if (drawable == null) {
      mFadeDrawable.setDrawable(index, null);
      return;
    }
    drawable = WrappingUtils.maybeApplyLeafRounding(drawable, mRoundingParams, mResources);
    getParentDrawableAtIndex(index).setDrawable(drawable);
  }
786640
protected void onCameraResolutionChange( int cameraWidth , int cameraHeight ,
											 int orientation ) {
		if( verbose )
			Log.i(TAG,"onCameraResolutionChange( "+cameraWidth+" , "+cameraHeight+")");
	}
389828
public void setOverlayImage(int index, @Nullable Drawable drawable) {
    // Note that overlays are by definition top-most and therefore the last elements in the array.
    Preconditions.checkArgument(
        index >= 0 && OVERLAY_IMAGES_INDEX + index < mFadeDrawable.getNumberOfLayers(),
        "The given index does not correspond to an overlay image.");
    setChildDrawableAtIndex(OVERLAY_IMAGES_INDEX + index, drawable);
  }
977100
public void zoomIn(GVRScene... gvrScenes) {
        for (GVRScene gvrScene : gvrScenes) {
            try {
                GVRPerspectiveCamera leftCameraMainScene = ((GVRPerspectiveCamera) gvrScene.getMainCameraRig().getLeftCamera());
                GVRPerspectiveCamera rightCameraMainScene = ((GVRPerspectiveCamera) gvrScene.getMainCameraRig().getRightCamera());
                if (leftCameraMainScene.getFovY() > MAX_ZOOM) {
                    leftCameraMainScene.setFovY(leftCameraMainScene.getFovY() - ZOOM_FACTOR);
                    rightCameraMainScene.setFovY(rightCameraMainScene.getFovY() - ZOOM_FACTOR);
                }
            } catch (ClassCastException e){
                throw new UnsupportedOperationException("Operation unsupported for this camera " +
                        "type");
            }

        }
    }
334008
protected boolean connectViews(PairwiseImageGraph.View viewA , PairwiseImageGraph.View viewB ,
								   FastQueue<AssociatedIndex> matches) {

		// Estimate fundamental/essential with RANSAC
		PairwiseImageGraph.Motion edge = new PairwiseImageGraph.Motion();
		int inliersEpipolar;

		CameraPinhole pinhole0 = viewA.camera.pinhole;
		CameraPinhole pinhole1 = viewB.camera.pinhole;

		if( pinhole0 != null && pinhole1 != null ) {
			// Fully calibrated camera pair
			ransacEssential.setIntrinsic(0,pinhole0);
			ransacEssential.setIntrinsic(1,pinhole1);

			if( !fitEpipolar(matches, viewA.observationNorm.toList(), viewB.observationNorm.toList(),ransacEssential,edge) ) {
				if( verbose != null && verboseLevel >= 1 ) {
					verbose.println(" fit essential failed");
				}
				return false;
			}
			edge.metric = true;
			inliersEpipolar = ransacEssential.getMatchSet().size();
			edge.F.set(ransacEssential.getModelParameters());
		} else if( fitEpipolar(matches,
					viewA.observationPixels.toList(), viewB.observationPixels.toList(),
					ransacFundamental,edge) ) {
			// transform is only known up to a projective transform
			edge.metric = false;
			inliersEpipolar = ransacFundamental.getMatchSet().size();
			edge.F.set(ransacFundamental.getModelParameters());
		} else {
			if( verbose != null && verboseLevel >= 1 ) {
				verbose.println(" fit fundamental failed");
			}
			return false;
		}

		if( inliersEpipolar < MIN_FEATURE_ASSOCIATED ) {
			if( verbose != null && verboseLevel >= 1 ) {
				verbose.println(" too too few inliers. "+inliersEpipolar+" min="+MIN_FEATURE_ASSOCIATED+
						" obsA="+viewA.observationNorm.size+" obsB="+viewB.observationNorm.size);
			}
			return false;
		}

		// If only a very small number of features are associated do not consider the view
		double fractionA = inliersEpipolar/(double)viewA.descriptions.size;
		double fractionB = inliersEpipolar/(double)viewB.descriptions.size;

		if( fractionA < MIN_ASSOCIATE_FRACTION | fractionB < MIN_ASSOCIATE_FRACTION )
			return false;

		// If the geometry is good for triangulation this number will be lower
		edge.viewSrc = viewA;
		edge.viewDst = viewB;
		edge.index = graph.edges.size();
		viewA.connections.add(edge);
		viewB.connections.add(edge);
		graph.edges.add(edge);

		return true;
	}
1053819
public void addChildObjectToCamera(final Widget child, int camera) {
        switch (camera) {
            case LEFT_CAMERA:
                mLeftCameraRootWidget.addChild(child);
                break;
            case RIGHT_CAMERA:
                mRightCameraRootWidget.addChild(child);
                break;
            default:
                mMainCameraRootWidget.addChild(child);
                break;
        }
    }
1121685
public ImageView getImage(int index) {
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "getImage("+index+")");
		}
		
		return getter.getView(ImageView.class, index);
	}
696640
public synchronized void setMode(IndexerIoMode mode)
   {
      if (this.mode != mode)
      {
         log.info("Indexer io mode=" + mode);
         this.mode = mode;
         for (IndexerIoModeListener listener : listeners)
         {
            listener.onChangeMode(mode);
         }
      }
   }
1205767
public void setCamera( double skew , double cx , double cy , int width , int height ) {

		// Define normalization matrix
		// center points, remove skew, scale coordinates
		double d = Math.sqrt(width*width + height*height);
		V.zero();
		V.set(0,0,d/2); V.set(0,1,skew); V.set(0,2,cx);
		V.set(1,1,d/2); V.set(1,2,cy);
		V.set(2,2,1);

		CommonOps_DDRM.invert(V,Vinv);
	}
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();
		}
	}
166136
private synchronized void changeImageView() {

		JComponent comp;
		if( control.selectedView < 3 ) {
			BufferedImage img;

			switch (control.selectedView) {
				case 0:
					img = disparityOut;
					break;

				case 1:
					img = colorLeft;
					break;

				case 2:
					img = colorRight;
					break;

				default:
					throw new RuntimeException("Unknown option");
			}

			gui.setImage(img);
			gui.setPreferredSize(new Dimension(origLeft.getWidth(), origLeft.getHeight()));
			comp = gui;
		} else {
			if( !computedCloud ) {
				computedCloud = true;
				DisparityToColorPointCloud d2c = new DisparityToColorPointCloud();

				double baseline = calib.getRightToLeft().getT().norm();
				d2c.configure(baseline, rectK,rectR, leftRectToPixel, control.minDisparity,control.maxDisparity);
				d2c.process(activeAlg.getDisparity(),colorLeft);

				CameraPinhole rectifiedPinhole = PerspectiveOps.matrixToPinhole(
						rectK,colorLeft.getWidth(),colorLeft.getHeight(),null);
				pcv.clearPoints();
				pcv.setCameraHFov(PerspectiveOps.computeHFov(rectifiedPinhole));
				pcv.setTranslationStep(5);
				pcv.addCloud(d2c.getCloud(),d2c.getCloudColor());
			}
			comp = pcv.getComponent();
			comp.requestFocusInWindow();
		}
		panel.remove(gui);
		panel.remove(pcv.getComponent());
		panel.add(comp,BorderLayout.CENTER);
		panel.validate();
		comp.repaint();
		processedImage = true;
	}
1231291
public void setSelectedIndex(int position) {
    if (adapter != null) {
      if (position >= 0 && position <= adapter.getCount()) {
        adapter.notifyItemSelected(position);
        selectedIndex = position;
        setText(adapter.get(position).toString());
      } else {
        throw new IllegalArgumentException("Position must be lower than adapter count!");
      }
    }
  }