Home | Profile | Register | Active Topics | Members | Search | FAQ
Save Password
Forgot your Password?

 All Forums
 Getting image colors from sam..
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  


2 Posts

Posted - Aug 10 2005 :  03:21:14 AM  Show Profile  Reply with Quote
Main problem: 2 image comparing. Is there a possibility that one image can be part of other image. Other image may be bigger. Like I make screenshot from my desktop. Then I load to memory smaller image "My Documents" and trying to find that from "MyDesctop" image.

I downloaded from this site. There is custom image storing sample. How I can get colors from cordinates 1:1?

rgbBlue As Byte
rgbGreen As Byte
rgbRed As Byte
rgbReserved As Byte
End Type
'This is our Custom Image File Format.
Type ImageFile
ImageWidth As Long 'Width of Image
ImageHeight As Long 'Height of Image
ImageBPP As Byte 'Bits Per Pixel (24bpp or 8bpp)
ImagePalette() As RGBQUAD 'Store our palette (for 8bpp only)
ImageData() As Byte 'Series of Bytes (R-G-B for 24bpp or Palette Index for 8bpp)
End Type
How do I get colors from cordinates 1:1 if image is stored as 24 bit?

is it like:
r= pImage.ImageData(((xX + i) + (yY + j) * (pImage.ImageWidth * 3)) + 1)
g = pImage.ImageData(((xX + i) + (yY + j) * (pImage.ImageWidth * 3)) + 2)
b = pImage.ImageData(((xX + i) + (yY + j) * (pImage.ImageWidth * 3)) + 3)

PS Using VB 6.0. And beginner in image stuff(and in API an so on)

Eric Coleman

810 Posts

Posted - Aug 10 2005 :  12:10:55 PM  Show Profile  Visit Eric Coleman's Homepage  Send Eric Coleman an AOL message  Send Eric Coleman an ICQ Message  Click to see Eric Coleman's MSN Messenger address  Send Eric Coleman a Yahoo! Message  Reply with Quote
That looks good to me. Have you tested this yet?

Go to Top of Page


2 Posts

Posted - Aug 10 2005 :  3:13:40 PM  Show Profile  Reply with Quote
Solutin in my way...
For yY = 0 To pImage2.ImageHeight - 1 Step 1
For xX = 0 To pImage2.ImageWidth - 1 Step 1
tempR2 = pImage2.ImageData(((xX * 3) + 1) + ((yY * pImage2.ImageWidth) * 3))
tempG2 = pImage2.ImageData(((xX * 3) + 2) + ((yY * pImage2.ImageWidth) * 3))
tempB2 = pImage2.ImageData(((xX * 3) + 3) + ((yY * pImage2.ImageWidth) * 3))

and I begin to test my code. And I found out that 24 bit BMP files looks very funny(in PictureBoxs) sometimes with my program.
And I tested BMP files with original program and those pictures are looking wierd in original program too. Originial 24 bit BMP what was included with sample looks ok. And some really big BMP files I found in my HD too. But some smallers pictures are wierd. Even the ones I downloaded from web.
Well,l I like to know, is image submit in custom format wrong(LoadBMP function). Or wrong is only image dispalying function(DrawImage function) in original "" program. Does anyone have any idea?

Edited by - 586 on Aug 10 2005 3:16:27 PM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.09 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.