VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.OCX" Object = "{DF6D6558-5B0C-11D3-9396-008029E9B3A6}#1.0#0"; "ezVidC60.ocx" Begin VB.Form frmMain Caption = "Image Demo" ClientHeight = 9195 ClientLeft = 165 ClientTop = 450 ClientWidth = 14205 LinkTopic = "Form1" ScaleHeight = 613 ScaleMode = 3 'Pixel ScaleWidth = 947 StartUpPosition = 3 'Windows Default Begin VB.Frame Frame5 Caption = "Visualization" Height = 3675 Left = 2040 TabIndex = 102 Top = 5460 Width = 4815 Begin VB.CommandButton cmdVisDraw Caption = "Update" Height = 315 Left = 4020 TabIndex = 103 Top = 3180 Width = 675 End Begin VB.Line lineVis BorderColor = &H000000FF& Index = 0 X1 = 1680 X2 = 2940 Y1 = 2340 Y2 = 1500 End Begin VB.Line Line47 BorderColor = &H00FF8080& BorderStyle = 3 'Dot X1 = 480 X2 = 2820 Y1 = 2340 Y2 = 2340 End Begin VB.Line Line42 BorderColor = &H00FF8080& BorderStyle = 3 'Dot X1 = 1680 X2 = 1680 Y1 = 3480 Y2 = 1200 End Begin VB.Line Line27 X1 = 2820 X2 = 4080 Y1 = 3480 Y2 = 2640 End Begin VB.Line Line24 X1 = 1740 X2 = 480 Y1 = 360 Y2 = 1200 End Begin VB.Line Line23 X1 = 480 X2 = 2820 Y1 = 3480 Y2 = 3480 End Begin VB.Line Line22 X1 = 2820 X2 = 2820 Y1 = 1200 Y2 = 3480 End Begin VB.Line Line21 X1 = 480 X2 = 480 Y1 = 1200 Y2 = 3480 End Begin VB.Line Line20 X1 = 480 X2 = 2820 Y1 = 1200 Y2 = 1200 End Begin VB.Line Line52 BorderColor = &H00FF8080& BorderStyle = 3 'Dot X1 = 480 X2 = 2820 Y1 = 3480 Y2 = 1200 End Begin VB.Line Line41 BorderColor = &H00FF8080& BorderStyle = 3 'Dot X1 = 480 X2 = 2820 Y1 = 1200 Y2 = 3480 End Begin VB.Line Line26 BorderStyle = 3 'Dot X1 = 480 X2 = 1740 Y1 = 3480 Y2 = 2640 End Begin VB.Line Line25 X1 = 2820 X2 = 4080 Y1 = 1200 Y2 = 360 End Begin VB.Line Line19 BorderStyle = 3 'Dot X1 = 1740 X2 = 1740 Y1 = 360 Y2 = 2640 End Begin VB.Line Line17 X1 = 1740 X2 = 4080 Y1 = 360 Y2 = 360 End Begin VB.Line Line18 BorderStyle = 3 'Dot X1 = 1740 X2 = 4080 Y1 = 2640 Y2 = 2640 End Begin VB.Line Line29 X1 = 4080 X2 = 4080 Y1 = 360 Y2 = 2640 End Begin VB.Line Line32 BorderColor = &H0080FFFF& BorderStyle = 3 'Dot X1 = 1740 X2 = 4080 Y1 = 2640 Y2 = 360 End Begin VB.Line lineOrigY BorderColor = &H0080FFFF& BorderStyle = 3 'Dot X1 = 1740 X2 = 4080 Y1 = 1500 Y2 = 1500 End Begin VB.Line lineOrigX BorderColor = &H0080FFFF& BorderStyle = 3 'Dot X1 = 2940 X2 = 2940 Y1 = 2640 Y2 = 360 End Begin VB.Line Line28 BorderColor = &H0080FFFF& BorderStyle = 3 'Dot X1 = 1740 X2 = 4080 Y1 = 360 Y2 = 2640 End End Begin VB.Frame Frame7 Caption = "Video Capture" Height = 3915 Left = 2040 TabIndex = 95 Top = 1500 Width = 9735 Begin VB.PictureBox imgInput AutoSize = -1 'True Height = 3600 Left = 60 ScaleHeight = 236 ScaleMode = 3 'Pixel ScaleWidth = 316 TabIndex = 100 TabStop = 0 'False Top = 240 Width = 4800 Begin VB.Line lineAlign1 BorderColor = &H00800000& X1 = 428 X2 = 0 Y1 = 312 Y2 = 0 End Begin VB.Line LineAlign4 BorderColor = &H00800000& X1 = 248 X2 = 252 Y1 = 344 Y2 = 4 End Begin VB.Line LineAlign3 BorderColor = &H00800000& X1 = 436 X2 = 24 Y1 = 180 Y2 = 192 End Begin VB.Line lineAlign2 BorderColor = &H00800000& X1 = 48 X2 = 452 Y1 = 352 Y2 = 20 End Begin VB.Line linePos BorderColor = &H00FF0000& X1 = 0 X2 = 160 Y1 = 0 Y2 = 208 End Begin VB.Shape shpPos BorderColor = &H00FF0000& Height = 120 Left = 2400 Top = 3120 Width = 120 End End Begin VB.CommandButton cmdCapCapture Caption = "Capture" Height = 315 Left = 4920 TabIndex = 99 Top = 3480 Width = 855 End Begin VB.CommandButton cmdCapPreview Caption = "Preview" Height = 315 Left = 8640 TabIndex = 98 Top = 3480 Width = 975 End Begin VB.ComboBox cmbDevice Height = 315 Left = 4920 Style = 2 'Dropdown List TabIndex = 97 Top = 300 Width = 4695 End Begin vbVidC60.ezVidCap ezVidCap1 Height = 3600 Left = 4860 TabIndex = 96 Top = 240 Width = 4800 _ExtentX = 8467 _ExtentY = 6350 Preview = 0 'False End End Begin VB.Frame Frame6 Caption = "Laser Position" Height = 2475 Left = 0 TabIndex = 70 Top = 1080 Width = 1995 Begin VB.Timer tmrLaserStep Enabled = 0 'False Interval = 1 Left = 1500 Top = 1380 End Begin VB.CommandButton cmdLaserStep Caption = "Step Laser" Height = 255 Left = 480 TabIndex = 83 Top = 1500 Width = 975 End Begin VB.CommandButton cmdLPStart Caption = "Start" Height = 255 Left = 60 TabIndex = 82 Top = 780 Width = 495 End Begin VB.CommandButton cmdLPGet Caption = "Get" Height = 255 Left = 1440 TabIndex = 6 Top = 780 Width = 495 End Begin VB.CommandButton cmdLPTareNeg45 Caption = "Tare" Height = 255 Left = 960 TabIndex = 5 Top = 2100 Width = 495 End Begin VB.TextBox txtLPNeg45 Height = 285 Left = 480 TabIndex = 79 Text = "0" Top = 2100 Width = 435 End Begin VB.CommandButton cmdLPTarePos45 Caption = "Tare" Height = 255 Left = 960 TabIndex = 4 Top = 1800 Width = 495 End Begin VB.TextBox txtLPPos45 Height = 285 Left = 480 TabIndex = 76 Text = "255" Top = 1800 Width = 435 End Begin VB.TextBox txtLPAngle Height = 285 Left = 1140 Locked = -1 'True TabIndex = 72 TabStop = 0 'False Text = "-1" Top = 1140 Width = 435 End Begin VB.TextBox txtLPVal Height = 285 Left = 480 Locked = -1 'True TabIndex = 71 TabStop = 0 'False Text = "-1" Top = 1140 Width = 435 End Begin VB.Timer tmrLP Enabled = 0 'False Interval = 500 Left = 1500 Top = 1920 End Begin VB.Label Label38 BackStyle = 0 'Transparent Caption = "135" Height = 255 Left = 60 TabIndex = 106 Top = 240 Width = 315 End Begin VB.Label Label37 BackStyle = 0 'Transparent Caption = "90" Height = 255 Left = 840 TabIndex = 105 Top = 180 Width = 315 End Begin VB.Label Label23 BackStyle = 0 'Transparent Caption = "45" Height = 255 Left = 1740 TabIndex = 104 Top = 240 Width = 315 End Begin VB.Line Line31 BorderStyle = 3 'Dot X1 = 1020 X2 = 1860 Y1 = 1080 Y2 = 300 End Begin VB.Line Line30 BorderStyle = 3 'Dot X1 = 1020 X2 = 240 Y1 = 1080 Y2 = 300 End Begin VB.Line lineLP_XAxisNeg X1 = 1020 X2 = 180 Y1 = 1080 Y2 = 1080 End Begin VB.Line lineLP BorderColor = &H000000FF& X1 = 1020 X2 = 1320 Y1 = 1080 Y2 = 300 End Begin VB.Label Label55 BackStyle = 0 'Transparent Caption = "o" Height = 255 Left = 300 TabIndex = 81 Top = 2100 Width = 315 End Begin VB.Label Label54 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "-45" Height = 255 Left = -60 TabIndex = 80 Top = 2160 Width = 315 End Begin VB.Label Label53 BackStyle = 0 'Transparent Caption = "o" Height = 255 Left = 300 TabIndex = 78 Top = 1800 Width = 315 End Begin VB.Label Label52 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "45" Height = 255 Left = -60 TabIndex = 77 Top = 1860 Width = 315 End Begin VB.Label Label51 BackStyle = 0 'Transparent Caption = "Val =" Height = 255 Left = 60 TabIndex = 75 Top = 1200 Width = 435 End Begin VB.Label Label50 BackStyle = 0 'Transparent Caption = "=" Height = 255 Left = 960 TabIndex = 74 Top = 1200 Width = 195 End Begin VB.Label Label49 BackStyle = 0 'Transparent Caption = "o" Height = 255 Left = 1560 TabIndex = 73 Top = 1080 Width = 195 End Begin VB.Line lineLP_XAxisPos X1 = 1020 X2 = 1860 Y1 = 1080 Y2 = 1080 End Begin VB.Line lineLP_YAxis X1 = 1020 X2 = 1020 Y1 = 1080 Y2 = 240 End End Begin VB.TextBox txtLog Height = 6195 Left = 11820 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 52 TabStop = 0 'False Text = "frmLaserDistance.frx":0000 Top = 0 Width = 2355 End Begin VB.Frame Frame4 Caption = "Control" Height = 1035 Left = 0 TabIndex = 38 Top = 0 Width = 1995 Begin VB.CommandButton cmdWriteToXLS Caption = "xls" Height = 315 Left = 1260 TabIndex = 3 Top = 660 Width = 435 End Begin VB.CommandButton cmdStart Caption = "Start" Height = 315 Left = 780 TabIndex = 1 Top = 240 Width = 495 End Begin VB.Timer tmrMain Enabled = 0 'False Interval = 250 Left = 1500 Top = 180 End Begin VB.CommandButton cmdDoFrame Caption = "Frame" Height = 315 Left = 120 TabIndex = 0 Top = 240 Width = 615 End Begin MSComDlg.CommonDialog dlgWriteFile Left = 1320 Top = 120 _ExtentX = 847 _ExtentY = 847 _Version = 393216 End Begin VB.CommandButton cmdWriteToTXT Caption = "text" Height = 315 Left = 600 TabIndex = 2 Top = 660 Width = 435 End Begin VB.Label Label2 Caption = "Write" Height = 195 Left = 120 TabIndex = 101 Top = 720 Width = 555 End End Begin VB.Frame Frame3 Caption = "Test Area" Height = 1455 Left = 9780 TabIndex = 33 Top = 0 Width = 1995 Begin VB.CommandButton cmdStep Caption = "Step" Height = 315 Left = 660 TabIndex = 94 Top = 240 Width = 495 End Begin VB.CommandButton cmdStepStart Caption = "Start" Height = 315 Left = 120 TabIndex = 93 Top = 240 Width = 495 End Begin VB.Timer tmrStep Enabled = 0 'False Interval = 1 Left = 1500 Top = 180 End Begin VB.TextBox txtCurColor Height = 315 Left = 480 Locked = -1 'True TabIndex = 35 TabStop = 0 'False Text = "-1" Top = 960 Width = 735 End Begin VB.TextBox txtCurPosition Height = 315 Left = 480 Locked = -1 'True TabIndex = 34 TabStop = 0 'False Text = "-1" Top = 600 Width = 735 End Begin VB.Shape shpColor3 BorderColor = &H00FFFFFF& FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 2 Left = 1500 Top = 900 Width = 135 End Begin VB.Shape shpColor5 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 2 Left = 1500 Top = 1140 Width = 135 End Begin VB.Shape shpColor5 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 4 Left = 1740 Top = 1140 Width = 135 End Begin VB.Shape shpColor5 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 3 Left = 1620 Top = 1140 Width = 135 End Begin VB.Shape shpColor5 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 1 Left = 1380 Top = 1140 Width = 135 End Begin VB.Shape shpColor5 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 0 Left = 1260 Top = 1140 Width = 135 End Begin VB.Shape shpColor4 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 4 Left = 1740 Top = 1020 Width = 135 End Begin VB.Shape shpColor4 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 3 Left = 1620 Top = 1020 Width = 135 End Begin VB.Shape shpColor4 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 2 Left = 1500 Top = 1020 Width = 135 End Begin VB.Shape shpColor4 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 0 Left = 1260 Top = 1020 Width = 135 End Begin VB.Shape shpColor3 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 4 Left = 1740 Top = 900 Width = 135 End Begin VB.Shape shpColor4 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 1 Left = 1380 Top = 1020 Width = 135 End Begin VB.Shape shpColor3 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 3 Left = 1620 Top = 900 Width = 135 End Begin VB.Shape shpColor3 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 1 Left = 1380 Top = 900 Width = 135 End Begin VB.Shape shpColor3 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 0 Left = 1260 Top = 900 Width = 135 End Begin VB.Shape shpColor2 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 4 Left = 1740 Top = 780 Width = 135 End Begin VB.Shape shpColor2 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 3 Left = 1620 Top = 780 Width = 135 End Begin VB.Label Label18 Caption = "RGB" Height = 195 Left = 60 TabIndex = 37 Top = 1020 Width = 615 End Begin VB.Label Label19 Caption = "Pos" Height = 195 Left = 60 TabIndex = 36 Top = 660 Width = 615 End Begin VB.Shape shpColor1 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 0 Left = 1260 Top = 660 Width = 135 End Begin VB.Shape shpColor1 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 1 Left = 1380 Top = 660 Width = 135 End Begin VB.Shape shpColor1 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 3 Left = 1620 Top = 660 Width = 135 End Begin VB.Shape shpColor2 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 1 Left = 1380 Top = 780 Width = 135 End Begin VB.Shape shpColor1 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 4 Left = 1740 Top = 660 Width = 135 End Begin VB.Shape shpColor1 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 2 Left = 1500 Top = 660 Width = 135 End Begin VB.Shape shpColor2 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 0 Left = 1260 Top = 780 Width = 135 End Begin VB.Shape shpColor2 FillColor = &H00FFFFFF& FillStyle = 0 'Solid Height = 135 Index = 2 Left = 1500 Top = 780 Width = 135 End End Begin VB.Frame Frame2 Caption = "Calculations" Height = 3615 Left = 0 TabIndex = 17 Top = 3600 Width = 1995 Begin VB.TextBox txtAngleA Height = 285 Left = 1140 Locked = -1 'True TabIndex = 86 TabStop = 0 'False Text = "-1" Top = 1440 Width = 615 End Begin VB.TextBox txtAngleB Height = 285 Left = 1140 Locked = -1 'True TabIndex = 85 TabStop = 0 'False Text = "-1" Top = 1740 Width = 615 End Begin VB.TextBox txtAngleD Height = 285 Left = 1140 Locked = -1 'True TabIndex = 84 TabStop = 0 'False Text = "-1" Top = 2040 Width = 615 End Begin VB.TextBox txtDistanceCE Height = 285 Left = 1140 Locked = -1 'True TabIndex = 65 TabStop = 0 'False Text = "-1" Top = 2940 Width = 615 End Begin VB.TextBox txtDistanceDE Height = 285 Left = 1140 Locked = -1 'True TabIndex = 64 TabStop = 0 'False Text = "-1" Top = 3240 Width = 615 End Begin VB.TextBox txtDistanceBD Height = 285 Left = 1140 Locked = -1 'True TabIndex = 61 TabStop = 0 'False Text = "-1" Top = 2640 Width = 615 End Begin VB.TextBox txtLaserYaw Height = 285 Left = 1140 Locked = -1 'True TabIndex = 22 TabStop = 0 'False Text = "-1" Top = 180 Width = 615 End Begin VB.TextBox txtScanYaw Height = 285 Left = 1140 Locked = -1 'True TabIndex = 21 TabStop = 0 'False Text = "-1" Top = 780 Width = 615 End Begin VB.TextBox txtScanPitch Height = 285 Left = 1140 Locked = -1 'True TabIndex = 20 TabStop = 0 'False Text = "-1" Top = 1080 Width = 615 End Begin VB.TextBox txtLaserPitch Height = 285 Left = 1140 Locked = -1 'True TabIndex = 19 TabStop = 0 'False Text = "-1" Top = 480 Width = 615 End Begin VB.TextBox txtDistanceCD Height = 285 Left = 1140 Locked = -1 'True TabIndex = 18 TabStop = 0 'False Text = "-1" Top = 2340 Width = 615 End Begin VB.Label Label61 BackStyle = 0 'Transparent Caption = "o" Height = 195 Left = 1800 TabIndex = 92 Top = 1380 Width = 255 End Begin VB.Label Label60 BackStyle = 0 'Transparent Caption = "Angle A" Height = 195 Left = 60 TabIndex = 91 Top = 1500 Width = 975 End Begin VB.Label Label59 BackStyle = 0 'Transparent Caption = "Angle B" Height = 195 Left = 60 TabIndex = 90 Top = 1800 Width = 975 End Begin VB.Label Label58 BackStyle = 0 'Transparent Caption = "o" Height = 195 Left = 1800 TabIndex = 89 Top = 1680 Width = 255 End Begin VB.Label Label57 BackStyle = 0 'Transparent Caption = "Angle D" Height = 195 Left = 60 TabIndex = 88 Top = 2100 Width = 975 End Begin VB.Label Label56 BackStyle = 0 'Transparent Caption = "o" Height = 195 Left = 1800 TabIndex = 87 Top = 1980 Width = 255 End Begin VB.Label Label48 BackStyle = 0 'Transparent Caption = """" Height = 195 Left = 1800 TabIndex = 69 Top = 3000 Width = 255 End Begin VB.Label Label47 BackStyle = 0 'Transparent Caption = "Distance CE" Height = 195 Left = 60 TabIndex = 68 Top = 3000 Width = 975 End Begin VB.Label Label46 BackStyle = 0 'Transparent Caption = "Distance DE" Height = 195 Left = 60 TabIndex = 67 Top = 3300 Width = 975 End Begin VB.Label Label45 BackStyle = 0 'Transparent Caption = """" Height = 195 Left = 1800 TabIndex = 66 Top = 3300 Width = 255 End Begin VB.Label Label44 BackStyle = 0 'Transparent Caption = """" Height = 195 Left = 1800 TabIndex = 63 Top = 2700 Width = 255 End Begin VB.Label Label43 BackStyle = 0 'Transparent Caption = "Distance BD" Height = 195 Left = 60 TabIndex = 62 Top = 2700 Width = 975 End Begin VB.Label Label15 BackStyle = 0 'Transparent Caption = "o" Height = 195 Left = 1800 TabIndex = 32 Top = 120 Width = 255 End Begin VB.Label Label4 BackStyle = 0 'Transparent Caption = "Laser Yaw" Height = 195 Left = 60 TabIndex = 31 Top = 240 Width = 1095 End Begin VB.Label Label7 BackStyle = 0 'Transparent Caption = "Scan Yaw" Height = 195 Left = 60 TabIndex = 30 Top = 840 Width = 975 End Begin VB.Label Label8 BackStyle = 0 'Transparent Caption = "Scan Pitch" Height = 195 Left = 60 TabIndex = 29 Top = 1140 Width = 975 End Begin VB.Label Label10 BackStyle = 0 'Transparent Caption = "Laser Pitch" Height = 195 Left = 60 TabIndex = 28 Top = 540 Width = 1095 End Begin VB.Label lbldistance BackStyle = 0 'Transparent Caption = "Distance CD" Height = 195 Left = 60 TabIndex = 27 Top = 2400 Width = 975 End Begin VB.Label Label11 BackStyle = 0 'Transparent Caption = """" Height = 195 Left = 1800 TabIndex = 26 Top = 2400 Width = 255 End Begin VB.Label Label12 BackStyle = 0 'Transparent Caption = "o" Height = 195 Left = 1800 TabIndex = 25 Top = 1020 Width = 255 End Begin VB.Label Label13 BackStyle = 0 'Transparent Caption = "o" Height = 195 Left = 1800 TabIndex = 24 Top = 720 Width = 255 End Begin VB.Label Label14 BackStyle = 0 'Transparent Caption = "o" Height = 195 Left = 1800 TabIndex = 23 Top = 420 Width = 255 End End Begin VB.Frame Frame1 Caption = "Constants" Height = 1455 Left = 2040 TabIndex = 12 Top = 0 Width = 6255 Begin VB.TextBox txtCameraPitchOffset Height = 285 Left = 1440 TabIndex = 10 TabStop = 0 'False Text = "0" Top = 720 Width = 495 End Begin VB.TextBox txtCameraPitch Height = 285 Left = 1440 TabIndex = 9 TabStop = 0 'False Text = "16.5" Top = 420 Width = 495 End Begin VB.TextBox txtCameraYaw Height = 285 Left = 900 TabIndex = 7 TabStop = 0 'False Text = "22.0" Top = 420 Width = 495 End Begin VB.TextBox txtCameraYawOffset Height = 285 Left = 900 TabIndex = 8 TabStop = 0 'False Text = "68.0" Top = 720 Width = 495 End Begin VB.TextBox txtDistAB Height = 285 Left = 900 TabIndex = 11 TabStop = 0 'False Text = "54.5" Top = 1020 Width = 615 End Begin VB.Line Line16 BorderColor = &H00000080& X1 = 3180 X2 = 3120 Y1 = 840 Y2 = 1140 End Begin VB.Line Line15 BorderColor = &H0000FFFF& BorderStyle = 3 'Dot X1 = 2640 X2 = 2220 Y1 = 540 Y2 = 1140 End Begin VB.Label Label42 BackStyle = 0 'Transparent Caption = "_" Height = 195 Left = 5100 TabIndex = 60 Top = 660 Width = 255 End Begin VB.Label Label41 BackStyle = 0 'Transparent Caption = "+" Height = 195 Left = 5100 TabIndex = 59 Top = 540 Width = 255 End Begin VB.Label Label17 BackStyle = 0 'Transparent Caption = "E" ForeColor = &H0000FFFF& Height = 195 Left = 4920 TabIndex = 58 Top = 1140 Width = 255 End Begin VB.Label Label36 BackStyle = 0 'Transparent Caption = "=Example" ForeColor = &H0000FFFF& Height = 195 Left = 5400 TabIndex = 57 Top = 1200 Width = 915 End Begin VB.Label Label35 BackStyle = 0 'Transparent Caption = "=Camera" ForeColor = &H00000080& Height = 195 Left = 5400 TabIndex = 56 Top = 1020 Width = 795 End Begin VB.Label Label34 BackStyle = 0 'Transparent Caption = "C" ForeColor = &H0000FFFF& Height = 195 Left = 4920 TabIndex = 55 Top = 540 Width = 255 End Begin VB.Line Line14 BorderColor = &H0000FFFF& BorderStyle = 3 'Dot X1 = 4920 X2 = 4920 Y1 = 720 Y2 = 1140 End Begin VB.Line Line13 BorderColor = &H0000FFFF& BorderStyle = 3 'Dot X1 = 3960 X2 = 4920 Y1 = 720 Y2 = 1140 End Begin VB.Label Label33 BackStyle = 0 'Transparent Caption = "C" ForeColor = &H0000FFFF& Height = 195 Left = 2520 TabIndex = 54 Top = 420 Width = 255 End Begin VB.Line Line12 BorderColor = &H0000FFFF& BorderStyle = 3 'Dot X1 = 2640 X2 = 2640 Y1 = 540 Y2 = 1140 End Begin VB.Line Line11 BorderColor = &H0000FFFF& BorderStyle = 3 'Dot X1 = 2640 X2 = 3480 Y1 = 540 Y2 = 1140 End Begin VB.Label Label22 BackStyle = 0 'Transparent Caption = "D" ForeColor = &H0000FFFF& Height = 195 Left = 2580 TabIndex = 53 Top = 1140 Width = 255 End Begin VB.Label Label32 BackStyle = 0 'Transparent Caption = "Side (Pitch)" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FFFFFF& Height = 195 Left = 4020 TabIndex = 51 Top = 180 Width = 1035 End Begin VB.Line Line10 X1 = 3960 X2 = 3960 Y1 = 1260 Y2 = 240 End Begin VB.Line Line9 BorderColor = &H00000080& X1 = 3960 X2 = 5100 Y1 = 720 Y2 = 1020 End Begin VB.Line Line8 BorderColor = &H00000080& BorderStyle = 3 'Dot X1 = 3960 X2 = 4560 Y1 = 720 Y2 = 1260 End Begin VB.Line Line7 BorderColor = &H00000080& BorderStyle = 3 'Dot X1 = 5100 X2 = 3960 Y1 = 540 Y2 = 720 End Begin VB.Label Label31 BackStyle = 0 'Transparent Caption = "Angle" ForeColor = &H00000080& Height = 195 Left = 4320 TabIndex = 50 Top = 900 Width = 495 End Begin VB.Label Label30 BackStyle = 0 'Transparent Caption = "Offset" ForeColor = &H00000080& Height = 195 Left = 4620 TabIndex = 49 Top = 720 Width = 555 End Begin VB.Line Line6 BorderStyle = 3 'Dot X1 = 3960 X2 = 5100 Y1 = 720 Y2 = 720 End Begin VB.Label Label29 BackStyle = 0 'Transparent Caption = "D" ForeColor = &H0000FFFF& Height = 195 Left = 3840 TabIndex = 48 Top = 660 Width = 255 End Begin VB.Label Label16 BackStyle = 0 'Transparent Caption = "Top (Yaw)" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FFFFFF& Height = 195 Left = 2100 TabIndex = 47 Top = 180 Width = 975 End Begin VB.Label Label28 Alignment = 2 'Center BackStyle = 0 'Transparent Caption = "Pitch" Height = 195 Left = 1440 TabIndex = 46 Top = 180 Width = 495 End Begin VB.Label Label27 BackStyle = 0 'Transparent Caption = "o" Height = 195 Left = 1920 TabIndex = 45 Top = 660 Width = 255 End Begin VB.Label Label26 BackStyle = 0 'Transparent Caption = "o" Height = 195 Left = 1920 TabIndex = 44 Top = 360 Width = 255 End Begin VB.Label Label25 Alignment = 2 'Center BackStyle = 0 'Transparent Caption = "Yaw" Height = 195 Left = 900 TabIndex = 43 Top = 180 Width = 495 End Begin VB.Label Label24 BackStyle = 0 'Transparent Caption = "A" Height = 195 Left = 2100 TabIndex = 42 Top = 1140 Width = 255 End Begin VB.Label Label1 BackStyle = 0 'Transparent Caption = "B" Height = 195 Left = 3480 TabIndex = 41 Top = 1140 Width = 255 End Begin VB.Line Line5 BorderStyle = 3 'Dot X1 = 3480 X2 = 3480 Y1 = 1140 Y2 = 180 End Begin VB.Label Label21 BackStyle = 0 'Transparent Caption = "Offset" ForeColor = &H00000080& Height = 195 Left = 2700 TabIndex = 40 Top = 900 Width = 555 End Begin VB.Label Label20 BackStyle = 0 'Transparent Caption = "Angle" ForeColor = &H00000080& Height = 195 Left = 2820 TabIndex = 39 Top = 360 Width = 495 End Begin VB.Line Line4 BorderColor = &H00000080& BorderStyle = 3 'Dot X1 = 3060 X2 = 3480 Y1 = 180 Y2 = 1140 End Begin VB.Line Line3 BorderColor = &H00000080& BorderStyle = 3 'Dot X1 = 2460 X2 = 3480 Y1 = 660 Y2 = 1140 End Begin VB.Line Line2 BorderColor = &H00000080& X1 = 2760 X2 = 3480 Y1 = 420 Y2 = 1140 End Begin VB.Line Line1 X1 = 2220 X2 = 3480 Y1 = 1140 Y2 = 1140 End Begin VB.Label Label9 BackStyle = 0 'Transparent Caption = "Cam Angle" Height = 195 Left = 60 TabIndex = 16 Top = 480 Width = 975 End Begin VB.Label Label3 BackStyle = 0 'Transparent Caption = "Cam Offset" Height = 195 Left = 60 TabIndex = 15 Top = 780 Width = 1035 End Begin VB.Label Label5 BackStyle = 0 'Transparent Caption = "Dist AB" Height = 195 Left = 60 TabIndex = 14 Top = 1080 Width = 1035 End Begin VB.Label Label6 BackStyle = 0 'Transparent Caption = """" Height = 195 Left = 1500 TabIndex = 13 Top = 1020 Width = 255 End End End Attribute VB_Name = "frmMain" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Declare Function GetTickCount Lib "kernel32" () As Long Private Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Integer Private Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer) Private Type pixang ' store one per pixel angle_B As Double ' in degrees angle_D As Double ' in degrees dist_BD As Double ' x offset in the same units as dist_between dist_CE As Double ' y offset dist_DE As Double ' distance created As Double ' time that the data was entered End Type Const base_port = &H378 ' base port for outputting. LPT1 = 0x378 Const red_pct = 0.5 ' 0.7=30% more red than B and G Dim ra_pix() As pixang ' array with all the angles/distances Dim pa As BCHPicArray.clsPicArray ' array to store the bitmap in for processing, loads it from the imgInput picture Dim lp_val As Byte ' current value read off the sensor (not adjusted) Dim lp_angle As Double ' current angle calculated from lp_val Dim lp_out As Byte ' current value being written to parallel port Dim cur_x As Integer ' current x position for image scanning using "step" Dim cur_y As Integer ' "" y Dim no_ui As Boolean ' set to true to not do any displaying Private Sub cmdStart_Click() ' main routine, generally this will run full time If (tmrMain.Enabled = True) Then tmrMain.Enabled = False cmdStart.Caption = "Start" Else tmrMain.Enabled = True cmdStart.Caption = "Stop" End If End Sub Private Sub tmrMain_Timer() cmdDoFrame_Click End Sub Private Sub cmdDoFrame_Click() Dim X As Integer, Y As Integer Dim y_start, y_end ' don't scan entire 4:3 image no_ui = True txtLog.Text = "" ' Dim time_start ' time_start = GetTickCount cmdLaserStep_Click ' move laser cmdLPGet_Click ' update laser position cmdCapCapture_Click ' get the image cmdVisDraw_Click y_start = imgInput.ScaleHeight * 0.2 ' ignore first 20% y_end = imgInput.ScaleHeight * 0.8 ' ignore last 20% For Y = y_start To y_end - y_start For X = 0 To imgInput.ScaleWidth - 1 doPixel X, Y, pa Next X Next Y no_ui = False ' MsgBox GetTickCount - time_start End Sub ' video capture Private Sub cmdCapCapture_Click() On Error Resume Next Call ezVidCap1.SaveDIB("current.bmp") If Err Then MsgBox Err.Description, vbInformation, App.Title End If imgInput.Picture = LoadPicture("current.bmp") ' a kludge, but ezvidcap can't load directly into picturebox... pa.LoadPicArray imgInput.Picture ' load the bitmap from the picture into the buffer End Sub Private Sub doPixel(X As Integer, Y As Integer, pa As BCHPicArray.clsPicArray) If Not no_ui Then linePos.X2 = X - shpPos.Width / 2 linePos.Y2 = Y - shpPos.Height / 2 shpPos.Left = linePos.X2 shpPos.Top = linePos.Y2 txtCurPosition.Text = X & "x" & Y End If ' 2) determine colors Dim color As Long ' color = 0 ' 281ms ' color = imgInput.Point(x, y) ' 2844ms ' color = GetPixel(imgInput.hdc, x, y) ' 2688ms color = pa.ReadPixel(X, imgInput.ScaleHeight - Y) ' 610ms If Not no_ui Then Dim r As Byte, g As Byte, b As Byte r = color And &HFF g = (color \ 256) And &HFF b = (color \ 65536) And &HFF txtCurColor.Text = PadHex(r) & "" & PadHex(g) & "" & PadHex(b) shpColor1(0).FillColor = fixcolor(imgInput.Point(X - 2, Y - 2)) shpColor1(1).FillColor = fixcolor(imgInput.Point(X - 1, Y - 2)) shpColor1(2).FillColor = fixcolor(imgInput.Point(X + 0, Y - 2)) shpColor1(3).FillColor = fixcolor(imgInput.Point(X + 1, Y - 2)) shpColor1(4).FillColor = fixcolor(imgInput.Point(X + 2, Y - 2)) shpColor2(0).FillColor = fixcolor(imgInput.Point(X - 2, Y - 1)) shpColor2(1).FillColor = fixcolor(imgInput.Point(X - 1, Y - 1)) shpColor2(2).FillColor = fixcolor(imgInput.Point(X + 0, Y - 1)) shpColor2(3).FillColor = fixcolor(imgInput.Point(X + 1, Y - 1)) shpColor2(4).FillColor = fixcolor(imgInput.Point(X + 2, Y - 1)) shpColor3(0).FillColor = fixcolor(imgInput.Point(X - 2, Y)) shpColor3(1).FillColor = fixcolor(imgInput.Point(X - 1, Y)) shpColor3(2).FillColor = fixcolor(imgInput.Point(X + 0, Y)) shpColor3(3).FillColor = fixcolor(imgInput.Point(X + 1, Y)) shpColor3(4).FillColor = fixcolor(imgInput.Point(X + 2, Y)) shpColor4(0).FillColor = fixcolor(imgInput.Point(X - 2, Y + 1)) shpColor4(1).FillColor = fixcolor(imgInput.Point(X - 1, Y + 1)) shpColor4(2).FillColor = fixcolor(imgInput.Point(X + 0, Y + 1)) shpColor4(3).FillColor = fixcolor(imgInput.Point(X + 1, Y + 1)) shpColor4(4).FillColor = fixcolor(imgInput.Point(X + 2, Y + 1)) shpColor5(0).FillColor = fixcolor(imgInput.Point(X - 2, Y + 2)) shpColor5(1).FillColor = fixcolor(imgInput.Point(X - 1, Y + 2)) shpColor5(2).FillColor = fixcolor(imgInput.Point(X + 0, Y + 2)) shpColor5(3).FillColor = fixcolor(imgInput.Point(X + 1, Y + 2)) shpColor5(4).FillColor = fixcolor(imgInput.Point(X + 2, Y + 2)) End If ' 3) determine if the laser is there, that's the intersect ' If (color = 0) Then ' 406ms If (((color And &HFF) * red_pct) > ((color \ 256) And &HFF) And ((color And &HFF) * red_pct) > ((color \ 65536) And &HFF)) Then ' 531ms ' if lots more red than any other color, then assume the laser is there. ' 4) calculate angles Dim dist_MC As Double Dim angle_A As Double, angle_A2 As Double, angle_B As Double, angle_B2 As Double, angle_C As Double, angle_C2 As Double, angle_D As Double Dim dist_AC As Double, dist_AB As Double, dist_BD As Double, dist_CA As Double, dist_BC As Double Dim dist_CD As Double, dist_AD As Double, dist_CE As Double, dist_DE As Double txtLaserYaw.Text = lp_angle txtScanYaw.Text = (X / imgInput.ScaleWidth) * (txtCameraYaw.Text * 2) - (txtCameraYaw.Text) txtScanPitch.Text = -((Y / imgInput.ScaleHeight) * (txtCameraPitch.Text * 2) - (txtCameraPitch.Text)) angle_A = txtLaserYaw.Text angle_B = val(txtCameraYawOffset.Text) + val(txtScanYaw.Text) angle_D = val(txtCameraPitchOffset.Text) + val(txtScanPitch.Text) txtAngleA.Text = angle_A txtAngleB.Text = angle_B txtAngleD.Text = angle_D ' find: distance, yaw, pitch ' 1) find dist_CD and dist_BD If (angle_A <= 90 And angle_B <= 90) Then dist_AC = (txtDistAB.Text * Sin(Radians(angle_B))) / Sin(Radians(180 - angle_A - angle_B)) dist_CD = dist_AC * Sin(Radians(angle_A)) dist_AD = dist_AC * Cos(Radians(angle_A)) dist_BD = dist_AB - dist_AD ElseIf (angle_A > 90) Then angle_A2 = 90 - angle_A angle_C = 180 - angle_A - angle_B angle_C2 = 90 - angle_C dist_AC = -1 ' ? dist_CD = dist_CA * Sin(Radians(angle_A2)) dist_AD = -dist_CA * Sin(Radians(angle_C2)) dist_BD = dist_AB - dist_AD ElseIf (angle_B > 90) Then angle_B2 = 90 - angle_B angle_C = 180 - angle_A - angle_B angle_C2 = 90 - angle_C dist_BC = -1 ' ? dist_CD = dist_BC * Sin(Radians(angle_B2)) dist_BD = dist_BC * Sin(Radians(angle_C2)) ' dist_AD = dist_AB - dist_BD Else dist_CD = val("-1") dist_BD = val("-1") End If txtDistanceCD.Text = dist_CD txtDistanceBD.Text = dist_BD ' 2) find CE and DE If (dist_CD > -1 And dist_BD > -1) Then ' if first calcs were valid dist_DE = dist_CD * Cos(Radians(angle_D)) dist_CE = dist_CD * Sin(Radians(angle_D)) Else dist_CE = "-1" dist_DE = "-1" End If txtDistanceCE.Text = dist_CE txtDistanceDE.Text = dist_DE Dim pos As Double pos = Y * imgInput.ScaleWidth + X ra_pix(pos).angle_B = angle_B ra_pix(pos).angle_D = angle_D ra_pix(pos).dist_BD = dist_BD ra_pix(pos).dist_CE = dist_CE ra_pix(pos).dist_DE = dist_DE ra_pix(pos).created = GetTickCount txtLog.Text = "hit (" & X & ", " & Y & ") d=" & Mid(dist_CD, 1, 5) & vbNewLine & txtLog.Text 'MsgBox "hit" ' temp delay End If End Sub Private Sub cmdCapPreview_Click() ' utility/debug ezVidCap1.Preview = Not ezVidCap1.Preview End Sub Private Sub cmdStepStart_Click() ' utility/debug If no_ui Then no_ui = False linePos.Visible = True shpPos.Visible = True lineAlign1.Visible = True lineAlign2.Visible = True LineAlign3.Visible = True LineAlign4.Visible = True End If If (tmrStep.Enabled = True) Then tmrStep.Enabled = False cmdStepStart.Caption = "Start" Else tmrStep.Enabled = True cmdStepStart.Caption = "Stop" End If End Sub Private Sub tmrStep_Timer() ' utility/debug cmdStep_Click End Sub Private Sub cmdStep_Click() ' utility/debug ' change the scanning area If (cur_x + 1 > imgInput.ScaleWidth - 1) Then ' overrun right cur_x = 0 If (cur_y + 1 > imgInput.ScaleHeight) Then ' overrun bottom cur_y = 0 Else cur_y = cur_y + 1 End If Else cur_x = cur_x + 1 End If doPixel cur_x, cur_y, pa End Sub ' Start: Laser Position ' 13 12 11 10 ... 2 1 (wider) ' 25 24 ... 15 14 'Pin Name Dir Reg [(I) = Inverted] ' 1 nStrobe Out C0(I) # 0-Black laser yaw d0 ' 2 Data0 In/Out D0 # 1-White laser pitch pulse ' 3 Data1 In/Out D1 # 1-Blue laser pitch direction ' 4 Data2 In/Out D2 # ' 5 Data3 In/Out D3 # ' 6 Data4 In/Out D4 # ' 7 Data5 In/Out D5 # ' 8 Data6 In/Out D6 # ' 9 Data7 In/Out D7 # ' 10 nAck In S6 # 1-Orange laser yaw d6 ' 11 Busy In S7(I) # 1-Green laser yaw d7 ' 12 PaperOut In S5 # 0-White laser yaw d5 ' 13 Select In S4 # 0-Blue laser yaw d4 ' 14 Linefeed Out C1(I) # 0-Red laser yaw d1 ' 15 nError In S3 # 0-Green laser yaw d3 ' 16 nInit Out C2 # 0-Orange laser yaw d2 ' 17 nSelect Out C3 (Inverted) (use 15) ' 18-25 Ground # 1-Black, 1-Red (reserved) ' lpt1 base = 0x378; lpt2=0x278 ' data = +0 ' status = +1 ' control = +2 ' 7 6 5 4 3 2 1 0 ' +0 x x x x x x x x ' +1 x! x x x x ' +2 x! x x! x! ' input: 8 bits for laser position sensor ' output: laser direction, laser step Private Sub cmdLPGet_Click() Dim val1, val2, val3 As String val1 = Inp(base_port + &H1) val2 = Inp(base_port + &H2) val1 = val1 And &HF8 ' 1111 1000 val2 = val2 And &H7 ' 0000 0111 val3 = Binary(val1 Or val2) If Mid(val3, 1, 1) = "0" Then Mid(val3, 1, 1) = "1" Else Mid(val3, 1, 1) = "0" End If If Mid(val3, 7, 1) = "0" Then Mid(val3, 7, 1) = "1" Else Mid(val3, 7, 1) = "0" End If If Mid(val3, 8, 1) = "0" Then Mid(val3, 8, 1) = "1" Else Mid(val3, 8, 1) = "0" End If lp_val = FromBinary(val3) ' finished tweaking read value ' txtLog.Text = GetTickCount & ":" & val3 & vbNewLine & txtLog.Text ' debug Dim dist_a, dist_b, dist_c, angle_A As Double 'lp_val = 200 ' angle = -45+percent Dim range As Double, pct range = txtLPPos45.Text - txtLPNeg45.Text pct = 1 - ((lp_val - txtLPNeg45) / range) If range > 0 Then ' prevent divide by zero errors lp_angle = 45 + 90 * pct Else lp_angle = 0 End If If Not no_ui Then txtLPVal.Text = lp_val txtLPAngle.Text = lp_angle ' If lp_angle > 90 Then dist_c = lineLP_XAxisPos.X2 - lineLP_XAxisPos.X1 dist_a = dist_c * Sin(Radians(lp_angle)) dist_b = dist_c * Cos(Radians(lp_angle)) ' End If lineLP.X2 = lineLP.X1 + dist_b lineLP.Y2 = lineLP.Y1 - dist_a End If End Sub Private Sub cmdLPTareNeg45_Click() txtLPNeg45.Text = lp_val End Sub Private Sub cmdLPTarePos45_Click() txtLPPos45.Text = lp_val End Sub Private Sub cmdLaserStep_Click() ' D0 = Laser Pitch Pulse ' D1 = Laser Pitch Direction lp_out = lp_out And &HFE& ' 1111 1110 If (lp_angle > 90) Then ' makeclockwise lp_out = lp_out Or &H2& ' 0000 0010 ElseIf (lp_angle < 45) Then ' make counterclockwise lp_out = lp_out And &HFD& ' 1111 1101 End If Out base_port, lp_out ' second part of pulse tmrLaserStep.Enabled = True End Sub Private Sub tmrLaserStep_Timer() tmrLaserStep.Enabled = False lp_out = lp_out Or &H1& ' 0000 0001 Out base_port, lp_out ' pulse the step line End Sub Private Sub cmdLPStart_Click() ' start/stop laser position automatic updates ' utility/debug If cmdLPStart.Caption = "Start" Then tmrLP.Enabled = True cmdLPStart.Caption = "Stop" Else tmrLP.Enabled = False cmdLPStart.Caption = "Start" End If End Sub Private Sub tmrLP_Timer() ' utility/debug cmdLPGet_Click End Sub 'Private Sub cmdLaserToggle_Click() ' debug ' If cmdLaserToggle.Caption = "Toggle 1" Then ' lp_out = lp_out Or &H1& ' 0000 0001 ' Out base_port, lp_out ' cmdLaserToggle.Caption = "Toggle 0" ' ' If (txtLaserCurDirection.Text = "Clockwise") Then ' ' clockwise ' lp_out = lp_out Or &H2& ' 0000 0010 ' Out base_port, lp_out ' txtLaserCurSteps.Text = txtLaserCurSteps.Text + 1 ' Else ' ' counterclockwise ' lp_out = lp_out And &HFD& ' 1111 1101 ' Out base_port, lp_out ' txtLaserCurSteps.Text = txtLaserCurSteps.Text - 1 ' End If ' If (Val(txtLaserCurSteps.Text) >= Val(txtLaserStepsPer45.Text)) Then ' txtLaserCurDirection.Text = "CounterClockwise" ' ElseIf (Val(txtLaserCurSteps.Text) < 0) Then ' txtLaserCurDirection.Text = "Clockwise" ' End If ' ' txtLaserCurAngle.Text = (txtLaserStepsPer45 / 45) * txtLaserCurSteps.Text ' Else ' lp_out = lp_out And &HFE& ' 1111 1110 ' Out base_port, lp_out ' cmdLaserToggle.Caption = "Toggle 1" ' End If 'End Sub ' End: Laser Position ' file I/O Private Sub cmdWriteToTXT_Click() dlgWriteFile.DefaultExt = "txt" dlgWriteFile.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*" dlgWriteFile.ShowSave If dlgWriteFile.FileName <> "" Then Open dlgWriteFile.FileName For Output As #1 Print #1, "#angle_B|angle_D|dist_BD|dist_CE|dist_DE|created" Print #1, ":created=" & GetTickCount & " # created are ms relative to this" Dim X As Double, Y As Double Dim pix As pixang For X = 0 To imgInput.ScaleWidth - 1 For Y = 0 To imgInput.ScaleHeight - 1 pix = ra_pix(Y * (imgInput.ScaleWidth - 1) + X) If (pix.created > 0) Then Print #1, Mid(pix.angle_B, 1, 7) & "|" & Mid(pix.angle_D, 1, 7) & "|" & Mid(pix.dist_BD, 1, 7) & "|" & Mid(pix.dist_CE, 1, 7) & "|" & Mid(pix.dist_DE, 1, 7) & "|" & pix.created End If Next Next Close #1 End If End Sub Private Sub cmdWriteToXLS_Click() ' dlgWriteFile.DefaultExt = "xls" ' dlgWriteFile.Filter = "Excel Files (*.xls)|*.xls|All Files (*.*)|*.*" ' dlgWriteFile.ShowSave ' If dlgWriteFile.FileName <> "" Then ' Open dlgWriteFile.FileName For Output As #1 ' Print #1, "" ' 1) check if anything is in that column ' Dim cur_col As Integer ' Dim ra_cols(0 To imgInput.ScaleWidth - 1) As Long ' angle_b ' For x = 0 To imgInput.ScaleWidth - 1 ' For y = 0 To imgInput.ScaleHeight - 1 ' pix = ra_pix(y * (imgInput.ScaleWidth - 1) + x) ' If (pix.created > 0) Then ' ra_cols(cur_col) = Mid(pix.angle_B, 1, 7) ' cur_col = cur_col + 1 ' Exit For ' should go to next x ' End If ' Next ' Next ' 2) check if anything is in that row ' Dim ra_rows(0 To imgInput.ScaleHeight - 1) As Long ' angle_d ' 3) show ' Dim x As Double, y As Double ' Dim pix As pixang ' Print #1, "" ' For x = 0 To imgInput.ScaleWidth - 1 Step 2 ' print header row ' Print #1, "" ' Next ' Print #1, "" ' ' For x = 0 To imgInput.ScaleWidth - 1 Step 2 ' Print #1, vbNewLine & "" ' For y = 0 To imgInput.ScaleHeight - 1 ' pix = ra_pix(y * (imgInput.ScaleWidth - 1) + x) ' Print #1, "" ' Next ' Print #1, "" ' Next ' Print #1, "
" & Mid(pix.angle_B, 1, 7) & "
" & Mid(pix.angle_D, 1, 7) & "" & Mid(pix.dist_BD, 1, 7) & "
" ' Print ' Close #1 ' End If End Sub Private Sub cmdVisDraw_Click() Dim X, Y, orig_x, orig_y, count, multiplier Dim pix As pixang orig_x = (lineOrigX.X2 - lineOrigX.X1) / 2 + lineOrigX.X1 orig_y = (lineOrigX.Y2 - lineOrigX.Y1) / 2 + lineOrigX.Y1 multiplier = Abs((lineOrigX.Y2 - lineOrigX.Y1) / 100) For count = lineVis.LBound To lineVis.UBound lineVis(count).Visible = False Next count = 0 For X = 0 To imgInput.ScaleWidth - 1 For Y = 0 To imgInput.ScaleHeight - 1 pix = ra_pix(Y * (imgInput.ScaleWidth - 1) + X) If (pix.created > 0) Then count = count + 1 If (count > lineVis.UBound) Then Load lineVis(lineVis.UBound + 1) End If With lineVis(count) .X2 = orig_x - pix.dist_BD * multiplier .Y2 = orig_y + pix.dist_CE * multiplier ' todo: calculate in distance .Visible = True End With End If Next Next End Sub ' general maintenance stuff Private Sub Form_Load() Set pa = New clsPicArray ' initialize picture array no_ui = False ezVidCap1.Preview = True ' has to be on to do SaveDIB ' load the video capture driver options Dim i If ezVidCap1.NumCapDevs > 0 Then For i = 0 To ezVidCap1.NumCapDevs - 1 cmbDevice.AddItem (ezVidCap1.GetDriverName(i)) Next cmbDevice.ListIndex = ezVidCap1.DriverIndex Else cmbDevice.AddItem ("") cmbDevice.ListIndex = 0 MsgBox "No Video Capture Device!", vbInformation, App.Title End If cmbDevice.ListIndex = GetSetting("LaserDistance", "Settings", "DeviceIndex", cmbDevice.ListIndex) txtCameraYaw.Text = GetSetting("LaserDistance", "Settings", "CameraYaw", "-1") txtCameraYawOffset.Text = GetSetting("LaserDistance", "Settings", "CameraYawOffset", "-1") txtCameraPitch.Text = GetSetting("LaserDistance", "Settings", "CameraPitch", "-1") txtCameraPitchOffset.Text = GetSetting("LaserDistance", "Settings", "CameraPitchOffset", "0") txtDistAB.Text = GetSetting("LaserDistance", "Settings", "DistAB", "-1") txtLPNeg45.Text = GetSetting("LaserDistance", "Settings", "LPNeg45", txtLPNeg45.Text) txtLPPos45.Text = GetSetting("LaserDistance", "Settings", "LPPos45", txtLPPos45.Text) ' Out base_port + 2, &H10 ' 0001 0000 txtLaserPitch.Text = 0 cur_y = 106 End Sub Private Sub imgInput_Resize() ReDim ra_pix(0 To (imgInput.ScaleWidth) * (imgInput.ScaleHeight)) As pixang lineAlign1.X1 = 0 ' cross lineAlign1.Y1 = 0 lineAlign1.X2 = imgInput.ScaleWidth lineAlign1.Y2 = imgInput.ScaleHeight lineAlign2.X1 = 0 ' cross lineAlign2.Y1 = imgInput.ScaleHeight lineAlign2.X2 = imgInput.ScaleWidth lineAlign2.Y2 = 0 LineAlign3.X1 = 0 ' horiz LineAlign3.Y1 = imgInput.ScaleHeight / 2 LineAlign3.X2 = imgInput.ScaleWidth LineAlign3.Y2 = imgInput.ScaleHeight / 2 LineAlign4.X1 = imgInput.ScaleWidth / 2 LineAlign4.Y1 = 0 ' vert LineAlign4.X2 = imgInput.ScaleWidth / 2 LineAlign4.Y2 = imgInput.ScaleHeight If no_ui Then linePos.Visible = False shpPos.Visible = False lineAlign1.Visible = False lineAlign2.Visible = False LineAlign3.Visible = False LineAlign4.Visible = False End If End Sub ' save settings and stuff Private Sub txtCameraYaw_Change() SaveSetting "LaserDistance", "Settings", "CameraYaw", txtCameraYaw.Text End Sub Private Sub txtCameraYawOffset_Change() SaveSetting "LaserDistance", "Settings", "CameraYawOffset", txtCameraYawOffset.Text End Sub Private Sub txtCameraPitch_Change() SaveSetting "LaserDistance", "Settings", "CameraPitch", txtCameraPitch.Text End Sub Private Sub txtCameraPitchOffset_Change() SaveSetting "LaserDistance", "Settings", "CameraPitchOffset", txtCameraPitchOffset.Text End Sub Private Sub txtDistAB_Change() SaveSetting "LaserDistance", "Settings", "DistAB", txtDistAB.Text End Sub Private Sub txtLPNeg45_Change() SaveSetting "LaserDistance", "Settings", "LPNeg45", txtLPNeg45.Text End Sub Private Sub txtLPPos45_Change() SaveSetting "LaserDistance", "Settings", "LPPos45", txtLPPos45.Text End Sub Private Sub cmbDevice_Change() Dim oldDriver As Long oldDriver = ezVidCap1.DriverIndex On Error Resume Next ezVidCap1.DriverIndex = cmbDevice.ListIndex If Err Then 'restore old settings ezVidCap1.DriverIndex = oldDriver cmbDevice.ListIndex = oldDriver Else SaveSetting "LaserDistance", "Settings", "DeviceIndex", cmbDevice.ListIndex End If End Sub ' generic functions Function Radians(Degrees As Double) Radians = Degrees * (3.141592654 / 180) End Function Function Degrees(Radians As Double) Degrees = Radians * (180 / 3.141592654) End Function Function PadHex(Value As Variant, Optional length As Integer = 2) As String ' returns a 0 padded hex value PadHex = Hex(Value) Do While (Len(PadHex) < length) PadHex = "0" & PadHex Loop End Function Function fixcolor(color As Double) As Double If (color = -1 Or color > val("&hffffff")) Then fixcolor = val("&hFF00F6") ' todo: fix this Else fixcolor = color End If End Function Private Function Binary(val) Dim cur Binary = "" cur = val If cur >= 2 ^ 7 Then Binary = Binary & "1" cur = cur - 2 ^ 7 Else Binary = Binary & "0" End If If cur >= 2 ^ 6 Then Binary = Binary & "1" cur = cur - 2 ^ 6 Else Binary = Binary & "0" End If If cur >= 2 ^ 5 Then Binary = Binary & "1" cur = cur - 2 ^ 5 Else Binary = Binary & "0" End If If cur >= 2 ^ 4 Then Binary = Binary & "1" cur = cur - 2 ^ 4 Else Binary = Binary & "0" End If If cur >= 2 ^ 3 Then Binary = Binary & "1" cur = cur - 2 ^ 3 Else Binary = Binary & "0" End If If cur >= 2 ^ 2 Then Binary = Binary & "1" cur = cur - 2 ^ 2 Else Binary = Binary & "0" End If If cur >= 2 ^ 1 Then Binary = Binary & "1" cur = cur - 2 ^ 1 Else Binary = Binary & "0" End If If cur >= 1 Then Binary = Binary & "1" Else Binary = Binary & "0" End If End Function Public Function FromBinary(val As String) As Byte FromBinary = 0 If Mid(val, Len(val) - 0, 1) = "1" Then FromBinary = FromBinary + 2 ^ 0 End If If Mid(val, Len(val) - 1, 1) = "1" Then FromBinary = FromBinary + 2 ^ 1 End If If Mid(val, Len(val) - 2, 1) = "1" Then FromBinary = FromBinary + 2 ^ 2 End If If Mid(val, Len(val) - 3, 1) = "1" Then FromBinary = FromBinary + 2 ^ 3 End If If Mid(val, Len(val) - 4, 1) = "1" Then FromBinary = FromBinary + 2 ^ 4 End If If Mid(val, Len(val) - 5, 1) = "1" Then FromBinary = FromBinary + 2 ^ 5 End If If Mid(val, Len(val) - 6, 1) = "1" Then FromBinary = FromBinary + 2 ^ 6 End If If Mid(val, Len(val) - 7, 1) = "1" Then FromBinary = FromBinary + 2 ^ 7 End If End Function