Unique ID for an image?
Unique ID for an image?
Unique ID for an image?
Unique ID for an image?
Unique ID for an image?
Unique ID for an image? Unique ID for an image? Unique ID for an image? Unique ID for an image? Unique ID for an image? Unique ID for an image? Unique ID for an image? Unique ID for an image?
Unique ID for an image? Unique ID for an image?
Unique ID for an image?
Go Back  Xtreme Visual Basic Talk > > > Unique ID for an image?


Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2008, 03:55 AM
Birchy's Avatar
Birchy Birchy is offline
Junior Contributor
 
Join Date: Aug 2005
Location: Hereford, UK
Posts: 346
Default Unique ID for an image?


First of all, apologies if this has been asked before but i'm not 100% sure what API's i should be considering.

I'm using BitBlt() to grab various block sections of a window. At present, there are 14 unique images that i need to identify and assign a name. What i *want* to do (but not sure if this is possible), is let my app take the snapshot, return an integer, and then use that integer as an index into an array of strings. So what i am basically asking is: is it possible to convert a bitmap or image into an integer? I can't imagine this being possible, however if i don't ask i'll never know...

As a last resort i can create a library of static images and do a straight comparison on each one, however that seems a bit clunky.
Reply With Quote
  #2  
Old 03-03-2008, 04:26 AM
AdrianDeAngelis's Avatar
AdrianDeAngelis AdrianDeAngelis is offline
Contributor
 
Join Date: May 2005
Location: Australia
Posts: 549
Default

Why not use bitblt to dump the blocks of the image into their own device contexts which you store as an element in a dynamic array? You can do it in a function and get the function to return the array index where you stored the graphical information.

Eg
Code:
'create a custom type Type SnapshotData GFX as hDC 'where you store the image 'or whatever it is... been so long now X1 as integer Y1 as integer X2 as integer 'you might want these properties stored Y2 as integer Height as integer Width as integer Info as string 'you might want to stick your string in with the image End type 'create array as dynamic array Dim ImgArray() as SnapshotData 'initialize array with 0 elements Redim ImgArray(0) ImgIndex = GetImageSnapshot(X1,Y1,X2,Y2,Image) Function GetImageSnapshot(X1 as integer ,Y1 as integer, _ X2 as integer, Y2 as integer, _ Image as String) as integer 'add snapshot to array i = ubound(ImgArray()) +1 redim preserve ImgArray(i) 'create a graphical device context by loading a single black pixel and 'stick it into the array 'Load your source image blt it to new device context you have created 'cant remember exactly how to use bitblt so you fill in the blanks 'store your data 'return image array index GetImageSnapshot = i End Function
__________________
Automation error... What do you mean automation error you %#@*&!$ thing!

Star Admiral: 3D tactical space sim *** New Version 0.38 10/01/09 ***
Damage, shields and special weapons systems
Reply With Quote
  #3  
Old 03-03-2008, 04:53 AM
ELiTeHaYDeN ELiTeHaYDeN is offline
Newcomer
 
Join Date: Mar 2008
Posts: 8
Default

Quote:
Originally Posted by Birchy View Post
First of all, apologies if this has been asked before but i'm not 100% sure what API's i should be considering.

I'm using BitBlt() to grab various block sections of a window. At present, there are 14 unique images that i need to identify and assign a name. What i *want* to do (but not sure if this is possible), is let my app take the snapshot, return an integer, and then use that integer as an index into an array of strings. So what i am basically asking is: is it possible to convert a bitmap or image into an integer? I can't imagine this being possible, however if i don't ask i'll never know...

As a last resort i can create a library of static images and do a straight comparison on each one, however that seems a bit clunky.
Use the GetDIBits API(very fast) which you use to throw the image into an a byte array, make a hash of the array, then when you come to comparison, read the area you want to check against, hash it and check the hash look up table that you previously created.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Unique ID for an image?
Unique ID for an image?
Unique ID for an image? Unique ID for an image?
Unique ID for an image?
Unique ID for an image?
Unique ID for an image? Unique ID for an image? Unique ID for an image? Unique ID for an image? Unique ID for an image? Unique ID for an image? Unique ID for an image?
Unique ID for an image?
Unique ID for an image?
 
Unique ID for an image?
Unique ID for an image?
 
-->