Документ взят из кэша поисковой машины. Адрес оригинального документа : http://imaging.cs.msu.su/~yurin/2008.astr.Yurin_Kravtsov.script.ru.pdf
Дата изменения: Wed Jul 9 21:13:25 2008
Дата индексирования: Sat Apr 9 23:27:49 2016
Кодировка:
, ++, .NET .., .. . , 119899, , , 2- andrey.a.kravtsov@gmail.com, yurin_d@inbox.ru , -, ++ [1,2], Microsoft .NET [3], JScript. .NET. . , , , . .
1.

. [4-7]. , , , , , , , , () .. ++ ++, [8]. ++ , , , . ++ . , (),


, , . , , , ) . , ( , , , . Windows .NET[3]. ++ Managed C++, .NET, ++, . , .NET Jscript VBasicScript ( Microsoft.Vsa, Microsoft.JScript, Microsoft.VBScript), .NET. , ++ () , , , ++, .
2.

. 1. « » - , .NET. , .


«», , - #, , JScript.NET ( VBScript.NET). ( ). , .NET. .NET. .1. JScript.NET: , .

: -, , , , . , JScript.NET ­ , , , Microsoft .NET. , . , , . , ­ . « » - (dll), Managed C++, /C++ . , native- .
3.

, ENVI [9], , -, . , DIB BMP. , ,


, , , # . native- ImageDescriptor, Width ­ ; Height ­ ; Bands ­ (, 1 ­ , 3 ­ RGB); DataType ­ . : Byte (DataType = 1), unsigned short (16 bit, DataType = 12) float32 (DataType = 4). Interleaving ­ . : BSQ (Band sequentional) ­ , ..; BIL (band interleaving by line) ­ ; BIP (band interleaving by pixel) ­ . NLS (next line shift) ­ , , , . Width (, ). NBS (next band shift) ­ , , , . DataPtr ­ . ImageDescriptor , . : , , . , , . ImageDescriptor - , int GetInfoRow(), (handle), ­ ImageDescriptor, ImageDescriptor(int inforow), ­ .


, int C/C++, .NET , , ++ ++ , ++.
4.

, [4]. - . 2.

.2. -

4.1

C#, , , () :


C# string appPath = Application.StartupPath; m_ScriptEngine appPath + appPath + appPath + appPath + appPath + = ScriptEngine.GetInstance(new string[] { @"\DotNetImageWrapper.dll", @"\FilterPreprocessing.dll", @"\Hartley.dll", @"\Hartley1DWrapper.dll", @"\ToPolarWrapper.dll"});

string script = ScriptEngine.ReadScriptFromFile(Application.StartupPath+@"\LineDetection.js"); m_ScriptEngine.AddVariableAndInitialize("_filterInput", new Bitmap("demo.bmp")); m_ScriptEngine.Eval(script); m_ScriptEngine.Eval("JLastLineObject.Run();");

4.2

, JScript.NET. Microsoft.JScript.dll Microsoft.Vsa.dll. , [10] Microsoft.JScript Microsoft.Vsa , , . ScriptEngine:
C# using using using using using using using using System; System.Reflection; System.Collections; System.Collections.Generic; System.Windows.Forms; Microsoft.JScript; Microsoft.JScript.Vsa; Microsoft.Vsa; try { result = Eval.JScriptEvaluate(scriptText, m_GlobalScope.engine); } catch (JScriptException ex) { result = ex; MessageBox.Show(ex.Message, string.Format( "Error in script in position ({0}, {1})", ex.Line.ToString(),ex.Column.ToString()), MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return result; } // public static string ReadScriptFromFile( string fileName) { System.IO.StreamReader sr = new System.IO.StreamReader(fileName); string sScript = ""; try { sScript = sr.ReadToEnd(); } catch (Exception ex) { //TODO } finally { sr.Close(); }

public class ScriptEngine : System.ComponentModel.Component { GlobalScope m_GlobalScope = null; public GlobalScope GlobalScope { get { return m_GlobalScope; } } // . // , public ScriptEngine(string[] assemblyReferences) { GlobalScope gs = VsaEngine.CreateEngineAndGetGlobalScope( false, assemblyReferences); VsaEngine engine = gs.engine; GlobalScope newGS =new GlobalScope(gs,engine); engine.PushScriptObject(newGS); m_GlobalScope = newGS; } // public object Eval(string scriptText) { // object result = null;


return sScript; } // // static void CollectNamespaces(Assembly assembly, Hashtable hTable) { Type[] types = assembly.GetTypes(); if (types == null || types.Length == 0) return; foreach (Type type in types) { if (!type.IsSubclassOf(typeof(Object))) continue; if (type.Namespace != null) hTable[type.Namespace] = type; } } // hTable // assembly static void CollectReferences(Assembly assembly, Hashtable hTable) { hTable[assembly.FullName] = assembly; AssemblyName[] aNames = assembly.GetReferencedAssemblies(); if (aNames == null || aNames.Length == 0) return; foreach (AssemblyName aName in aNames) { string fullName = aName.FullName; if (hTable.ContainsKey(fullName)) continue; try { Assembly assemb = Assembly.Load(aName); hTable.Add(fullName, assemb); } catch { } } } // void Import(params string[] list) { foreach (string listItem in list) { Import.JScriptImport(listItem, GlobalScope.engine); } } // name // public void AddVariable(string name) { m_GlobalScope.AddField(name); } // name value public object SetVariable(string name, object value) { return m_GlobalScope.InvokeMember(name, BindingFlags.SetField, null, m_GlobalScope, new object[] { value }, null, null, null); } // public void AddVariableAndInitialize(string variableName, object variableValue) { AddVariable(variableName);

SetVariable(variableName, variableValue); } // varName public object GetVariable(string varName) { return m_GlobalScope.InvokeMember(varName, BindingFlags.GetField, null, m_GlobalScope, null, null, null, null); } //, //ScriptEngine. public static ScriptEngine GetInstance( string[] dlls) { List aAssemblies = new List(); // // aAssemblies.AddRange( AppDomain.CurrentDomain.GetAssemblies()); foreach (string dll in dlls) { try { // dll Assembly assembly =Assembly.LoadFrom(dll); if (!aAssemblies.Contains(assembly)) aAssemblies.Add(assembly); } catch { } } Hashtable tableAssemblies = new Hashtable(); // foreach (Assembly assembly in aAssemblies) { ScriptEngine.CollectReferences(assembly, tableAssemblies); } Hashtable tableNamespaces = new Hashtable(); // foreach (DictionaryEntry entry in tableAssemblies) { ScriptEngine.CollectNamespaces( (Assembly)entry.Value, tableNamespaces); } string[] aStringDll = (string[])( new ArrayList(tableAssemblies.Keys)).ToArray( typeof(string)); string[] aStringNS = (string[])( new ArrayList(tableNamespaces.Keys)).ToArray( typeof(string)); ScriptEngine engine = new ScriptEngine(aStringDll); engine.Import(aStringNS); return engine; } }


4.3

, .NET. managed- :
Managed C++ // include section #include "integral_transforms.h" using namespace System; using namespace System::Drawing; using namespace ScriptImaging; public ref class Hartley2DWrapper { public: Hartley2DWrapper(){} ~Hartley2DWrapper(){} !Hartley2DWrapper() {} public: void DoJob(int imginfo) { ImageDescriptor img_id(imginfo); size_t n[] = {img_id.Width,img_id.Height}; float* fPtr = (float*)(img_id.DataPtr); SwapQuadrants<2, false>(fPtr, n); fht2D(fPtr, n[0], n[1]); SwapQuadrants<2, false>(fPtr, n); } };

, managed- C++, SwapQuadrants fht2D.
4.4

, , - .2:
JScript.NET public class JLineDetector { public function Run(): void { var bmpW:int = _filterInput.Width; var bmpH:int = _filterInput.Height; var maxWH:int = Math.max(bmpW, bmpH); var twoPow:int = 1; while (twoPow < maxWH) twoPow *= 2; var img1:ScriptImage = new ScriptImage(twoPow, twoPow, 1, 3); var img2:ScriptImage = new ScriptImage(twoPow, twoPow, 1, 3); var filter1:ZeroPadding = new ZeroPadding(); filter1.DoJob(_filterInput, img1.InfoRow); var filter2:Hartley2DWrapper = new Hartley2DWrapper(); filter2.DoJob(img1.InfoRow); var filter3:ToPolarWrapper = new ToPolarWrapper(); filter3.DoJob(img1.InfoRow, img2.InfoRow); var filter4:Hartley1DWrapper = new Hartley1DWrapper(); filter4.DoJob(img2.InfoRow); // Save images img1.SaveAsBitmap(false, "out1.png"); img2.SaveAsBitmap(false, "out2.png"); } }; var JLastLineObject:JLineDetector = new JLineDetector();


4.5

: ScriptImage (JScript.NET), ( handle). ImageDescriptor, , , , . -, . .
1.

. ++. ++ In-Depth, .3.:. . -.: "", 2002. -336 .

2. 3. 4.

. ++. -: BHV, 2008, 1104 . ., C# .NET, -.: , 2006, 752 . D.B. Volegov, V.V. Gusev, D.V. Yurin Straight Line Detection on Images via Hartley

Transform. Fast Hough Transform. //16-th International Conference on Computer Graphics and Applications GraphiCon'2006. Novosibirsk Akademgorodok, Russia, July 1 - 5, 2006, -P. 182191. http://www.graphicon.ru/2006/proceedings/papers/fr11_35_Volegov_Gusev_Yurin.pdf.
5.

B.S. Reddy, B.N. Chatterji, "An FFT-based technique for translation, rotation, and scale-

invariant image registration", IEEE PAMI, Vol 5(8), pp. 1266-1271, August, 1996.
6.

James Davis. Mosaics of scenes with moving objects. In Proc. Computer Vision and Pattern

Recognition Conf., pages 354--360, 1998. http://citeseer.ist.psu.edu/davis98mosaics.html.
7.

Siavash Zokai, George Wolberg. Image Registration Using Log-Polar Mappings for Processing, Vol. 14, No. 10, October 2005. http://www-

Recovery of Large-Scale Similarity and Projective Transformations //IEEE Transactions on Image cs.engr.ccny.cuny.edu/~wolberg/pub/tip05.pdf
8.

B. Georgescu, P. Meer. Point Matching under Large Image Deformations and Illumination

Changes //IEEE Transactions On Pattern Analysis and Machine Intelligence, June 2004, -V. 26, -No. 6, -P. 674-688. Code available at http://www.caip.rutgers.edu/riul/research/code.html
9.

ITT Visual Information Solutions, (before May 15, 2006 ­ RSI - Research

Systems, Inc.), ENVI, http://www.ittvis.com/index.asp.
10. Microsoft Developer Network (MSDN)