|
|
|
|
![]() ![]() |
Jul 12 2006, 08:40 AM
Post
#1
|
|
|
Member [Level 3] ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 95 Joined: 21-May 06 From: Adelaide, Australia Member No.: 24,017 |
Just wondering if anyone has had any experience in picture analysis in VB6.
Need to scan a image and compare it to a different image and the co-ords of the place where the image differs in color too the original.... shouldnt be to hard but ive not had much experience with this sorta stuff any help would be great |
|
|
|
Jul 13 2006, 05:58 PM
Post
#2
|
|
|
Neurotical Squirrel ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 590 Joined: 4-November 04 From: Novi Sad, Vojvodina Member No.: 2,127 |
Well, the best way would be to directly decode original picture, and scanned one, into some sort of pixel matrix, and compare them... Since I have absolutely no idea how to decode images into plain pixels, I'll post the way I'd do it...
Use two Picture boxes, let's name them Picture1 and Picture2... Load original picture into Picture1, and scanned one into Picture2... Now, what you need to do, is set picture boxes' properties, autosize to true, and autoredraw to true, and scalemode to pixel.. Next, your code would look something like this: CODE Dim x1 As Long, y1 As Long ' *** Picture1 Coordinates For x1 = 0 To Picture1.ScaleWidth For y1 = 0 To Picture1.ScaleHeight If Picture1.Point(x1,y1) <> Picture2.Point(x1,y1) Then ' *** Do whatever you need to do if pixels are different Else ' *** Do whatever you need to do if pixels are the same Endif Next y1 Next x1 I believe this would work, but don't take my word for it... This would be the basic concept, which ofcourse assumes that two images have the same dimensions... This metod is slower than the method I described, where you would compare matrices of two pictures... If this works, let me know... Or if you have any more questions... Ask them here, or drop me a PM... |
|
|
|
Aug 31 2006, 08:17 AM
Post
#3
|
|
|
Member [Level 3] ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 95 Joined: 21-May 06 From: Adelaide, Australia Member No.: 24,017 |
Well yea that method would work if i had two pictures... But i only have one to work with and it can be a random picture (like 5 different possibilities) so i cant compare the two images to find the difference. I have to scan the picture looking for a specific color...
I dont think i will worry bout it, all seems to hard :\ |
|
|
|
Aug 31 2006, 10:06 AM
Post
#4
|
|
|
A clever man learns from his own mistakes, a WISE man learns from those of OTHERS ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 978 Joined: 12-April 06 From: Essex, UK Member No.: 21,719 |
Well if you want to look for a certain colour surely you could use some cod similar to that already posted. first of all find out the colour values in pixel terms for the colours you want to look for then use a modified version of the code above to search each pixel for this colour. And you could always look for more than one colour if you needed to scan for all dark shades of red for example.
Im not sure how the code would look but atleast it gives an idea of the structure to the code |
|
|
|
Sep 3 2006, 01:41 AM
Post
#5
|
|
|
Member [Level 3] ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 95 Joined: 21-May 06 From: Adelaide, Australia Member No.: 24,017 |
Thanx for the suggestions and ive basically got what needs to be done in my head just cant get it into the code... The colour i need to search for also changes and the contrast or whateva of the pic also changes sometimes its light etc.... i think i need to have the several different images saved and first of all try find which one it is, then using that match the difference between the 2...
If u have any more info on this please show me This post has been edited by imacul8: Sep 3 2006, 02:32 AM |
|
|
|
Sep 4 2006, 11:10 AM
Post
#6
|
|
|
Neurotical Squirrel ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 590 Joined: 4-November 04 From: Novi Sad, Vojvodina Member No.: 2,127 |
Well... Ummm... Maybe you could give me some more info? Like, what's the type of the pictures? Do they have some sort of background, or something...
If they have background, and the color of background changes as contrast changes, you could just check 1st pixel, and find appropriate picture, from your picture base (no matter how many pictures you have there) If the color you search for changes, do you know in advance what it is? If you do, you could just add a textbox, where you could enter color-code you're looking for, or add some sort of color picker... Then, are you looking for a specific, exact color match, or are different shades allowed... If you don't need exact shade search, then you'll have a bit more programing to do, since you would need to check each pixel against a range of colors... that would be about it... I never did any image analysis program, so I'm just talking theory here, and I most certainly won't be able to help you with any advanced code, but I'll do all I can... |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 6th September 2008 - 06:44 PM |