Exemplo n.º 1
0
        //////////////////////////////////////////////////////////////////////////////////////////////
        #endregion

        #region 讀值方圖檔
        //////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// 讀取直方圖(只支援一維與二維
        /// </summary>
        /// <param name="fileName">檔案路徑名稱</param>
        /// <param name="isShowHist">是否要顯示值方圖</param>
        /// <returns>回傳值方圖類別</returns>
        public static DenseHistogram ReadHistogram(string fileName, bool isShowHist)
        {
            string         format    = Path.GetExtension(fileName); //取得副檔名
            DenseHistogram histogram = FeatureDataFilesOperation.ReadHistogramDataFromBinaryXml(fileName);

            Console.WriteLine("Read Histogram Data in " + format + "........\n ");
            if (isShowHist)
            {
                if (histogram.Dimension == 1)
                {
                    SystemToolBox.Show1DHistogramDataOnConsole(histogram);
                }
                else if (histogram.Dimension == 2)
                {
                    SystemToolBox.Show2DHistogramDataOnConsole(histogram);
                }
            }
            Console.WriteLine("\n");
            return(histogram);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 儲存值方圖資料
 /// </summary>
 /// <param name="fileName">檔案路徑名稱</param>
 /// <param name="hsvHist">值方圖資料</param>
 /// <returns>回傳是否儲存成功</returns>
 public bool SaveHistogram(string fileName, DenseHistogram hsvHist)
 {
     if (hsvHist != null)
     {
         string format = Path.GetExtension(fileName); //取得副檔名
         if (format == ".xml")
         {
             FeatureDataFilesOperation.WriteHistogramDataToBinaryXml(hsvHist, fileName);
         }
         //Console Output觀看數值
         Console.WriteLine("Save Histogram Data in " + format + "........\n ");
         if (hsvHist.Dimension == 1)
         {
             SystemToolBox.Show1DHistogramDataOnConsole(hsvHist);
         }
         else if (hsvHist.Dimension == 2)
         {
             SystemToolBox.Show2DHistogramDataOnConsole(hsvHist);
         }
         Console.WriteLine("\n");
         return(true);
     }
     return(false);
 }