public FetchSample(Tld tld, Bitmap mapsource, AForge.Controls.VideoSourcePlayer vsPlayer) { pri_tld = tld; pri_bmp = mapsource; pri_player = vsPlayer; InitializeComponent(); // 设置双缓存绘图的属性 this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); }
public Form1() { InitializeComponent(); pri_tld = new Tld(); double elapse = 0; DateTime dt; #region 显示Hog示意图 //HogGram hogGram; //NormBlockVectorGram blockGram; //pri_bmp = AForge.Imaging.Image.FromFile("Image\\peop.jpg"); //pri_bmp = ImgOper.ResizeImage(pri_bmp, 486, 500); //pri_bmp = ImgOper.Grayscale(pri_bmp); //dt = DateTime.Now; //hogGram = HogGram.GetHogFromBitmap(pri_bmp, CELL_SIZE.Width, CELL_SIZE.Height, PART_NUMBER); //blockGram = new NormBlockVectorGram(hogGram, BLOCK_SIZE.Width, BLOCK_SIZE.Height); //elapse = DateTime.Now.Subtract(dt).TotalMilliseconds; //pri_bmp = ImgOper.DrawHogGram(hogGram, 486 * 2, 500 * 2); //this.Refresh(); #endregion //// 训练样本 //HogTrain(POS_DIR, NEG_DIR); //dt = DateTime.Now; //// Hog检测 //pri_bmp = AForge.Imaging.Image.FromFile(BMPFILE); //pri_bmp = ImgOper.ResizeImage(pri_bmp, pri_bmp.Width, pri_bmp.Height); //pri_obj_regions = pri_tld.HogDetect(pri_bmp); //elapse = DateTime.Now.Subtract(dt).TotalMilliseconds; //dt = DateTime.Now; //// 效果没有明显的提升,有待进一步检验 //Rectangle r = pri_tld.MostAssociateObject(pri_obj_regions, pri_bmp); //pri_obj_regions = new RectangleCollection(); //pri_obj_regions.Add(r); //elapse = DateTime.Now.Subtract(dt).TotalMilliseconds; }