default values in c++ code

Post Reply
relieved_mouse
Posts: 18
Joined: Sun Apr 03, 2005 5:00 am
Location: Germany

default values in c++ code

Post by relieved_mouse »

I have been using the VC6 sample code for making my own application for use with a Slim v100.

What I can't work out is how to alter the default values for things like maximum object mass under 'dot tracking parameters' and the exposure levels (both in the camera options window).

In the case of exposure, I can see where in the code the range of possible values is defined, but I can't see where the default value is defined.

Also, are the user-adjusted values supposed to be saved when shutting down the program (this doesn't happen in my case).

If anyone could give me some advice on what to do I would be very grateful :-)
Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: default values in c++ code

Post by Birch »

The default values for settings in the OptiTrack SDK cannot be changed, they are read-only and reflect the values cameras are automatically initialized to. If needed, you can change the settings after calling Open() but before calling Start(), so that everything is set how you want it before beginning to collect data.

You can use GetOption() with NP_OPTION_EXPOSURE_DEFAULT to read the default exposure setting for the type of camera that is currently connected and opened, but it is not supported with the SetOption call.

The user settings in the OptiTrack SDK do not persist, if you close an app using the OptiTrack SDK and open it again, you will need to re-apply your custom settings.
relieved_mouse
Posts: 18
Joined: Sun Apr 03, 2005 5:00 am
Location: Germany

Re: default values in c++ code

Post by relieved_mouse »

Thanks very much for your reply. I did as you suggested with SetOption for the threshold and it worked fine. Also, as you explained, SetOption won't work for exposure. Is there another way I can get the exposure value pre set in my code?
Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: default values in c++ code

Post by Birch »

You can change the exposure once the camera is initialized in the same manner as the threshold. It is just the exposure value that gets set while the cameras are being initialized which cannot be changed.

Just call SetOption() with NP_OPTION_EXPOSURE after calling Open() but before calling Start(), you should be good to go.
relieved_mouse
Posts: 18
Joined: Sun Apr 03, 2005 5:00 am
Location: Germany

Re: default values in c++ code

Post by relieved_mouse »

Thanks for the info :-)

Line 161 in the CameraDlg.cpp script is:

hr = m_spCamera->Open();

in the next line I put:

CComVariant var = (long) 70;
m_spCamera->SetOption(NP_ OPTION_EXPOSURE, var);

but when I run the application and open the dialog the exposure value is still 55. What am I doing wrong (this method does work for the threshold)?

Also, does the API calculate the area of the IR source as a circle or a square?

Thanks!
Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: default values in c++ code

Post by Birch »

Do you mean the exposure value is 55 when you open the camera options dialog with all of the slider bars and camera settings?

If so, your custom exposure value is probably getting overwritten in CCameraOptionsDlg::OnInitDialog(). The behavior can be changed to use the camera's current exposure to initialize the slider bar instead of using the default exposure.

Try changing the following line in OnInitDialog()

hr = m_spCamera->GetOption(NP_OPTION_EXPOSURE_DEFAULT, &var);

to this :

hr = m_spCamera->GetOption(NP_OPTION_EXPOSURE, &var);
relieved_mouse
Posts: 18
Joined: Sun Apr 03, 2005 5:00 am
Location: Germany

Re: default values in c++ code

Post by relieved_mouse »

Thanks Birch, I followed your instructions and I can set the exposure value in the code.

Incidentally, does the API calculate the area of the IR source as a circle or a square?
Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: default values in c++ code

Post by Birch »

[quote=relieved_mouse]
Incidentally, does the API calculate the area of the IR source as a circle or a square? [/quote]

I'm not sure I understand the question. Do you mean, how does the API calculate the size, shape and center of a bright object detected by a camera?

If so, it calculates the Center and Size(pixel area) using all the individual pixels found in the object (can be irregularly shaped), and for the Shape it creates a perimeter based on the outermost pixels on the top, bottom, left and right of the object. If you are running V100 camerass in hardware object mode, then the Shape information is not available.
Post Reply