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

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
OpenKinect - FreenectDevice abstract?
Intercepting method from abstract parent on derived instance using DynamicProxy
In an UML diagram, when should a class be abstract?
Abstract Class is a good practice?
Java - Using Abstract classes properly (problem with COLT)
Technical reason for using Abstract Classes in C#/Java

Categories

HOME
coq
server
mockito
smarty
appx
onedrive
youtube-api-v3
rdf
binary-tree
gps
ip
baqend
windows-server
node-notifier
adobe-analytics
volttron
resize
carthage
serverless-framework
foselasticabundle
progressive-web-apps
transformation
introduction
autocad-plugin
clickonce
jquery-ajaxq
graphicsmagick
cas
facet
subdomains
r-raster
xquery-3.0
uisplitview
exuberant-ctags
xmlreader
wallpaper
catalog
suricata
simplexml
disassembling
dynamics-crm-2013
vapor
opshub
ncalc
bootstrap-dialog
convertapi
cubic-spline
qsslsocket
logparser
jlink
mu
jspdf-autotable
spring-mongodb
or-tools
word-vba-mac
abcpdf9
savon
mikroc
login-control
ubuntu-10.04
skype4py
ready-api
nessus
xpath-1.0
intel-fortran
jqgrid-formatter
security-testing
embedded-code
method-parameters
system32
p2
directoryservices
angularjs-ng-click
winddk
relocation
nsbutton
ceil
elliptic-curve
p4java
htmlcleaner
xceed-datagrid
resty-gwt
imdbpy
html4
spring-validator
javaspaces
assembly-loading
yslow
createwindow
asp.net-mvc-areas
gin

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