Example #1
0
        private List <string> SearchByColor(Dictionary <string, string> pctIndexingData, string query)
        {
            List <string>  listFrameName      = new List <string>();
            List <Dot_Lab> listDotsDrawed_Lab = new List <Dot_Lab>();

            // query : 238_101-140_255_251^^^41_99-140_255_251^^^141_98-236_28_36
            string[] values = query.Split(new string[] { "^^^" }, StringSplitOptions.None);
            foreach (var value in values)
            {
                string[] _values = value.Split('_');
                Dot_Lab  dot     = new Dot_Lab(new Point(int.Parse(_values[0]), int.Parse(_values[1])), 17.5f,
                                               new Rgb()
                {
                    R = int.Parse(_values[2]), G = int.Parse(_values[3]), B = int.Parse(_values[4])
                }.To <Lab>());
                listDotsDrawed_Lab.Add(dot);
            }

            List <String> result = PCTSearching.SearchingV3_Lab(pctIndexingData, listDotsDrawed_Lab, new Size(316, 204));

            return(result == null || result.Count == 0 ? null : result);
        }
Example #2
0
        private void btnSearchByImage_Click(object sender, EventArgs e)
        {
            List <Dot_RGB> listDotsDrawed_RGB = null;
            List <Dot_Lab> listDotsDrawed_Lab = null;

            if (ConfigPCT.COLOR_SPACE_USING == ConfigPCT.ColorSpace.RGB)
            {
                listDotsDrawed_RGB = putColorAndSketchV2.GetListDotsDrawed_RGB(); //*
            }
            else if (ConfigPCT.COLOR_SPACE_USING == ConfigPCT.ColorSpace.Lab)
            {
                listDotsDrawed_Lab = putColorAndSketchV2.GetListDotsDrawed_Lab();
            }

            // Save list line-drawing to file
            //Bitmap bitmapListLineDrawingDrawed = putColorAndSketchV2.GetBitmapListLineDrawingDrawed();
            //FileManager.GetInstance().SaveBitmapToPNG(bitmapListLineDrawingDrawed, "D:/phuc.png");
            //MessageBox.Show("PNG Image was saved!");

            List <String> result = null;

            if (ConfigPCT.COLOR_SPACE_USING == ConfigPCT.ColorSpace.RGB)
            {
                //result = null;
                result = PCTSearching.SearchingV3_RGB(this.pctIndexingData, listDotsDrawed_RGB, putColorAndSketchV2.GetPaperDrawingWidthHeight()); //*
            }
            else if (ConfigPCT.COLOR_SPACE_USING == ConfigPCT.ColorSpace.Lab)
            {
                result = PCTSearching.SearchingV3_Lab(this.pctIndexingData, listDotsDrawed_Lab, putColorAndSketchV2.GetPaperDrawingWidthHeight());
            }


            if (result == null || result.Count == 0)
            {
                MessageBox.Show("Không có kết quả!", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            result = result.Take(NUMBER_OF_MAX_RESULT_FRAMES).ToList();

            List <string> listPath = new List <string>();

            //string[] listScaledVideoId = File.ReadAllLines(ConfigEvaluation.scaledvideo_textSpotting);
            foreach (string item in result)
            {
                string fileName = item + ".jpg";
                Frame  frame    = Utils.Decoder.DecodeFrameFromName(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);

                //Console.WriteLine(fileName);
                listPath.Add(fileName);
            }


            //ClearAndAddImagesToPanelFrame(listPath);
            lazypicscrListFrame.startLazyShowing(listPath);
        }