imacul8 0 Report post Posted July 12, 2006 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 stuffany help would be great Share this post Link to post Share on other sites
Galahad 0 Report post Posted July 13, 2006 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: Dim x1 As Long, y1 As Long ' *** Picture1 CoordinatesFor 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 y1Next x1I 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... Share this post Link to post Share on other sites
imacul8 0 Report post Posted August 31, 2006 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 :\ Share this post Link to post Share on other sites
shadowx 0 Report post Posted August 31, 2006 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 Dont give up, keep looking! Share this post Link to post Share on other sites
imacul8 0 Report post Posted September 3, 2006 (edited) 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 Edited September 3, 2006 by imacul8 (see edit history) Share this post Link to post Share on other sites
Galahad 0 Report post Posted September 4, 2006 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... Share this post Link to post Share on other sites