Getting no frames

Post Reply
s_ebeling
Posts: 1
Joined: Thu Jun 28, 2018 7:26 am

Getting no frames

Post by s_ebeling »

Dear NP-Support,
dear users,

as you can imagine from the topic i'm getting no frames from my S250:E camera.
Here is my setting:
- Windows 10 64bit
- SDK 1.7.2
- MS VS2015 with QT-Plugin
- TP-Link TL-SG108PE (PoE Switch)
- OptiTrack S250:E and V120:Slim

I looked at the examples from your SDK and created my own application for connecting
the cameras and show their frames. This is pretty simple but it works fine for the V120 Slim.
I also got it working for two connected V120 Slim.
But when i try to use the application for one camera with the S250:E it's not working.
The initialisation of the camera works fine:
- camera is booting and showing "UP" on it's display
- my application also returns the name of the connected camera "s250e M001631"
But when i want to start my tracking function that should return the frames, nothing happens.

I already looked into the posts of the forums, but i didn't find any solution.
I found this post, but the solution isn't explained:
https://forums.naturalpoint.com/viewtop ... 66&t=12868

Here's my source code:

Code: Select all

#pragma comment( lib, "CameraLibrary2008x64S.lib" )

#include <QFile>
#include <QTextStream>

#include <iostream>
#include <string>
using namespace std;

#include "active_marker.h"

#include "supportcode.h"

#include "cameralibrary.h"
using namespace CameraLibrary;

#include "moduleactivelabel.h"

const int kPassiveMarkerLabel = 4095;

active_marker::active_marker(QWidget *parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);

	cam_initialized = false;

	/*connect( this->ui.init_cam_button, SIGNAL( clicked( bool ) ), this, SLOT( init_camera( bool ) ) );
	connect( this->ui.cam_tracking_button, SIGNAL( clicked( bool ) ), this, SLOT( start_tracking( ) ) );*/

	captureTimer = new QTimer(this);
	captureTimer->setInterval(5);

	connect(captureTimer, SIGNAL(timeout()), this, SLOT(start_tracking()));
	connect(this->ui.init_cam_button, SIGNAL(clicked(bool)), this, SLOT(init_camera(bool)));
	connect(this->ui.cam_tracking_button, SIGNAL(clicked(bool)), captureTimer, SLOT(start()));
}

void active_marker::init_camera( bool start )
{
	CameraLibrary_EnableDevelopment( );

	CameraManager::X( ).WaitForInitialization( );

	camera = CameraManager::X( ).GetCamera( );

	CameraList cam_list;		//initialisierung???

	if ( !camera )
	{
		this->ui.display->setText( "Please connect a camera." );
	}
	else {
		this->ui.display->setText( cam_list[0].Name( ) );

		cameraWidth = camera->Width( );
		cameraHeight = camera->Height( );

		cout << cameraHeight << " - " << cameraWidth << endl;

		//== Set Video Mode ==--

		//camera->SetVideoType( Core::ObjectMode );
		camera->SetVideoType(Core::PrecisionMode);
		//camera->SetVideoType(Core::MJPEGMode);

		//== Attach an the active marker labeler to this camera     ===---

		cModuleActiveLabel * activeLabeler = new cModuleActiveLabel( );

		activeLabeler->SetEnabled( true );

		camera->AttachModule( activeLabeler );

		//== Setup synchronization settings ==--

		sSyncSettings settings;

		CameraManager::X().GetSyncSettings( settings );

		settings.Mode = SyncModeCustom;
		settings.SyncInputSource = SyncInputSourceOptiHub;

		CameraManager::X( ).ApplySyncSettings( settings );

		//== Adjust camera exposure ==--

		camera->SetExposure( 200 );

		//== Start camera output ==--

		camera->Start( );

		//== Turn on some overlay text so it's clear things are     ===---
		//== working even if there is nothing in the camera's view. ===---

		camera->SetTextOverlay( true );

		cam_initialized = true;
	}
}

void active_marker::start_tracking( )
{

	//cout << "start_tracking" << endl;


	if (cam_initialized) {

		unsigned char imgBuffer[640 * 480];

		Frame *frame = camera->GetLatestFrame();
		//Frame *frame = camera->GetFrame();

		//if (frame == NULL) return;

		if (frame) {
			this->ui.display->setText("got a frame");

			int object_count = frame->ObjectCount();

			cout << object_count << endl;

			//coordinates for each object
			//if (object_count < 3) {
			for (int i = 0; i < object_count; i++) {
				cObject *object = frame->Object(i);

				cout << "coordinates object_" << i << ": " << endl;
				cout << "x: " << object->X() << endl;
				cout << "y: " << object->Y() << endl;
			}
			//}

			frame->Rasterize(640, 480, 640, 8, imgBuffer);

			QImage *displayBufferImg = new QImage(
				imgBuffer,
				cameraWidth,
				cameraHeight,
				QImage::Format_Grayscale8
			);

			this->ui.display->setPixmap(QPixmap::fromImage(*displayBufferImg));
			//displayBufferImg->save("capture.jpg", 0, -1);

			frame->Release();
		}else {
			this->ui.display->setText("no frames");
		}
	}
	else {
		this->ui.display->setText("Please initialize a camera at first.");
	}
	
}

Can you tell me what i'm doing wrong or what i'm missing?

I added two attachments:
- one that shows that the initialisation works fine (screenshot_after_initialisation.png)
- other one shows that there are no frames found/returned (screenshot_after_tracking.png)

Thanks for your help :)

Best Regards,
Stephan
Attachments
screenshot_after_tracking.png
screenshot_after_tracking.png (7.71 KiB) Viewed 2501 times
screenshot_after_initialisation.png
screenshot_after_initialisation.png (9.44 KiB) Viewed 2501 times
Post Reply