I have a single Prime 13 running a computer vision application on a PC. What I need, is now to add genlock and timecode to this application.
If I connect an eSync 2 to this setup, and connect timecode and genlock to the eSync 2, can i read the timecode using the camera sdk?
Is it possible to have a setup that is just:
Host PC - > eSync2 (genlock / TC) -> prime 13
Thanks!
Reading timecode from an eSync 2 via camera sdk?
-
- NaturalPoint Employee
- Posts: 719
- Joined: Mon Jan 19, 2015 11:52 am
Re: Reading timecode from an eSync 2 via camera sdk?
Hi antithing,
As eSync can be used with a single Prime camera. If you connect the eSync, you can sync the camera to the genlock and receive the timecode.
Cheers,
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
help.naturalpoint.com
support@optitrack.com
As eSync can be used with a single Prime camera. If you connect the eSync, you can sync the camera to the genlock and receive the timecode.
Cheers,
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
help.naturalpoint.com
support@optitrack.com
Re: Reading timecode from an eSync 2 via camera sdk?
Hi Steven, thanks for getting back to me.
Do I need to run any code to set up genlock? or will the camera automatically sync when the eSync is connected?
Is there any example code for reading the timecode from the eSync?
Thanks again.
Do I need to run any code to set up genlock? or will the camera automatically sync when the eSync is connected?
Is there any example code for reading the timecode from the eSync?
Thanks again.
-
- NaturalPoint Employee
- Posts: 719
- Joined: Mon Jan 19, 2015 11:52 am
Re: Reading timecode from an eSync 2 via camera sdk?
I am not sure if any of the samples specifically show how to use genlock or timecode, but the headers usually show the definitions for the data you need.
Working with the eSync should be similar to working with a camera. When you call an update, cameras give out frames, and so does the eSync. Instead of the frame containing a video image, you will get a pointer to a frame with some telemetry information. When you have that frame pointer just access it like so.
For fetching cameras you create a CameraList and call CameraManager::GetCamera(). For fetching the eSync you create a HardwareDeviceList and call GetDevice().
You can add cDevice pointers to the cModuleSync object just the same as you add cameras by calling cModuleSync::AddCamera( device );
You might also find the following useful from frame.h
I hope this all helps,
Steven
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
help.naturalpoint.com
support@optitrack.com
Working with the eSync should be similar to working with a camera. When you call an update, cameras give out frames, and so does the eSync. Instead of the frame containing a video image, you will get a pointer to a frame with some telemetry information. When you have that frame pointer just access it like so.
Code: Select all
frame->IsSynchInfoValid();
frame->FrameID();
frame->TimeCode();
frame->IsExternalLocked();
frame->IsRecording();
frame->LockSource();
frame->LockFrequency();
frame->SyncRatesUpdated();
You can add cDevice pointers to the cModuleSync object just the same as you add cameras by calling cModuleSync::AddCamera( device );
You might also find the following useful from frame.h
Code: Select all
//== Synchronization Telemetry (The only time these functions return valid information
//== is when this object is the result of calling GetFrame()
//== on an OptiTrack eSync device)
//==
//== If you want synchronized telemetry to compliment one or more Ethernet cameras the
//== best way to achieve this is to attach both the eSync and the cameras to a
//== synchronizer. The frame groups returned from the synchronizer will then include
//== synchronized camera and synchronization telemetry.
bool IsSynchInfoValid(); //== Reports if the calls to the rest of the
//== synchronization functions will return
//== valid/meaningful information.
bool IsTimeCodeValid(); //== Is there valid TimeCode information =====---
bool IsExternalLocked(); //== Synchronization is locked to a signal ===---
bool IsRecording(); //== eSync is reporting that recording should ---
//== take place =============================---
Core::cTimeCode TimeCode(); //== TimeCode ================================---
I hope this all helps,
Steven
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
help.naturalpoint.com
support@optitrack.com
Re: Reading timecode from an eSync 2 via camera sdk?
Hi Steven, i am attempting this, like so:
But the esync is never found. Is this the correct code ?
Thanks!
Code: Select all
CameraLibrary::HardwareDeviceList devices;
cDevice* device = CameraManager::X().GetDevice(devices[0].UID());
if (device == 0)
{
std::cout << "cannot find esync" << std::endl;
}
Thanks!
-
- NaturalPoint Employee
- Posts: 719
- Joined: Mon Jan 19, 2015 11:52 am
Re: Reading timecode from an eSync 2 via camera sdk?
Hi antithing,
We took a stab at this and were able to determine how to get the timecode from the eSync using the Camera SDK.
Here are some instructions to get timecode out of the Camera SDK using the FrameRateCalculation sample as a starting point.
Near the top of the document add:
After PopWaitingDialog() add the following code to fetch the eSync device:
Replace the part of the code that prints a string on top of the image with:
We hope this helps,
Steven
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
help.naturalpoint.com
wiki.optitrack.com
support@optitrack.com
We took a stab at this and were able to determine how to get the timecode from the eSync using the Camera SDK.
Here are some instructions to get timecode out of the Camera SDK using the FrameRateCalculation sample as a starting point.
Near the top of the document add:
Code: Select all
#include "string.h"
After PopWaitingDialog() add the following code to fetch the eSync device:
Code: Select all
//== Get a connected camera ================----
Camera *camera = nullptr;
// Find the eSync from a list of devices.
HardwareDeviceList deviceList;
int deviceIndex = -1;
for( int i = 0; i < deviceList.Count(); ++i )
{
std::string devName( deviceList[i].Name() );
std::string syncName = "eSync";
size_t index = devName.find( syncName );
if( index != std::string::npos )
{
deviceIndex = i;
break;
}
}
// Use the index to find the eSync in the list.
if( deviceIndex >= 0 )
{
camera = CameraManager::X().GetDevice( deviceList[deviceIndex].UID() );
}
if( camera && !camera->IsSyncAuthority() )
{
camera = nullptr;
}
Replace the part of the code that prints a string on top of the image with:
Code: Select all
if( frame )
{
//== Lets have the Camera Library raster the camera's
//== image into our texture.
frame->Rasterize( framebuffer );
//== Overlay the timecode onto the image ==-
Core::cTimeCode currentTimecode = frame->TimeCode();
char st[80];
sprintf_s( st, 80, "Timecode: %d:%d:%d:%d",
currentTimecode.Hours(), currentTimecode.Minutes(),
currentTimecode.Seconds(), currentTimecode.Frame() );
We hope this helps,
Steven
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
help.naturalpoint.com
wiki.optitrack.com
support@optitrack.com