Log in or register to post comments

Question of Focus

August 21, 2013 - 4:10am #1

HI all,

 

May i know, are there any ways to let camera focus when touch btn / screen?

(e.g.  when u take photo, u can touch to screen to focus where u want)

 

i have try SetFocusMode, but/ maybe i miss somethings, it doesn't to me. 

 

Thx.

Question of Focus

December 15, 2015 - 2:48am #7

Hello Mr.Allesandro, where do i input the code? My project doesnt have imagetargetsmenu too or I am searching at the wrong location? thanks~

Question of Focus

November 25, 2015 - 8:02am #6

You need to use C# script, where the class extends the MonoBehaviour class of Unity;

you could call that code from the Start() method of your MonoBehaviour script, for example.

Question of Focus

November 24, 2015 - 2:25pm #5

Hi every one

i'm trying to set the focus mode, but dont know how to use this code

 

CameraDevice.Instance.SetFocusMode( 
    CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);

I mean, I use java script

How I write it?

To which object in the scene I would atach it?

Thank you very much in advance

Question of Focus

August 22, 2013 - 1:01am #4

You cannot focus "more and more" (i.e. you cannot "zoom"), as this is not a supported feature.

When you use FOCUS_MODE_TRIGGERAUTO, you are telling the system to have "one shot" of automatic focus adjustment; the camera focus will be adjusted to try to reach an ideal focus for the current view (although this may be more or less accurate depending on the specific device).

Other possiblities are "FOCUS_MODE_CONTINUOUS_AUTO" which constantly tries to keep/adjust the focus to an optimal level (so that you don't need to trigger that explicitly), but this is not supported on all devices.

The remaining options are for fixed focus modes.

Question of Focus

August 22, 2013 - 12:13am #3

HI AlessandroB,

 

You Get It !

"CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO)"

This is what i want, thx for your reply.

But, can we control the focus level? um i mean, when i tap the screen, it focus a bit only!

i want to focus more and more ( or may be "zoom"  can be explana better ). 

 

p.s.

I have test all the CameraDevice.FocusMode, but i really cant get the different. XD

 

BTW, Thx Very Much!

 

Question of Focus

August 21, 2013 - 4:35am #2

Hi, you can trigger an auto-focus event when you touch the screen, as shown in the ImageTargets sample,

see the ImageTargetsMenu.cs script attached to the ARCamera, and see in particular this code:

private void HandleSingleTap()
    {
        mWaitingForSecondTap = false;
 
        if (mMenuOpen)
            mMenuOpen = false;
        else
        {
            // trigger focus once
            if (CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO))
            {
                mFocusMode = CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO;
                mAutoFocusText = AUTOFOCUS_ON;
            }
        }
    }
 
Log in or register to post comments