void btnSearchCap_Click(object sender, EventArgs e) { List <Object> result = Searching.SearchByQuery(textCaptionStorage, ConfigCommon.TOP_RANK, txtQuery.Text, SearchType.CAPTION); if (result != null && result.Count > 0) { foreach (TextCaption c in result) { Console.WriteLine(c.FrameName + "\t" + c.Caption); } } }
private void btnSearchTextSpot_Click(object sender, EventArgs e) { List <Object> result = Searching.SearchByQuery(textSpotIndexStorage, ConfigCommon.TOP_RANK, txtQuery.Text, SearchType.OCR); if (result != null && result.Count > 0) { foreach (TextSpot c in result) { Console.WriteLine(c.FileName + "\t" + c.Text); } } }
// Button private void btnSearch_Click(object sender, EventArgs e) { textQuery = txtTextQuery.Text; if (String.IsNullOrWhiteSpace(textQuery)) { return; } List <String> listPath = new List <string>(); if (rbtnContent.Checked) { searchType = SearchType.CAPTION; } else if (rbtnORC.Checked) { searchType = SearchType.OCR; } if (searchType == SearchType.CAPTION) { //string[] listScaledVideoId = File.ReadAllLines(ConfigEvaluation.scaledvideo_textSpotting); List <Object> textCaption = Searching.SearchByQuery(textCaptionIndexStorage, ConfigCommon.TOP_RANK, textQuery, searchType); if (textCaption != null && textCaption.Count > 0) { //String pathFolderParent = @"I:\net\dl380g7a\export\ddn11a2\ledduy\trecvid-avs\keyframe-5\tv2016\test.iacc.3/"; foreach (TextCaption text in textCaption) { String fileName = Path.GetFileName(text.FrameName); Frame frame; if (Path.GetExtension(fileName) == ".jpg") { frame = Utils.Decoder.DecodeFrameFromName(fileName); } else { frame = Utils.Decoder.DecodeFrameFromNameTxt(fileName); } //if (!listScaledVideoId.Contains(frame.VideoId)) // continue; String root = Path.Combine(ConfigCommon.FRAME_DATA_PATH, String.Format("TRECVID2016_{0}", frame.VideoId)); fileName = Path.Combine(root, fileName); fileName = fileName.Replace(".txt", ".jpg"); //Console.WriteLine(fileName); listPath.Add(fileName); } } if (textCaption == null) { Console.WriteLine("Ko co ket qua"); MessageBox.Show("Không có kết quả!", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { Console.WriteLine("Search xong ne"); } } else if (searchType == SearchType.OCR) { List <Object> textSpots = Searching.SearchByQuery(textSpotingIndexStorage, ConfigCommon.TOP_RANK, textQuery, searchType); if (textSpots != null && textSpots.Count > 0) { //String pathFolderParent = @"I:\net\dl380g7a\export\ddn11a2\ledduy\trecvid-avs\keyframe-5\tv2016\test.iacc.3/"; foreach (TextSpot text in textSpots) { String fileName = Path.GetFileName(text.FileName); Frame frame = Utils.Decoder.DecodeFrameFromName(fileName); String root = Path.Combine(ConfigCommon.FRAME_DATA_PATH, String.Format("TRECVID2016_{0}", frame.VideoId)); fileName = Path.Combine(root, fileName); //Console.WriteLine(fileName); listPath.Add(fileName); } } if (textSpots == null) { Console.WriteLine("Ko co ket qua"); MessageBox.Show("Không có kết quả!", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { Console.WriteLine("Search xong ne"); } } //ClearAndAddImagesToPanelFrame(listPath); lazypicscrListFrame.startLazyShowing(listPath); }