abstract-class


OpenKinect - FreenectDevice abstract?


I am trying to setup a simple program to use OpenKinect to connect a Kinect and somehow test the communication to my laptop. I can run the demos fine, but I want to test it through code to make sure I know whats going on. So far I am still unable to connect it. The code as of now is -
#include "/usr/local/include/libfreenect.hpp"
#include <iostream>
using namespace std;
Freenect::FreenectDevice::FreenectDevice* device;
int main(int argc, char** argv) {
Freenect::Freenect k;
device = &k.createDevice<Freenect::FreenectDevice>(0); //line 8
cout<<"\ndeviceCount:"<<k.deviceCount();
return 0;
}
When I compile, it tells me
In member function ‘ConcreteDevice& Freenect::Freenect::createDevice(int) [with ConcreteDevice = Freenect::FreenectDevice]’:
test_kinect.cpp:8: instantiated from here
libfreenect.hpp:196: error: cannot allocate an object of abstract type ‘Freenect::FreenectDevice’
So the FreenectDevice class is abstract...well how am I supposed to create a device then? Am I expected to write my own class that inherits this one whenever I want to use OpenKinect? I'm very confused about how to actually use the code this library provides. I have been searching for some kind of basic tutorial, but have found nothing. If someone knows of a good tutorial, that would be the best thing for me right now. Any help is appreciated, thanks.
Well, yes, you'll need to inherit FreenectDevice and implement the two callbacks (VideoCallback and DepthCallback) that will receive the video and depth information that the Kinect registers.
The problem with examples is that there have been API changes over the lifetime of the library, so they may not all be working with the current version. Your best bet for working example code is the C++ wrapper section of the OpenKinect Wiki which has two (hopefully) current samples, and cppview.cpp included in the source distribution of libfreenect itself.

Related Links

If DateFormat is an abstract class how is it instantiated with getInstance() method
wxribbonbuttonbase dynamic label change
Initializing Variable in Subclass
Why cant we instantiate abstract class
Abstract classes error display
Abstract Classes - A glitch in my program
How to implement IXmlSerializable correctly for a ICollection<T> where T is an abstract class?
Typescript multiple inheritance workarounds?
Class diagram usage in UML
AutoMapper and Base Types
Abstract Class Initialization
Covariant return types
Empty abstract function cannot contain body
Using Visitor Pattern to detect intersection between two shapes
mongodb lift class Snippet needs to be abstract
Abstract class as return of wcf ria method

Categories

HOME
nullpointerexception
sd-card
bpmn
rsyslog
framework7
programming-languages
amazon-ecs
windows-server
pivotal-cloud-foundry
django-imagekit
dacpac
numeral.js
nstableview
circular-dependency
moonmail
oxyplot
viewport
autocad-plugin
zapier
ml
facebook-instant-articles
realex-payments-api
format-specifiers
smb
spark-jobserver
wpfdatagrid
bootstrap-duallistbox
entitlements
webkitspeechrecognition
madlib
gtrendsr
perlin-noise
scaffold
hilbert-curve
tasker
preconditions
android-tabhost
core-plot
node-gyp
arena-simulation
bootstrap-dialog
convertapi
btrace
zip4j
svmlight
nstextview
nativeapplication
knockout-components
akka-cluster
pearson
topbeat
file-writing
t4mvc
comobject
qdialog
django-unittest
angular-leaflet-directive
sframe
php-ci
myo
sailfish-os
sankey-diagram
system32
umbraco6
ng-animate
marmalade
mcts
multiprocessor
padarn
jquery-mobile-dialog
sqlperformance
viewswitcher
eclipse-templates
qt-jambi
visitor-statistic
dentrix
perfect-hash
compiler-specific
iweb
simpletest
lzh

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App