get live film from a camera by ported usb or other

Just starting out? Need help? Post your questions and find answers here.
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: get live film from a camera by ported usb or other

Post by JHPJHP »

I've only scratched the surface with the few functions included in the pbi, but there are literally 100s to choose from.
- I don't mind continuing if there is interest, otherwise this will probably be my last update

Updated
- New Functions (opencv.pbi)
-- cvCreateTrackbar
-- cvGetTrackbarPos
-- cvSetTrackbarPos
-- cvCreateMat (I could not get cvCreateImage working with PureBasic, but the newer cvCreateMat worked flawlessly)
-- cvReleaseImage
- Multiple changes to Constants, Structures, and Procedures
Last edited by JHPJHP on Thu Oct 31, 2013 11:41 pm, edited 2 times in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: get live film from a camera by ported usb or other

Post by Mythros »

I am VERY interested in this! PLEASE continue it! I will continue providing beta test support for you! :)

Also, I will check the DLLs for the camera in a few mins.

Also, is there a way to make the AVI videos 30+ FPS & add captured sound to them from Line-in?

That would be GREAT!

Thanks again, JHP! :)

Mythros
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: get live film from a camera by ported usb or other

Post by JHPJHP »

Hi Mythros,

From what I read OpenCV doesn't deal with audio, but I'll see what I can find.

To increase the FPS, modify the following function:
- change the 7 to your desired speed - 30 FPS should be no problem
- FPS is only determined by your camera's limit, and what processing is done after each capture

Code: Select all

*writer = cvCreateVideoWriter(sVideo, CV_FOURCC("M", "S", "V", "C"), 7, @size, 0)

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: get live film from a camera by ported usb or other

Post by Mythros »

It didn't work. :(

It's still not detecting my camera...

Here's an image of where I have the files:

http://oi41.tinypic.com/2yzht2f.jpg
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: get live film from a camera by ported usb or other

Post by JHPJHP »

Looks like your still missing the following DLLs:
- Kinect.dll
- OniFile.dll
- PS1080.dll
To use this driver module, simply put the precompiled dll file(OpenCVCamera32.dll or OpenCVCamera64.dll) in the folder "\OpenNI2\Drivers".
(Where should also has PS1080.dll, OniFile.dll and Kinect.dll)
Missing PrimeSense and possibly the Kinect SDK?
Sorry, it's hard for me to do anything more then this - I'm a Trial & Error kinda programmer. :wink:

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: get live film from a camera by ported usb or other

Post by Mythros »

I think there MAY be a way, but only if you can get PureBasic to work with Python, possibly via OpenCV. And the above didn't work, btw.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: get live film from a camera by ported usb or other

Post by IdeasVacuum »

OpenNI + OpenCV + PB = ?
I think if the goal is to use PB with Carmine/Kinect devices, then an OpenNI wrapper might be the best choice, or perhaps the Microsoft SDK: Kinect For Windows 1.8

Perhaps someone could request an OpenNI lib to be added to PB?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: get live film from a camera by ported usb or other

Post by Mythros »

That would be GREAT... But afaic, C++ doesn't like me, and I don't like C++.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: get live film from a camera by ported usb or other

Post by IdeasVacuum »

With a PB Wrapper, you won't have to worry about C++ (incidently, for devices, the C++ files tend to contain a lot of C, which is easier to follow as it's not so different to Basic).
Interestingly, there is a Kinect Wrapper on the German Forum:
http://www.purebasic.fr/german/viewtopi ... 4&start=10
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: get live film from a camera by ported usb or other

Post by Mythros »

Grrr. that makes me SO mad.. WHY must it use a C file? WHY?! :'(

Can someone please make a wrapper for Carmine 1.09 / Kinect? :(
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: get live film from a camera by ported usb or other

Post by JHPJHP »

The following update includes some examples of what OpenCV can do with images.
- the trick to get some of the functions working was not trusting the documentation 100%
-- cvCreateImage does work with PureBasic, but its parameters were not documented correctly
- added the WindowCallback Procedure to all examples
- flip.pb now has a working example of cvTrackbarCallback
- added the following examples: canny.pb, gray.pb

Update
- added a resize routine to the relevant examples
- added a second swap.pb example... just another way to accomplish a similar result
Last edited by JHPJHP on Fri Nov 01, 2013 12:29 am, edited 2 times in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: get live film from a camera by ported usb or other

Post by IdeasVacuum »

Can someone please make a wrapper for Carmine 1.09 / Kinect?
Did you try this one Mythros?
http://www.purebasic.fr/german/viewtopi ... 4&start=10
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: get live film from a camera by ported usb or other

Post by Mythros »

I tried to get it to work, but I couldn't. for one, I don't understand a word of German, and also, I think it requires some kind of C files, and me & C don't go good together at all.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: get live film from a camera by ported usb or other

Post by IdeasVacuum »

Well, the code is in English :) You don't need to worry about the C code because that is what the PB Wrapper is for.
Download CL NUI SDK (The C code SDK that the PB wrapper is for).

Bottom-right hand corner of their webpage.
http://codelaboratories.com/nui

This is a binary installer, does the work for you. It puts an icon on your desktop, a test app to see if CL NUI can find your Kinect.

It adds a folder in Program Files for the SDK, which includes the lib file that the PB code wraps. The path is something like this (I'm using WinXP): C:\Program Files\Code Laboratories\CL NUI Platform\SDK\Lib

In the PB wrapper code, find the line

Code: Select all

ImportC "CLNUIDevice.lib"
and change that to be the full path to the lib. Dige has posted some sample PB code in a further message on the same forum post. So, give it a go!
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: get live film from a camera by ported usb or other

Post by IdeasVacuum »

...by the way, there is absolutely no need for an aversion to C. If you can code in PB, then you can definitely code in C, it is a very simple language. You will find that to be true if you just give it 30 minutes of your time:
C Programming in Easy Steps
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply