Automatic Coordinate Register System
Image registration is the process of transforming different sets of data into one coordinate system. Data may be multiple photographs, data from different sensors, from different times, or from different viewpoints [1]. It is used in computer vision, medical imaging, military automatic target recognition, and compiling and analyzing images and data from satellites. Registration is necessary in order to be able to compare or integrate the data obtained from these different measurements. [1] Wikipedia, http://en.wikipedia.org/wiki/Image_registration
This program is designed to Small Format Aerial Photo Application. This process is to manipulate the ER Mapper Files (*.ers) using LISTRIG file (*.txt) in batch. After this process, you will have ER Mapper files which have an additional GCP inside generated from LISTRIG file, then you can rectify those files in batch using the automatic rectification wizard from ER Mapper.
On Error Resume Next Dim b1 As Variant Dim b2 As Variant Dim plus As Variant Dim origin As Variant Dim origin1 As Variant Dim plus1 As Variant Dim plus2 As Variant datapath = Dir1.Path datapath1 = datapath & "\*.ers" datapath2 = datapath & "\" dirpath = Dir2.Path 'Directory data dengan format *.ers opt = Dir$(datapath1) totalfile = 0 While Not opt = "" totalfile = totalfile + 1 List1.AddItem opt opt1(totalfile) = datapath2 & opt opt = Dir$ Wend For v = 1 To totalfile If v = totalfile Then opt2(1) = opt1(totalfile) Else opt2(v + 1) = opt1(v) End If Next v input_file = Text1.Text result = "\" & TxtOutput.Text PBar1.Min = 0 PBar1.Max = totalfile ft = App.Path & "\file_temp.txt" data_file = App.Path & "\data_temp.txt" For j = 1 To totalfile I = j + 1 Open opt1(j) For Input As #1 'filename *.ers Open input_file For Input As #3 Open data_file For Input As #5 Open ft For Input As #2 'template file out1 = dirpath & result out2 = ".ers" output_file = out1 & j & out2 Open output_file For Output As #4 Input #1, b1 n = Len(b1) origin = b1 Input #2, b2 m = Len(b2) origin1 = Replace(origin, "RasterInfo End", b2, 1, -1, 1) plus = origin1 k = Len(plus) Xa = TxtXphoto.Text Ya = TxtYphoto.Text xb = Val(Xa / 2) yb = Val(Ya / 2) plus1 = Replace(plus, "Xa", Xa, 1, -1, 1) plus2 = Replace(plus1, "Ya", Ya, 1, -1, 1) plus3 = Replace(plus2, "Xb", xb, 1, -1, 1) plus4 = Replace(plus3, "Yb", yb, 1, -1, 1) If TxtDatum.Text = "" Then plus5 = Replace(plus4, "Dt", "RAW", 1, -1, 1) Else plus5 = Replace(plus4, "Dt", TxtDatum.Text, 1, -1, 1) End If If TxtProj.Text = "" Then plus6 = Replace(plus5, "Pj", "RAW", 1, -1, 1) Else plus6 = Replace(plus5, "Pj", TxtProj.Text, 1, -1, 1) End If If TxtCoor.Text = "" Then plus7 = Replace(plus6, "Ct1", "RAW", 1, -1, 1) Else plus7 = Replace(plus6, "Ct1", TxtCoor.Text, 1, -1, 1) End If trap = 0 While Not EOF(3) Input #3, d1, d2, d3, d4, d5, d6, d7, d8 nX = Val(d4) + Val(d5) / 60 nY = Val(d2) + Val(d3) / 60 a = nX b = nY ' x = a dan y = b trap = trap + 1 If trap = j Then a3 = a b3 = b a1 = a - (xb / 111000) a2 = a + (xb / 111000) b1 = b - (yb / 111000) b2 = b + (yb / 111000) plus8 = Replace(plus7, "x1", Str(a1), 1, -1, 1) plus9 = Replace(plus8, "x2", Str(a2), 1, -1, 1) plus10 = Replace(plus9, "y1", Str(b1), 1, -1, 1) plus11 = Replace(plus10, "y2", Str(b2), 1, -1, 1) plus12 = Replace(plus11, "x3", Str(a3), 1, -1, 1) plus13 = Replace(plus12, "y3", Str(b3), 1, -1, 1) End If Wend Close #2 Close #3 Input #5, df dirfile = Replace(Dir1.Path, "\", "\\", 1, -1, 1) datfile = Replace(opt2(j), Dir1.Path & "\", "", 1, -1, 1) datfile1 = Replace(datfile, ".ers", "", 1, -1, 1) datfile2 = dirfile & "/" & datfile1 plus14 = Replace(plus13, "= ERStorage", "", 1, -1, 1) plus15 = Replace(plus14, "DataSetType", df, 1, -1, 1) plus16 = Replace(plus15, "apusan", datfile2, 1, -1, 1) Print #4, plus16 Close #4 Close #5 Close #1