Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
To get rgb values of each pixel
Message
From
04/01/2009 11:19:45
 
 
To
04/01/2009 09:20:12
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Environment versions
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01370879
Message ID:
01370891
Views:
19
This message has been marked as the solution to the initial question of the thread.
>i have to do the following
>
>1. i have a picture stored on my harddisk let us say 250 X 250 or 100 x 100 pixels ( it will always be a square)
>2. i need to capture each pixel in a table of a similar size (in hex, rgb or cmyk, it does not matter)
>
>so let us assume the table has the following fields
>
>P1, P2, P3 .... P100 with a 100 rows (c 12)
>then
>
>P1 = 255,255,255
>P2 = 0,0,255
>
>and so on
>
>thanks

If you can show the image:
with VFP code
show the image and uses Form.Point method

A start simple example:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 12, ;
		Left = 24, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "open Pict", ;
		Name = "Command1"


	ADD OBJECT image1 AS image WITH ;
		Height = 17, ;
		Left = 12, ;
		Top = 48, ;
		Width = 100, ;
		Name = "Image1"


	PROCEDURE command1.Click
		WITH m.THISFORM.Image1 AS Image 
			.Picture = GETPICT()
			DIMENSION rgbImage(.Height,.Width)
			xOffset = OBJTOCLIENT(m.THISFORM.Image1,1) - 1
			yOffset = OBJTOCLIENT(m.THISFORM.Image1,2) - 1
			FOR x=1 TO ALEN(rgbImage,1)
				FOR y=1 TO ALEN(rgbImage,2)
					rgbImage(m.x,m.y)= thisform.Point(m.xOffset + m.x,m.yOffset + m.y)
					DEBUGOUT m.x,m.y,TRANSFORM(rgbImage(m.x,m.y),"@0")
				NEXT
			NEXT
		ENDWITH
	ENDPROC


	PROCEDURE image1.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		IF EMPTY(m.this.Picture)
			RETURN
		ENDIF
		WAIT WINDOWS TRANSFORM(thisForm.Point(m.nXCoord, m.nYCoord),"@0") NOWAIT
	ENDPROC


	PROCEDURE image1.Destroy
		WAIT CLEAR 
	ENDPROC

ENDDEFINE
Previous
Reply
Map
View

Click here to load this message in the networking platform