Hi all,
I'm doing a little project (big for me because I'm pretty much a noob). I have this soltaire game and when a card is captured. I want that card to be colored with a blue background. In other words, that its been played.
How would you go about comparing 1 card say the ace of spades to that same card in another picturebox? Meaning The card is capture in one picturebox and the other picturebox will turn a certain color, making it disappear.
My pseudo code is something like this:
If pictbox1 = pictbox2 Then
color that pictbox2 to blue
Else leave it visible
End IF
So the real problem is how do I compare images and define them, like a .bmp to the same image as in ,say pictbox2.
Could I find a specific hex color on the card and then the card in pictbox2 disappears. How would you define hex color and how would you analzye it?
Sorry for the many questions. If you have a question I can clear it up for you.
Thanks
PS working with vb.net 2005
14 2612
Hi all,
I'm doing a little project (big for me because I'm pretty much a noob). I have this soltaire game and when a card is captured. I want that card to be colored with a blue background. In other words, that its been played.
How would you go about comparing 1 card say the ace of spades to that same card in another picturebox? Meaning The card is capture in one picturebox and the other picturebox will turn a certain color, making it disappear.
My pseudo code is something like this:
If pictbox1 = pictbox2 Then
color that pictbox2 to blue
Else leave it visible
End IF
So the real problem is how do I compare images and define them, like a .bmp to the same image as in ,say pictbox2.
Could I find a specific hex color on the card and then the card in pictbox2 disappears. How would you define hex color and how would you analzye it?
Sorry for the many questions. If you have a question I can clear it up for you.
Thanks
PS working with vb.net 2005
I think your problem is pretty complicated
which Database you are using?
use control array and diff pic in that
I'm not using a database. I think I need to research more on visual basics. This is over my head. I started about a month ago so maybe I can refine my questions with more research and studying.
Thanks for the reply
I'm not using a database. I think I need to research more on visual basics. This is over my head. I started about a month ago so maybe I can refine my questions with more research and studying.
Thanks for the reply
is your project is an playing cards
No its not making a card game..its basically a cardcounter. Really I need to know how to compare .bmp. Or images. Like what API do I call or methods?
I looked around the net and have not came to a tutorial on this, however I came to things that are similiar in nature of what I want to do. It's just not clicking, and maybe some one could throw out some ideas on how these can be achieved. Namely, comparing images to other images.
Moreover the game is already made.
Thanks
No its not making a card game..its basically a cardcounter. Really I need to know how to compare .bmp. Or images. Like what API do I call or methods?
I looked around the net and have not came to a tutorial on this, however I came to things that are similiar in nature of what I want to do. It's just not clicking, and maybe some one could throw out some ideas on how these can be achieved. Namely, comparing images to other images.
Moreover the game is already made.
Thanks
Image or picture controls are basically to display purpose only.
If you want to compare there may be two ways
1. Give different names or each image which you are going to compare.
2. Give different path or each image which you are going to compare.
I think comparing images is not the way to go here. As suggested above, I think you need to define unique names for each card and associate the names with the proper images, possibly using an array or collection. Then you need to have your code keep track of which cards played. I don't use .Net so I can't suggest the best method there. In VB6, I'd play with something like - assuming you have 52 card images 0-51: -
Option Explicit
-
-
Private Type Card
-
-
cName As String
-
cFace As String
-
cPlayed As Boolean
-
-
End Type
-
-
Private Sub cmd_Click()
-
CreateDeck
-
End Sub
-
-
Private Sub CreateDeck()
-
-
Dim Deck(51) As Card
-
Dim intSuit As Integer
-
Dim intCard As Integer
-
Dim intValue As Integer
-
Dim intFace As Integer
-
Dim strFaces(51) As String
-
Dim CardValue()
-
Dim CardSuit()
-
-
CardSuit = Array("Hearts", "Diamonds", "Clubs", "Spades")
-
CardValue = Array("Ace", "Two", "Three", "Four", "Five", "Six", _
-
"Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King")
-
-
intCard = 0
-
-
For intFace = 0 To 51
-
strFaces(intFace) = "E:\Temp\Cards\" & intFace & ".gif"
-
Next intFace
-
-
For intSuit = 0 To 3
-
For intValue = 0 To 12
-
Deck(intCard).cName = CardValue(intValue) & " of " & CardSuit(intSuit)
-
Deck(intCard).cFace = strFaces(intCard)
-
Deck(intCard).cPlayed = False
-
intCard = intCard + 1
-
Next intValue
-
Next intSuit
-
-
End Sub
-
-
Private Sub Method_1()
-
'---------------------------------------------------
-
'Using type variables
-
-
Dim ThisCard As Card
-
Dim ThatCard As Card
-
-
ThisCard = Deck(0)
-
ThatCard = Deck(51)
-
-
picCard1.Picture = LoadPicture(ThisCard.cFace)
-
ThisCard.cPlayed = True
-
MsgBox ThisCard.cName & " Played"
-
-
ThatCard = Deck(51)
-
picCard2.Picture = LoadPicture(ThatCard.cFace)
-
-
If ThatCard.cPlayed = True Then
-
picCard2.Picture = Nothing
-
End If
-
-
End Sub
-
-
Private Sub method_2()
-
'---------------------------------------------------
-
'Using array subscript directly and tag property of PictureBox
-
picCard1.Picture = LoadPicture(Deck(0).cFace)
-
picCard1.Tag = 0
-
MsgBox Deck(0).cName & " Played"
-
-
picCard2.Picture = LoadPicture(Deck(51).cFace)
-
picCard1.Tag = 51
-
-
If picCard2.Tag = picCard1.Tag Then
-
picCard2.Picture = Nothing
-
End If
-
-
End Sub
-
That may be overly complex - all you really need is an array of 52 cards with the images and refer to the array subscript. That's my general idea. If you have an array of picturebox controls, you can easily load card(1) into pic(1), etc. You can use another array of booleans to track which cards have been played if you need that. Just keep track of which card is displayed where and that should do it. Comparing the actual bitmaps would be difficult and IMO unnecessary here.
An even better solution would be to use the cards.dll that Windows Solitare uses - there's a tutorial here:
http://www.codeproject.com/csharp/drawcardscp1.asp
It's in C# though, maybe you can find a VB.Net version. The dll does a lot of the work of drawing and moving cards for you but I don't know if it tracks the play - you may still have to do that yourself.
Heres a VB6 version:http://www.catch22.net/tuts/cardtut.asp with an example. Search around, there are probably several example card games in VB that may give you some ideas also.
Yes, I too think about that, but he told it’s not a card game. Refer thread #4 and #5. I think he mean, to refer images directly
Yes, I too think about that, but he told it’s not a card game. Refer thread #4 and #5. I think he mean, to refer images directly
The point is, you should be comparing the values which are represented by the images - not the images themselves. Comparing images is a very "expensive" process. The images should be seen as simply a visual indication of what value is being manipulated in the program.
The point is, you should be comparing the values which are represented by the images - not the images themselves. Comparing images is a very "expensive" process. The images should be seen as simply a visual indication of what value is being manipulated in the program.
Comparing images is a very "expensive" process.
My head is triggering a question. Is it possible to compare images (not with the reference of Image path or Image Name) through VB? (It’s not urgent. But looking for at least hints).
My head is triggering a question. Is it possible to compare images (not with the reference of Image path or Image Name) through VB? (It’s not urgent. But looking for at least hints).
The short answer is "yes". The longer answer is "yes, but how depends on what you mean".
For instance, you could say If Picture1.Picture = Picture2.Picture - this will tell you whether they are references to the same image. I don't recall the technical terminology, but it involves handles and device contexts and stuff like that. This will work in many cases, quite possibly including the one raised here by the OP.
On the other hand, if you like, you can certainly loop through and compare the images pixel by pixel to see whether they are identical. I have actually written an image comparison utility, many years ago, which I had planned to release as shareware. So despite a poor memory, I do have some idea what I'm talking about.
You could even go further and do pattern recognition to try and determine whether images are of the same subject - but that's way out of my league.
The short answer is "yes". The longer answer is "yes, but how depends on what you mean".
On the other hand, if you like, you can certainly loop through and compare the images pixel by pixel to see whether they are identical. I have actually written an image comparison utility, many years ago, which I had planned to release as shareware. So despite a poor memory, I do have some idea what I'm talking about.
You could even go further and do pattern recognition to try and determine whether images are of the same subject - but that's way out of my league.
thank you for such grate hints and good luck to get more money to release your shareware.
all the best
I was talking to a programmer the other day but he had to go. He said the way he did image comparison was with GETPIXEL. He gave me snippet , however, I kind of clueless on what it means. Could anyone elaborate on this: - dim clr as color
-
clr = getpixel(x,y)
-
debug.print(clr.tostring)
Thanks
I was talking to a programmer the other day but he had to go. He said the way he did image comparison was with GETPIXEL. He gave me snippet , however, I kind of clueless on what it means. Could anyone elaborate on this:
dim clr as color
clr = getpixel(x,y)
debug.print(clr.tostring)
Thanks
this is what it means. - dim clr as color
-
'Declaring clr as Color
-
clr = getpixel(x,y)
-
'assigening clr value(pixel) in X and Y axis through getpixel
-
debug.print(clr.tostring)
-
'Convert clr to string and Printing it in debug editor
dim clr as color
...
debug.print(clr.tostring)
What is this, VB.Net?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Michael Rostkowski |
last post by:
I posted this in alt.php, but as a reply, so now I'm posting it here for
people
who might have missed it but still could find it useful. Thanks to Andy
Hassall for
giving me good information.
...
|
by: Andy B |
last post by:
Hi,
I am very new to JavaScript and my first assignment is to create a simple
game. Below is my code which works fine in IE, but not in any other browser
(Opera, Netscape, Mozilla). It has no form...
|
by: Robert Dell |
last post by:
I have a problem comparing strings in an order form i'm writing. I want
to give a running total at the bottom of the page and it appears to be
working except it doesn't compare correctly (it...
|
by: - Steve - |
last post by:
I've assigned three pictures as resources. So I can access them via
Resources.Image1, Resources.Image2, etc
On the buttons I try to do the following
if(Button1.Image == Resources.Image1)
...
|
by: Adam Dockter |
last post by:
I have a couple questions about comparing images. I notice the imagelist
collection of images doesn't provide any comparison of images, and the
System.Drawing.Image.Equal function will not compare...
|
by: Solitus |
last post by:
Lets say i have 2 images, a.jpg and b.jpg
Both are actually one same picture of a bear but have different filenames.
is there anyway in .net that i can find out if the two pictures are actually...
|
by: Helpful person |
last post by:
I wish to access several pictures on my page by defining them as an
array. This way I can either loop through them or access them by array
index. I am a beginner at Javascript so please keep...
|
by: lanwrangler |
last post by:
I know it's a long shot but does anyone have any pointers to generic
algorithms - or, even better, Python code - for comparing images and
computing a value for the "difference" between them?
...
|
by: anchal25 |
last post by:
Hi,
I am new to this forum and have found out some image comparison algorithms here. But my requirement is to compare two images which are similar but different in size. First I tried to resize...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |