Jump to content


Photo

Visual Library V0.2 [updated 17 March 2010]


  • Please log in to reply
31 replies to this topic

#1 robogame

robogame

    Programming

  • GMC Member
  • 85 posts

Posted 29 December 2009 - 02:50 AM

The Visual Library DLL is based on OpenCV and allows Game Maker developers to access and analyze webcam images. The current release is a testing release that includes function documentation, an GM7 example, the Visual Library DLL, and the necessary OpenCV DLLs. Feedback is appreciated and will help revise the Visual Library.

Features
  • Webcam and video file access
  • Motion detection
  • Color detection
  • Multiple point tracking (up to 256)
Current limitations
  • No webcam selection (automatically selects default)
  • Game speed is limited to webcam capture speed
  • Requires OpenCV DLLs (around 5MB)
Change list
0.2:
  • Image and process updating now runs in a seperate thread automatically
    • vl_update has been removed because of this
  • The vl_init function has been turned into two functions:
    • vl_init_webcam for webcam images
    • vl_init_file for video files
  • Images are passed to the program directly using GMAPI instead of to an image file that was loaded into the game
    • The path parameters of the vl_init_* functions have been removed because of this
  • Fixed the one frame lag of the detection points
  • Fixed major memory leak
  • The OpenCV library is now statically linked into the VisualLibrary.dll meaning that the seperate OpenCV DLLs are no longer necessary
  • Simple support for video files has been added (vl_init_file)
    • The vl_video_pause and vl_video_set_position functions have been added to control video
Downloads

Current release:

VisualLibrary v0.2 (~1.7MB)

Previous releases:

VisualLibrary v0.1a (~2.4MB)

VisualLibrary v0.1 (~2.0MB)


Edited by robogame, 18 March 2010 - 12:31 AM.

  • 0

#2 Psycho The Game

Psycho The Game

    Shattered Core Games

  • New Member
  • 88 posts

Posted 29 December 2009 - 03:18 AM

I get an unexpected error when I run... GM7 Windows 7 X64
  • 0
Sigh

#3 robogame

robogame

    Programming

  • GMC Member
  • 85 posts

Posted 29 December 2009 - 03:38 AM

I get an unexpected error when I run... GM7 Windows 7 X64

The version posted has only been tested on a 32-bit version of Windows XP, I will try to investigate the cause of this problem if I am able to test it on another operating system.

Edited by robogame, 29 December 2009 - 03:45 AM.

  • 0

#4 LoopStan

LoopStan

    North-See Developer

  • GMC Member
  • 1398 posts

Posted 04 January 2010 - 01:56 AM

This is really interesting! I had some fun playing around with this before i knocked my webcam off my computer and broke it Haha! Good job :)
  • 0

Posted Image


#5 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 08 January 2010 - 09:11 AM

This is very interesting but why limit the game speed to the webcam capture speed?
  • 0
GM 8.1 / GM:HTML5 User

#6 molbal

molbal

    GMC Member

  • GMC Member
  • 59 posts
  • Version:GM:Studio

Posted 10 January 2010 - 10:26 AM

COOOOOOOL! ;)
  • 0

#7 robogame

robogame

    Programming

  • GMC Member
  • 85 posts

Posted 21 January 2010 - 02:06 AM

This is very interesting but why limit the game speed to the webcam capture speed?

This is an issue caused by the OpenCV function that retrieves the frame which does not return until a new frame is captured. Since the update function that captures the new image is called every frame in the step event, the program is halted until a new frame is captured, limiting the frame rate to the camera's capture speed. I am looking at different options to circumvent this limitation.
  • 0

#8 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 21 January 2010 - 11:54 AM

This is an issue caused by the OpenCV function that retrieves the frame which does not return until a new frame is captured. Since the update function that captures the new image is called every frame in the step event, the program is halted until a new frame is captured, limiting the frame rate to the camera's capture speed. I am looking at different options to circumvent this limitation.


Maybe you could make that function threaded?
  • 0
GM 8.1 / GM:HTML5 User

#9 krele

krele

    GMC Member

  • GMC Member
  • 640 posts
  • Version:GM:Studio

Posted 07 February 2010 - 11:48 PM

Holy hell this is awesome! Sorta reminds me of EyeToy games =D

You do know this might be revolutionary for gm, right?
  • 0

If I helped you, you can help me back :3

Brocoola


#10 Samuka97

Samuka97

    GMC Member

  • GMC Member
  • 465 posts
  • Version:Unknown

Posted 08 February 2010 - 09:47 PM

Oh god. Think about this: Place the webcam looking to your monitor, detect the motion of your finger and simulate mouse clicks where your finger is!


touch screen :)
  • 0

#11 faizan 25

faizan 25

    GMC Member

  • GMC Member
  • 140 posts

Posted 11 February 2010 - 02:40 PM

wow nice but i also get unexpected error occured by the way where can we download the OpenCV Dlll please I always search before asking!!!
Really NEED Motion Detection!
  • 0

#12 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 11 February 2010 - 08:14 PM

Would it be difficult to add support for using a video file such as avi for the source as an optional alternative to a camera? This would be nice to make some custom video-effects with the point tracking and such
  • 0

#13 Jalage

Jalage

    GMC Member

  • New Member
  • 29 posts

Posted 15 February 2010 - 09:34 PM

Nice! I might use this.
  • 0

#14 garrlker

garrlker

    GMC Member

  • GMC Member
  • 349 posts

Posted 26 February 2010 - 03:10 AM

Ok. I actually went out and bought a webcam juts for this and I'm glad I did. It was so worth it and I will use it. I'l fight some reason too. Idk if tis my labtop or my webcam(supposed to get 30fps) but I get 8 fps on this. Prolly my labtop but is anyone else getting slow frame rates?
  • 0

#15 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 28 February 2010 - 12:24 AM

I'm sure its just this, I got around 10 FPS on my brand new PC (new webcam too). It's because it saves to a file and loads it for the game to display. That method is slow. There is a better way of doing this, you can use GMAPI to modify the image directly without needing to save or load.
  • 0

#16 LoopStan

LoopStan

    North-See Developer

  • GMC Member
  • 1398 posts

Posted 17 March 2010 - 12:07 AM

I get the unexpected error.
Windows XP Home SP3 32Bit
I am using the cam with another app, if it still doesn't work without it then ill edit. But yeah.
  • 0

Posted Image


#17 robogame

robogame

    Programming

  • GMC Member
  • 85 posts

Posted 18 March 2010 - 12:43 AM

Thanks everybody for testing out Visual Library, I just released the new version which addresses some of the issues that have been raised here and adds some preliminary support for video loading. The current list of video formats that are supported is limited, for more information on supported formats see the OpenCV page: VideoCodecs. As mentioned in the change list, the OpenCV library has been statically linked into the main VisualLibrary DLL so that the additional OpenCV DLLs that were required before are no longer needed and the total file size for adding OpenCV support has decreased. I am not sure if this update will also fix some of the unexpected errors that have been occurring, but statically linking both the OpenCV libraries and the Windows libraries may have fixed the problem (or some of the occurrences).
  • 0

#18 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 18 March 2010 - 01:46 AM

Excellent! Thank you so much :)
  • 0

#19 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 18 March 2010 - 05:44 PM

Doesn't work. It starts up, the text shows up, and my computer becomes unresponsive. Completely. I had to force close it, so it left my webcam on :)
Running on Windows Vista Laptop with built-in Acer webcam, on GM7. It doesn't work at all on GM8.
  • 0

Posted Image


#20 komododragon

komododragon

    GMC Member

  • GMC Member
  • 47 posts

Posted 25 April 2010 - 11:04 PM

I was working with the new version (pretty sweet btw) and I noticed I could not get the same quality I did out of the first one.

The reason I think that was is that in the old version I made it save the image (Now you use GMMAPI though) to a .png which has higher quality than a .bmp.

Could you make it so that it goes through a better image format?
  • 0
"If knowledge can create problems, it is not through ignorance that we can solve them." - Isaac Asimov

#21 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 26 April 2010 - 01:43 AM

.png which has higher quality than a .bmp.

Both are lossless, best quality.
  • 0

#22 Recreate

Recreate

    Furry

  • GMC Member
  • 2992 posts
  • Version:GM:Studio

Posted 04 May 2010 - 05:52 PM

I think he meant higher compression. So to speak. And smaller.

Also, Tried it. It just crashes. Shows the "this program has stopped responding" messagebox. In windows 7. The webcam works fine.

Edited by Recreate, 04 May 2010 - 05:56 PM.

  • 0

If the post that you are reading was created prior to 2011. For the safety of the general public, It is not to be regarded under any circumstances.
Please don't ask me to join your group at anything.


#23 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 04 May 2010 - 07:11 PM

More compression can mean more lag, so I don't know what you're talking about... It depends on the CPU speed for compression, and the disk speed for no compression.
  • 0

#24 Recreate

Recreate

    Furry

  • GMC Member
  • 2992 posts
  • Version:GM:Studio

Posted 04 May 2010 - 07:12 PM

Well, BMP images are "raw" and large. PNG images are more compressed and smaller. I think what might be causing lag is the HDD read speed. So if you used PNG images, they are smaller. And less time reading the image off of the disk and more time processing it.
  • 0

If the post that you are reading was created prior to 2011. For the safety of the general public, It is not to be regarded under any circumstances.
Please don't ask me to join your group at anything.


#25 gamegecko

gamegecko

    GMC Member

  • New Member
  • 308 posts

Posted 19 May 2010 - 10:25 PM

works slow and glitchy for about 10-15 seconds then the dll crashes
cant even display any sort of distinguishable video

Edited by gamegecko, 19 May 2010 - 10:36 PM.

  • 0

#26 Catan

Catan

    GMC Member

  • GMC Member
  • 357 posts
  • Version:Unknown

Posted 21 June 2010 - 08:10 AM

This dll is amazing! Too bad it is too glitchy on my system (vista) to be used on any project. It just randomly crashes the game just after the loading, and causes always strange errors when closing the game.

I really hope you are going to improve the stability of the dll because I love it, good job so far
  • 0

.

GMSDB - A pure GML database system

GMGL - Game updater and launcher

AutoTiles Helper - An autotiling system


#27 robogame

robogame

    Programming

  • GMC Member
  • 85 posts

Posted 22 June 2010 - 10:21 AM

I was working with the new version (pretty sweet btw) and I noticed I could not get the same quality I did out of the first one.

The reason I think that was is that in the old version I made it save the image (Now you use GMMAPI though) to a .png which has higher quality than a .bmp.

Could you make it so that it goes through a better image format?

The lower image quality is not caused by compression because in version 0.2 the only difference in image handling is that instead of sending the image data to a bitmap file, it is sent directly to memory involving no compression. The only explanation I can think of is that the DLL sent a different size of texture than what is actually expected in memory due to DirectX restrictions (which is a bug that will be fixed in the next version). I am not completely sure this is the cause, but the previously mentioned bug also caused the image to be displayed incorrectly for some users.

This dll is amazing! Too bad it is too glitchy on my system (vista) to be used on any project. It just randomly crashes the game just after the loading, and causes always strange errors when closing the game.

I really hope you are going to improve the stability of the dll because I love it, good job so far

Most of the instability issues seem to be caused by the incorrect handling of threads in the DLL. This and other issues will be addressed in the next version of VisualLibrary which should be released this week.

Edit: The update is taking a little longer than expected, so it may be a few more days before the next version is released.

Edited by robogame, 29 June 2010 - 02:26 AM.

  • 0

#28 joshsora

joshsora

    GMC Member

  • GMC Member
  • 32 posts
  • Version:GM8

Posted 17 June 2011 - 03:46 PM

how do i do color detection?
  • 0

#29 _249112

_249112

    GMC Member

  • New Member
  • 8 posts

Posted 23 January 2012 - 02:06 PM

any updates ?
  • 0

#30 DefuzionGames

DefuzionGames

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:Unknown

Posted 27 March 2012 - 09:48 PM

when ever you exit the program i get two different error dialogs. I have windows 7 64 bit
  • 0

#31 master123

master123

    GMC Member

  • GMC Member
  • 68 posts
  • Version:GM8

Posted 09 April 2012 - 12:37 AM

Update the speed of it PLEASE!
  • 0

#32 Hey you

Hey you

    GMC Member

  • New Member
  • 2 posts
  • Version:GM:Studio

Posted 31 October 2013 - 06:08 AM

 
I know the project is dead are long time. For Halloween I wanted to get it out of the grave. I wonder if not one of the experts here can make the DLL compatible for GM studio.

  • 0