コード例 #1
0
 public static void SaveRepository(SurfAlgo algo)
 {
     if (algo == SurfAlgo.Linear)
     {
         SaveRepoForLinear();
     }
     else
     {
         SaveRepoForFlann();
     }
 }
コード例 #2
0
 public static bool IsRepositoryInMemoryLoaded(SurfAlgo algo)
 {
     if (algo == SurfAlgo.Linear)
     {
         return(Exists(_SURFRecord2List));
     }
     else
     {
         return(Exists(_superMatrixDataSet));
     }
 }
コード例 #3
0
        /// <summary>
        /// Load the cache from the File
        /// </summary>
        /// <param name="fullFileName">File the full file path, else, it will try to load from default file if it exists</param>
        /// <returns></returns>
        public static void LoadRespositoryFromFile(SurfAlgo surfAlgo, string fullFileName = "")
        {
            string repoFileStoragePath = string.Empty;

            string defaultRepoFileStorageName = surfAlgo == SurfAlgo.Linear ? "observerFeatureSets.bin" : "superMatrix.bin";

            if (string.IsNullOrWhiteSpace(fullFileName))
            {
                repoFileStoragePath = Path.Combine(SaveDirectoryPath, defaultRepoFileStorageName);
            }
            else
            {
                repoFileStoragePath = fullFileName;
            }

            if (!File.Exists(repoFileStoragePath))
            {
                throw new ArgumentException(string.Format("Can't find Surf Repository file at {0} :", repoFileStoragePath));
            }

            FileStream stream    = File.OpenRead(repoFileStoragePath);
            var        formatter = new BinaryFormatter();

            if (surfAlgo == SurfAlgo.Linear)
            {
                List <SURFRecord2> observerFeatureSets = (List <SURFRecord2>)formatter.Deserialize(stream);
                stream.Close();
                AddSURFRecord2List(observerFeatureSets);
            }
            else if (surfAlgo == SurfAlgo.Flaan)
            {
                SuperMatrixType superMatrix = (SuperMatrixType)formatter.Deserialize(stream);
                stream.Close();
                AddSuperMatrixList(superMatrix);
            }


            //Polenter.Serialization.SharpSerializerBinarySettings st = new Polenter.Serialization.SharpSerializerBinarySettings(Polenter.Serialization.BinarySerializationMode.SizeOptimized);
            //Polenter.Serialization.SharpSerializer serializer = new Polenter.Serialization.SharpSerializer(st);
            //List<SURFRecord2> observerFeatureSets = (List<SURFRecord2>)serializer.Deserialize(repoFileStoragePath);
        }
コード例 #4
0
ファイル: SurfRepository.cs プロジェクト: gjtjx/ImageDatabase
 public static void SaveRepository(SurfAlgo algo)
 {
     if (algo == SurfAlgo.Linear)
         SaveRepoForLinear();
     else
         SaveRepoForFlann();
 }
コード例 #5
0
ファイル: SurfRepository.cs プロジェクト: gjtjx/ImageDatabase
        /// <summary>
        /// Load the cache from the File
        /// </summary>
        /// <param name="fullFileName">File the full file path, else, it will try to load from default file if it exists</param>
        /// <returns></returns>
        public static void LoadRespositoryFromFile(SurfAlgo surfAlgo, string fullFileName = "")
        {
            string repoFileStoragePath = string.Empty;

            string defaultRepoFileStorageName = surfAlgo == SurfAlgo.Linear ? "observerFeatureSets.bin" : "superMatrix.bin";

            if (string.IsNullOrWhiteSpace(fullFileName))
            {
                repoFileStoragePath = Path.Combine(SaveDirectoryPath, defaultRepoFileStorageName);
            }
            else
            {
                repoFileStoragePath = fullFileName;
            }

            if (!File.Exists(repoFileStoragePath))
                throw new ArgumentException(string.Format("Can't find Surf Repository file at {0} :", repoFileStoragePath));

            FileStream stream = File.OpenRead(repoFileStoragePath);
            var formatter = new BinaryFormatter();

            if (surfAlgo == SurfAlgo.Linear)
            {
                List<SURFRecord2> observerFeatureSets = (List<SURFRecord2>)formatter.Deserialize(stream);
                stream.Close();
                AddSURFRecord2List(observerFeatureSets);
            }
            else if (surfAlgo == SurfAlgo.Flaan)
            {
                SuperMatrixType superMatrix = (SuperMatrixType)formatter.Deserialize(stream);
                stream.Close();
                AddSuperMatrixList(superMatrix);
            }

            //Polenter.Serialization.SharpSerializerBinarySettings st = new Polenter.Serialization.SharpSerializerBinarySettings(Polenter.Serialization.BinarySerializationMode.SizeOptimized);
            //Polenter.Serialization.SharpSerializer serializer = new Polenter.Serialization.SharpSerializer(st);
            //List<SURFRecord2> observerFeatureSets = (List<SURFRecord2>)serializer.Deserialize(repoFileStoragePath);
        }
コード例 #6
0
ファイル: SurfRepository.cs プロジェクト: gjtjx/ImageDatabase
 public static bool IsRepositoryInMemoryLoaded(SurfAlgo algo)
 {
     if (algo == SurfAlgo.Linear)
     {
         return Exists(_SURFRecord2List);
     }
     else
     {
         return Exists(_superMatrixDataSet);
     }
 }