• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Vuforia类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vuforia.Vuforia的典型用法代码示例。如果您正苦于以下问题:Java Vuforia类的具体用法?Java Vuforia怎么用?Java Vuforia使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Vuforia类属于com.vuforia包,在下文中一共展示了Vuforia类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: FtcVuforia

import com.vuforia.Vuforia; //导入依赖的package包/类
/**
 * Constructor: Create an instance of this object. It initializes Vuforia with the specified target images and
 * other parameters.
 *
 * @param licenseKey specifies the Vuforia license key.
 * @param cameraViewId specifies the camera view ID on the activity, -1 if none given.
 * @param cameraDir specifies which camera to use (front or back).
 * @param trackablesFile specifies the XML file that contains the target info, can be null.
 * @param numTargets specifies the number of simultaneous trackable targets.
 * @param cameraMonitorFeedback specifies the feedback image showing the orientation of the target.
 */
public FtcVuforia(
        String licenseKey, int cameraViewId, VuforiaLocalizer.CameraDirection cameraDir,
        String trackablesFile, int numTargets,
        VuforiaLocalizer.Parameters.CameraMonitorFeedback cameraMonitorFeedback)
{
    this.cameraDir = cameraDir;
    //
    // If no camera view ID, do not activate camera monitor view to save power.
    //
    VuforiaLocalizer.Parameters params =
            cameraViewId == -1? new VuforiaLocalizer.Parameters(): new VuforiaLocalizer.Parameters(cameraViewId);
    params.vuforiaLicenseKey = licenseKey;
    params.cameraDirection = cameraDir;
    params.cameraMonitorFeedback = cameraMonitorFeedback;
    localizer = ClassFactory.createVuforiaLocalizer(params);
    Vuforia.setHint(HINT.HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, numTargets);
    if (trackablesFile != null)
    {
        targetList = localizer.loadTrackablesFromAsset(trackablesFile);
    }
}
 
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:33,代码来源:FtcVuforia.java


示例2: init

import com.vuforia.Vuforia; //导入依赖的package包/类
/**
     * Initialize vuforia
     * This method takes a few seconds to complete
     *
     * @param licenseKey                the Vuforia PTC licence key from https://developer.vuforia.com/license-manager
     * @param cameraMonitorViewIdParent the place in the layout where the camera display is
     * @param widthRequest              the width to scale the image to for the FrameGrabber
     * @param heightRequest             the height to scale the image to for the FrameGrabber
     * @return the VuforiaFrameFeeder object
     */
    public static VuforiaFrameFeeder init(String licenseKey, @IdRes int cameraMonitorViewIdParent, int widthRequest, int heightRequest) {
        //display the camera on the screen
        Parameters params = new Parameters(cameraMonitorViewIdParent);

        //do not display the camera on the screen
//        VuforiaLocalizer.Parameters params = new VuforiaLocalizer.Parameters();

        params.cameraDirection = CameraDirection.BACK;

        params.vuforiaLicenseKey = licenseKey;
        params.cameraMonitorFeedback = Parameters.CameraMonitorFeedback.AXES;

        //create a new VuforiaFrameFeeder object (this takes a few seconds)
        VuforiaFrameFeeder vuforia = new VuforiaFrameFeeder(params, widthRequest, heightRequest);

        //there are 4 beacons, so set the max image targets to 4
        Vuforia.setHint(HINT.HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 4);
        return vuforia;
    }
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:30,代码来源:VuforiaFrameFeeder.java


示例3: init

import com.vuforia.Vuforia; //导入依赖的package包/类
/**
     * Initialize vuforia
     * This method takes a few seconds to complete
     *
     * @param licenseKey                the Vuforia PTC licence key from https://developer.vuforia.com/license-manager
     * @param cameraMonitorViewIdParent the place in the layout where the camera display is
     * @param widthRequest              the width to scale the image to for the FrameGrabber
     * @param heightRequest             the height to scale the image to for the FrameGrabber
     * @return the VuforiaFrameGrabberInit object
     */
    public static VuforiaFrameGrabberInit init(String licenseKey, @IdRes int cameraMonitorViewIdParent, int widthRequest, int heightRequest) {
        //display the camera on the screen
        Parameters params = new Parameters(cameraMonitorViewIdParent);

        //do not display the camera on the screen
//        VuforiaLocalizer.Parameters params = new VuforiaLocalizer.Parameters();

        params.cameraDirection = CameraDirection.BACK;

        params.vuforiaLicenseKey = licenseKey;
        params.cameraMonitorFeedback = Parameters.CameraMonitorFeedback.AXES;

        //create a new VuforiaFrameGrabberInit object (this takes a few seconds)
        VuforiaFrameGrabberInit vuforia = new VuforiaFrameGrabberInit(params, widthRequest, heightRequest);

        //there are 4 beacons, so set the max image targets to 4
        Vuforia.setHint(HINT.HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 4);
        return vuforia;
    }
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:30,代码来源:VuforiaFrameGrabberInit.java


示例4: getInitializationErrorString

import com.vuforia.Vuforia; //导入依赖的package包/类
private String getInitializationErrorString(int code)
{
    if (code == Vuforia.INIT_DEVICE_NOT_SUPPORTED)
        return "Failed to initialize Vuforia. This device is not supported.";
    if (code == Vuforia.INIT_NO_CAMERA_ACCESS)
        return "Failed to initialize Vuforia. Camera not accessible";
    if (code == Vuforia.INIT_LICENSE_ERROR_MISSING_KEY)
        return "Vuforia App key is missing. Please get a valid key, by logging into your account at developer.vuforia.com and creating a new project.";
    if (code == Vuforia.INIT_LICENSE_ERROR_INVALID_KEY)
        return "Invalid Key used. Please make sure you are using a valid Vuforia App Key.";
    if (code == Vuforia.INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT)
        return "Unable to contact server. Please try again later.";
    if (code == Vuforia.INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT)
        return "No network available. Please make sure you are connected to the Internet.";
    if (code == Vuforia.INIT_LICENSE_ERROR_CANCELED_KEY)
        return "This app license key has been canceled and may no longer be used. Please get a new license key.";
    if (code == Vuforia.INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH)
        return "Vuforia App key is not valid for this product. Please get a valid key, by logging into your account at developer.vuforia.com and choosing the right product type during project creation.";
    else
    {
        return "Failed to initialize Vuforia.";
    }
}
 
开发者ID:mattrayner,项目名称:cordova-plugin-vuforia,代码行数:24,代码来源:ApplicationSession.java


示例5: onReceive

import com.vuforia.Vuforia; //导入依赖的package包/类
@Override
public void onReceive(Context ctx, Intent intent) {
    String receivedAction = intent.getExtras().getString(VuforiaPlugin.PLUGIN_ACTION);

    if (receivedAction.equals(VuforiaPlugin.DISMISS_ACTION)) {
        Vuforia.deinit();
        finish();
    }else if(receivedAction.equals(VuforiaPlugin.PAUSE_ACTION)){
        doStopTrackers();
    }else if(receivedAction.equals(VuforiaPlugin.RESUME_ACTION)){
        doStartTrackers();
    }else if(receivedAction.equals(VuforiaPlugin.UPDATE_TARGETS_ACTION)){
        String targets = intent.getStringExtra("ACTION_DATA");
        doUpdateTargets(targets);
    }
}
 
开发者ID:mattrayner,项目名称:cordova-plugin-vuforia,代码行数:17,代码来源:ImageTargets.java


示例6: imageFound

import com.vuforia.Vuforia; //导入依赖的package包/类
public void imageFound(String imageName) {
    Context context =  this.getApplicationContext();
    Intent resultIntent = new Intent();
    resultIntent.putExtra("name", imageName);

    this.setResult(0, resultIntent);

    doStopTrackers();

    Log.d(LOGTAG, "mAuto Stop On Image Found: " + mAutostopOnImageFound);

    if(mAutostopOnImageFound) {
        Vuforia.deinit();

        finish();
    } else {
        Log.d(LOGTAG, "Sending repeat callback");

        VuforiaPlugin.sendImageFoundUpdate(imageName);
    }
}
 
开发者ID:mattrayner,项目名称:cordova-plugin-vuforia,代码行数:22,代码来源:ImageTargets.java


示例7: onSurfaceChanged

import com.vuforia.Vuforia; //导入依赖的package包/类
public void onSurfaceChanged(GL10 gl, int width, int height)
{
    // Call Vuforia function to handle render surface size changes:
    Vuforia.onSurfaceChanged(width, height);
    
    // Upon every on pause the movie had to be unloaded to release resources
    // Thus, upon every surface create or surface change this has to be
    // reloaded
    // See:
    // http://developer.android.com/reference/android/media/MediaPlayer.html#release()
    for (int i = 0; i < VideoPlayback.NUM_TARGETS; i++)
    {
        if (mLoadRequested[i] && mVideoPlayerHelper[i] != null)
        {
            mVideoPlayerHelper[i].load(mMovieName[i], mCanRequestType[i],
                mShouldPlayImmediately[i], mSeekPosition[i]);
            mLoadRequested[i] = false;
        }
    }
}
 
开发者ID:daemontus,项目名称:VuforiaTransparentVideo,代码行数:21,代码来源:VideoPlaybackRenderer.java


示例8: doStartTrackers

import com.vuforia.Vuforia; //导入依赖的package包/类
@Override
public boolean doStartTrackers()
{
    // Indicate if the trackers were started correctly
    boolean result = true;
    
    Tracker objectTracker = TrackerManager.getInstance().getTracker(
        ObjectTracker.getClassType());
    if (objectTracker != null)
    {
        objectTracker.start();
        Vuforia.setHint(HINT.HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 2);
    } else
        result = false;
    
    return result;
}
 
开发者ID:daemontus,项目名称:VuforiaTransparentVideo,代码行数:18,代码来源:VideoPlayback.java


示例9: getInitializationErrorString

import com.vuforia.Vuforia; //导入依赖的package包/类
private String getInitializationErrorString(int code)
{
    if (code == Vuforia.INIT_DEVICE_NOT_SUPPORTED)
        return mActivity.getString(R.string.INIT_ERROR_DEVICE_NOT_SUPPORTED);
    if (code == Vuforia.INIT_NO_CAMERA_ACCESS)
        return mActivity.getString(R.string.INIT_ERROR_NO_CAMERA_ACCESS);
    if (code == Vuforia.INIT_LICENSE_ERROR_MISSING_KEY)
        return mActivity.getString(R.string.INIT_LICENSE_ERROR_MISSING_KEY);
    if (code == Vuforia.INIT_LICENSE_ERROR_INVALID_KEY)
        return mActivity.getString(R.string.INIT_LICENSE_ERROR_INVALID_KEY);
    if (code == Vuforia.INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT)
        return mActivity.getString(R.string.INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT);
    if (code == Vuforia.INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT)
        return mActivity.getString(R.string.INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT);
    if (code == Vuforia.INIT_LICENSE_ERROR_CANCELED_KEY)
        return mActivity.getString(R.string.INIT_LICENSE_ERROR_CANCELED_KEY);
    if (code == Vuforia.INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH)
        return mActivity.getString(R.string.INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH);
    else
    {
        return mActivity.getString(R.string.INIT_LICENSE_ERROR_UNKNOWN_ERROR);
    }
}
 
开发者ID:daemontus,项目名称:VuforiaTransparentVideo,代码行数:24,代码来源:SampleApplicationSession.java


示例10: configVideoSource

import com.vuforia.Vuforia; //导入依赖的package包/类
/**
 * This method configures Vuforia to capture video frames of the given format.
 *
 * @param imageWidth specifies the image width to capture.
 * @param imageHeight specifies the image height to capture.
 * @param queueCapacity specifies the frame queue capacity.
 */
public void configVideoSource(int imageWidth, int imageHeight, int queueCapacity)
{
    this.imageWidth = imageWidth;
    this.imageHeight = imageHeight;

    Vuforia.setFrameFormat(PIXEL_FORMAT.RGB565, true);
    localizer.setFrameQueueCapacity(queueCapacity);
}
 
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:16,代码来源:FtcVuforia.java


示例11: VuforiaFrameFeeder

import com.vuforia.Vuforia; //导入依赖的package包/类
/**
 * @param parameters                  the vuforia parameters
 * @param widthRequest                the width to resize the input frame to
 * @param heightRequest               the height to resize the input frame to
 * @param cameraOrientation           the orientation of the camera on the robot
 * @param ignoreOrientationForDisplay whether or not to rotate the output frame to display on the phone
 */
public VuforiaFrameFeeder(Parameters parameters, int widthRequest, int heightRequest, FrameGrabber.CameraOrientation cameraOrientation, boolean ignoreOrientationForDisplay) {
    super(parameters);
    this.widthRequest = widthRequest;
    this.heightRequest = heightRequest;
    this.cameraOrientation = cameraOrientation;
    this.ignoreOrientationForDisplay = ignoreOrientationForDisplay;
    stopAR();
    clearGlSurface();

    this.vuforiaCallback = new VuforiaCallbackSubclass();
    startAR();

    // Optional: set the pixel format(s) that you want to have in the callback
    Vuforia.setFrameFormat(PIXEL_FORMAT.RGB565, true);

    //load the beacon trackables
    VuforiaTrackables beaconsVuforiaTrackables = loadTrackablesFromAsset("FTC_2016-17");

    //set the names of the beacon trackables
    beaconsVuforiaTrackables.get(0).setName("Wheels");
    beaconsVuforiaTrackables.get(1).setName("Tools");
    beaconsVuforiaTrackables.get(2).setName("Legos");
    beaconsVuforiaTrackables.get(3).setName("Gears");

    //create a Map to connect BeaconName to beacon VuforiaTrackable
    beacons = new HashMap<>();

    //add the beacon trackables to the Map
    beacons.put(BeaconName.WHEELS, beaconsVuforiaTrackables.get(0));
    beacons.put(BeaconName.TOOLS, beaconsVuforiaTrackables.get(1));
    beacons.put(BeaconName.LEGOS, beaconsVuforiaTrackables.get(2));
    beacons.put(BeaconName.GEARS, beaconsVuforiaTrackables.get(3));

}
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:42,代码来源:VuforiaFrameFeeder.java


示例12: VuforiaFrameGrabberInit

import com.vuforia.Vuforia; //导入依赖的package包/类
/**
 * @param parameters                  the vuforia parameters
 * @param widthRequest                the width to resize the input frame to
 * @param heightRequest               the height to resize the input frame to
 * @param cameraOrientation           the orientation of the camera on the robot
 * @param ignoreOrientationForDisplay whether or not to rotate the output frame to display on the phone
 */
public VuforiaFrameGrabberInit(Parameters parameters, int widthRequest, int heightRequest, FrameGrabber.CameraOrientation cameraOrientation, boolean ignoreOrientationForDisplay) {
    super(parameters);
    this.widthRequest = widthRequest;
    this.heightRequest = heightRequest;
    this.cameraOrientation = cameraOrientation;
    this.ignoreOrientationForDisplay = ignoreOrientationForDisplay;
    stopAR();
    clearGlSurface();

    this.vuforiaCallback = new VuforiaCallbackSubclass();
    startAR();

    // Optional: set the pixel format(s) that you want to have in the callback
    Vuforia.setFrameFormat(PIXEL_FORMAT.RGB565, true);

    //load the beacon trackables
    VuforiaTrackables beaconsVuforiaTrackables = loadTrackablesFromAsset("FTC_2016-17");

    //set the names of the beacon trackables
    beaconsVuforiaTrackables.get(0).setName("Wheels");
    beaconsVuforiaTrackables.get(1).setName("Tools");
    beaconsVuforiaTrackables.get(2).setName("Legos");
    beaconsVuforiaTrackables.get(3).setName("Gears");

    //create a Map to connect BeaconName to beacon VuforiaTrackable
    beacons = new HashMap<>();

    //add the beacon trackables to the Map
    beacons.put(BeaconName.WHEELS, beaconsVuforiaTrackables.get(0));
    beacons.put(BeaconName.TOOLS, beaconsVuforiaTrackables.get(1));
    beacons.put(BeaconName.LEGOS, beaconsVuforiaTrackables.get(2));
    beacons.put(BeaconName.GEARS, beaconsVuforiaTrackables.get(3));

}
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:42,代码来源:VuforiaFrameGrabberInit.java


示例13: resumeAR

import com.vuforia.Vuforia; //导入依赖的package包/类
public void resumeAR() throws VuforiaException
{
    // Vuforia-specific resume operation
    Vuforia.onResume();

    if (mStarted)
        startAR(mCamera);
}
 
开发者ID:daemontus,项目名称:VuforiaLibGDX,代码行数:9,代码来源:AppSession.java


示例14: pauseAR

import com.vuforia.Vuforia; //导入依赖的package包/类
public void pauseAR() throws VuforiaException
{
    if (mStarted)
        stopCamera();

    Vuforia.onPause();
}
 
开发者ID:daemontus,项目名称:VuforiaLibGDX,代码行数:8,代码来源:AppSession.java


示例15: doInBackground

import com.vuforia.Vuforia; //导入依赖的package包/类
protected Boolean doInBackground(Void... params)
{
    // Prevent the onDestroy() method to overlap with initialization:
    synchronized (mShutdownLock)
    {
        Vuforia.setInitParameters(mActivity, mVuforiaFlags, mActivity.getString(R.string.vuforia_key));

        do
        {
            // Vuforia.init() blocks until an initialization step is
            // complete, then it proceeds to the next step and reports
            // progress in percents (0 ... 100%).
            // If Vuforia.init() returns -1, it indicates an error.
            // Initialization is done when progress has reached 100%.
            mProgressValue = Vuforia.init();

            // Publish the progress value:
            publishProgress(mProgressValue);

            // We check whether the task has been canceled in the
            // meantime (by calling AsyncTask.cancel(true)).
            // and bail out if it has, thus stopping this thread.
            // This is necessary as the AsyncTask will run to completion
            // regardless of the status of the component that
            // started is.
        } while (!isCancelled() && mProgressValue >= 0
                && mProgressValue < 100);

        return (mProgressValue > 0);
    }
}
 
开发者ID:daemontus,项目名称:VuforiaLibGDX,代码行数:32,代码来源:AppSession.java


示例16: onPostExecute

import com.vuforia.Vuforia; //导入依赖的package包/类
protected void onPostExecute(Boolean result)
{

    VuforiaException vuforiaException = null;

    Log.d(LOGTAG, "LoadTrackerTask.onPostExecute: execution " + (result ? "successful" : "failed"));

    if (!result)
    {
        String logMessage = "Failed to load tracker data.";
        // Error loading dataset
        Log.e(LOGTAG, logMessage);
        vuforiaException = new VuforiaException(
                VuforiaException.LOADING_TRACKERS_FAILURE,
                logMessage);
    } else
    {
        // Hint to the virtual machine that it would be a good time to
        // run the garbage collector:
        //
        // NOTE: This is only a hint. There is no guarantee that the
        // garbage collector will actually be run.
        System.gc();

        Vuforia.registerCallback(AppSession.this);

        mStarted = true;
    }

    // Done loading the tracker, update application status, send the
    // exception to check errors
    mSessionControl.onInitARDone(vuforiaException);
}
 
开发者ID:daemontus,项目名称:VuforiaLibGDX,代码行数:34,代码来源:AppSession.java


示例17: initRendering

import com.vuforia.Vuforia; //导入依赖的package包/类
public void initRendering()
{
    Log.d(LOGTAG, "GLRenderer.initRendering");

    mRenderer = Renderer.getInstance();

    GLES20.glClearColor(0.0f, 0.0f, 0.0f, Vuforia.requiresAlpha() ? 0.0f
            : 1.0f);


    // Call Vuforia function to (re)initialize rendering after first use
    // or after OpenGL ES context was lost (e.g. after onPause/onResume):
    vuforiaAppSession.onSurfaceCreated();
}
 
开发者ID:daemontus,项目名称:VuforiaLibGDX,代码行数:15,代码来源:VuforiaRenderer.java


示例18: doStartTrackers

import com.vuforia.Vuforia; //导入依赖的package包/类
@Override
public boolean doStartTrackers() {
    // Indicate if the trackers were started correctly
    boolean result = true;

    Tracker imageTracker = TrackerManager.getInstance().getTracker(
            ObjectTracker.getClassType());
    if (imageTracker != null) {
        imageTracker.start();
        Vuforia.setHint(HINT.HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 1);
    } else
        result = false;

    return result;
}
 
开发者ID:daemontus,项目名称:VuforiaLibGDX,代码行数:16,代码来源:ArActivity.java


示例19: resumeAR

import com.vuforia.Vuforia; //导入依赖的package包/类
public void resumeAR() throws ApplicationException
{
    // Vuforia-specific resume operation
    Vuforia.onResume();

    if (mStarted)
    {
        startAR(mCamera);
    }
}
 
开发者ID:mattrayner,项目名称:cordova-plugin-vuforia,代码行数:11,代码来源:ApplicationSession.java


示例20: pauseAR

import com.vuforia.Vuforia; //导入依赖的package包/类
public void pauseAR() throws ApplicationException
{
    if (mStarted)
    {
        stopCamera();
    }

    Vuforia.onPause();
}
 
开发者ID:mattrayner,项目名称:cordova-plugin-vuforia,代码行数:10,代码来源:ApplicationSession.java



注:本文中的com.vuforia.Vuforia类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Speaker类代码示例发布时间:2022-05-22
下一篇:
Java GetContainersResponseProtoOrBuilder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap