joaquimrocha / Skeltrack

A Free Software skeleton tracking library
GNU Lesser General Public License v3.0
294 stars 63 forks source link

Problems compiling on Windows #18

Open joaquimrocha opened 10 years ago

joaquimrocha commented 10 years ago

Opening this issue after @bosraj comment on one that was not related:

Hi ,

I have couple of questions on skeltrack and also not familiar with c++ code.

1.Whether skeltrack has any version available for windows platform. 2.I have downloaded skeltrack application and customized for us in microsoft visual studio 2012.I have included all the header files and source files from the github. But it shows so many errors.

So please help me in solving this errors and achieve my goal to convert this application to be run on windows environment with microsoft kinect 2.0 or higher version

skeltrackerrorwindows

Thanks Bos

joaquimrocha commented 10 years ago

Hi Bos,

Do you have Glib development files installed? That is the library with which Skeltrack is developed. For building GFreenect you need Glib and Freenect.

I do not use Windows so I cannot really try it myself.

Please keep us posted,

bosraj commented 10 years ago

Thanks joa, I have downloaded glib and freenect files from "http://www.opensource.apple.com/source/X11misc/X11misc-20/pkg-config/pkg-config-0.25/glib-1.2.10/glib.h" and added as header files in my project.

Whether glib development files available for windows?

bosraj commented 10 years ago

Hi, i have downloaded the development files from the following path and included it in skeltrack application for windows environment. http://www.gtk.org/download/win64.php

During compilation of the skeltrack in windows.I am flooded with errors.But for most of the methods i need to declare it.

Example 1:- skeltrack-util.c

Label new_label (gint index) { Label label = g_slice_new (Label); label->index = index; label->parent = label; label->nodes = NULL; label->bridge_node = NULL; label->to_node = NULL; label->lower_screen_y = -1; label->higher_z = -1; label->lower_z = -1; label->normalized_num_nodes = -1;

return label; }

the method g_slice_new (Label) is used without declaration,. so i had declare it like this #define g_slice_new(type) g_new(type, 1) and it solve that error.

Example 2:-

define GLIB_SYSDEF_AF_UNIX 1

define GLIB_SYSDEF_AF_INET 2

define GLIB_SYSDEF_AF_INET6 10

define GLIB_SYSDEF_MSG_OOB 1

define GLIB_SYSDEF_MSG_PEEK 2

define GLIB_SYSDEF_MSG_DONTROUTE 4

after defining the above lines in gioenums.h ,the error related to gioenums.h is rectified

Like this in most of the pages the methods are used with out declaration.Whether it works for gnome,if so gnome is accepting without any definition.

It will be useful to me, if you have any code or site for definition of methods that you have used in your skeltrack application, so that i could refer those for build upon windows.

Thanks

joaquimrocha commented 10 years ago

Hi @bosraj,

I think the GLib you're using is just too old. Have you installed the binaries and everything from the page you mentioned? ( http://www.gtk.org/download/win64.php ) Those should work, g_slice_new is available since glib 2.10, for example.

bosraj commented 10 years ago

hi

I almost done with the skeltrack library on windows. Here i am having some error like

Error 10 error C2664: 'g_simple_async_result_new' : cannot convert parameter 4 from 'void ()(SkeltrackSkeleton ,guint16 ,guint,guint,GCancellable ,GAsyncReadyCallback,gpointer)' to 'gpointer' E:\SkeltrckTest\SkeltrckTest\skeltrackapps2\skeltrackapps2\skeltrack-skeleton.c 1895 1 SkeltrackApps2

this is the function where i am having this issue

void
skeltrack_skeleton_track_joints (SkeltrackSkeleton self, guint16 buffer, guint width, guint height, GCancellable cancellable, GAsyncReadyCallback callback, gpointer user_data) { GSimpleAsyncResult result = NULL;

g_return_if_fail (SKELTRACK_IS_SKELETON (self) && callback != NULL && buffer != NULL);

result = g_simple_async_result_new (G_OBJECT (self), callback, user_data, skeltrack_skeleton_track_joints); //****at this line i am having that issue

if (self->priv->track_joints_result != NULL) { g_simple_async_result_set_error (result, G_IO_ERROR, G_IO_ERROR_PENDING, "Currently tracking joints"); g_simple_async_result_complete_in_idle (result); g_object_unref (result); return ; }

g_mutex_lock (&self->priv->track_joints_mutex);

self->priv->track_joints_result = G_ASYNC_RESULT (result);

/* @TODO: Set the cancellable */

self->priv->buffer = buffer;

if (self->priv->buffer_width != width || self->priv->buffer_height != height) { clean_tracking_resources (self);

  self->priv->buffer_width = width;
  self->priv->buffer_height = height;
}

g_simple_async_result_run_in_thread (result, track_joints_in_thread, G_PRIORITY_DEFAULT, cancellable);

g_mutex_unlock (&self->priv->track_joints_mutex); return ; }

for the time being i just replace that calling function parameter skeltrack_skeleton_track_joints to user_data in the g_simple_async_result_new. in order to check whether other code is compiled successfully.

the skeltrack lib is build successfully

now i added this lib to a test file test-kinect.c at the same time i also build Gfreenect lib and added those ref to the project

But now here i am getting these error

Error 1 error LNK2019: unresolved external symbol _g_mutex_init referenced in function "void __cdecl skeltrack_skeleton_init(struct _SkeltrackSkeleton *)" (?skeltrack_skeleton_init@@YAXPAU_SkeltrackSkeleton@@@Z) E:\SkeltrckTest\SkeltrckTest\SkeltrackApps2.lib(skeltrack-skeleton.obj) SkeltrckTest

Error 2 error LNK2019: unresolved external symbol _g_mutex_clear referenced in function "void __cdecl skeltrack_skeleton_finalize(struct _GObject *)" (?skeltrack_skeleton_finalize@@YAXPAU_GObject@@@Z) E:\SkeltrckTest\SkeltrckTest\SkeltrackApps2.lib(skeltrack-skeleton.obj) SkeltrckTest

Error 3 error LNK2019: unresolved external symbol _g_mutex_lock referenced in function "void __cdecl track_joints_in_thread(struct _GSimpleAsyncResult ,struct _GObject ,struct _GCancellable *)" (?track_joints_in_thread@@YAXPAU_GSimpleAsyncResult@@PAU_GObject@@PAU_GCancellable@@@Z) E:\SkeltrckTest\SkeltrckTest\SkeltrackApps2.lib(skeltrack-skeleton.obj) SkeltrckTest

Error 4 error LNK2019: unresolved external symbol _g_mutex_unlock referenced in function "void __cdecl track_joints_in_thread(struct _GSimpleAsyncResult ,struct _GObject ,struct _GCancellable *)" (?track_joints_in_thread@@YAXPAU_GSimpleAsyncResult@@PAU_GObject@@PAU_GCancellable@@@Z) E:\SkeltrckTest\SkeltrckTest\SkeltrackApps2.lib(skeltrack-skeleton.obj) SkeltrckTest

Error 5 error LNK2001: unresolved external symbol "int * distances" (?distances@@3PAHA) E:\SkeltrckTest\SkeltrckTest\SkeltrackApps2.lib(skeltrack-skeleton.obj) SkeltrckTest

Error 6 error LNK1120: 5 unresolved externals E:\SkeltrckTest\SkeltrckTest\Debug\SkeltrckTest.exe

i could not understand the actual reason and how to solve that could you please help me in these sort of things .

Thanks

bosraj commented 10 years ago

hi,

i have two solutions , one is skeltrack library which has all the glib libraries.Next one is skeltracktest application which has test-skeleton.c and test-kinect.c through which i will see the output.So i builded the skeltrack library and included in the skeltracktest application.The skeltrack library is builded successfully , when i included this library in the skeltracktest application i got the above errors, so after scrutinizing the errors it was identified that i am missing some libraries in skeltrack library.So again i added the missing libraries in the skeltrack library and included it in skeltracktest application.Now i am happy to see the application builds without any errors.

when i try to run the skeltracktest application, it opens command prompt by showing the following path /skeltrack/skeleton/init

and followed by the exception skeltrackwithlibs.exe 7196 : Glib-Gobject-CRITICAL **; gtype.c:2720: you forgot to call g_type_init()

and i dont know how to proceed after that,please guide me.

so i have couple of questions about the output of the skeltrack application.

1.what ouput i will view when i run the test-skeleton.c

2.what are the inputs to give for running test-kinect.c

Thanks

joaquimrocha commented 10 years ago

Hi @bosraj ,

Can you call g_type_init() in the test-kinect's main?

The test-kinect should show a window with the skeleton being tracked and drawn in real time, as well as the video capture by the RGB camera of the Kinect.

Cheers,

bosraj commented 10 years ago

thanks joa.

Actually i want to pass microsoft kinect depth frames.So i need to run and see test-skeleton.c first.

IN the main() you are passing depth-files in the loop and call g_test_run();

If i execute the main() in test-skeleton.c what will be the output?

now if i execute my application it throws following error.

First-chance exception at 0x000007FB9B9F3EF8 (ntdll.dll) in SKELTRACKWITHLIBS.exe: 0xC0000026: An invalid exception disposition was returned by an exception handler.

please tell me how to come out of this error?

Thanks Bos

bosraj commented 10 years ago

Hi , I am breaking my head to understand the functionality of callback mechanism in Glib (GAsyncReadyCallback) which is used in your files. --- When this On_TRACK_JOINTS will be called

In skeltrack application, in the test-kinect.c file , when kinect is connected to the system it calls the on-depth-frame function and inside that it calls skeltrack_skeleton_track_joints function which has on_track_joints function a callback parameter.

my doubt is whether this callback function (on_track_joints) will be called,if so please suggest me what input i have to give inorder to call this on_track_joints.

when i debug and see this skeltrack_skeleton_track_joints function in test-kinect.c, it passes and executes the following lines in skeltrack-skeleton.c file.

result = g_simple_async_result_new(G_OBJECT(self), callback, user_data, skeltrack_skeleton_track_joints);

and in the last it executes the following line and come out of the function g_simple_async_result_run_in_thread(result, track_joints_in_thread, G_PRIORITY_DEFAULT, cancellable);

finally it comes out of the skeltrack_skeleton_track_joints function in test-kinect.c by not executing on_track_joints which is callback in that function.

So please suggest me what mistake i am doing or please tell me how the callback function works.

Thanks Bos

bosraj commented 10 years ago

Hi,

HURRAY !!! Now asynchronous callback is working and i am able to get the joints.But the joints position is not returning correctly for left shoulder,right shoulder,left elbow ,right elbow,left hand and right hand.I have attached the screenshots for your reference.

Please suggest me where i am going wrong!

Thanks

BOS screenshot1 screenshot2 screenshot3 screenshot4

joaquimrocha commented 10 years ago

Hi @bosraj , Sorry for the delay in replying. Maybe the joints are off due to the position of the Kinect. Could you try with the Kinect more or less at the height of your chest?

Cheers,

UsingtcNower commented 9 years ago

Hi @bosraj , I also met the below error Glib-Gobject-CRITICAL **; gtype.c:2720: you forgot to call g_type_init(), could you please suggest how to debug/resolve it?