/// <summary> /// Finds the objects of the image /// </summary> /// <param name="image">The image to look for objects</param> /// <param name="filter">The filter with the minHeight and minWidth</param> private void FindObjectsOfImage(Image image, ColorFilter filter) { ImageAnalyser analyser = new ImageAnalyser(); Graphics g = Graphics.FromImage(picbVideoCapture.Image); List<Rectangle> blocks = analyser.GetSquares(CubeAnalyser.SourceImage, (int)numMinWidth.Value, (int)numMinHeight.Value); FindObjectsOfImage(image, filter, blocks, g, analyser); }
/// <summary> /// Find all objects in image. /// </summary> private void FindObjectsOfAllImages() { if (CubeAnalyser.SourceImage != null) { this.CurrentFace.ClearBlocks(); ImageAnalyser analyser = new ImageAnalyser(); picbVideoCapture.Image = (Image)CubeAnalyser.SourceImage.Clone(); Graphics g = Graphics.FromImage(picbVideoCapture.Image); List<Rectangle> blocks = analyser.GetSquares(CubeAnalyser.SourceImage, (int)numMinWidth.Value, (int)numMinHeight.Value); //Color1 FindObjectsOfImage(picbRedFilter.Image, StoredData.GetFilter(picbRedFilter.Name), blocks, g, analyser); //Color2 FindObjectsOfImage(picbBlueFilter.Image, StoredData.GetFilter(picbBlueFilter.Name), blocks, g, analyser); //Color3 FindObjectsOfImage(picbGreenFilter.Image, StoredData.GetFilter(picbGreenFilter.Name), blocks, g, analyser); //Color4 FindObjectsOfImage(picbYellowFilter.Image, StoredData.GetFilter(picbYellowFilter.Name), blocks, g, analyser); //Color5 FindObjectsOfImage(picbOrangeFilter.Image, StoredData.GetFilter(picbOrangeFilter.Name), blocks, g, analyser); //Color6 FindObjectsOfImage(picbWhiteFilter.Image, StoredData.GetFilter(picbWhiteFilter.Name), blocks, g, analyser); } }