title: emguCV with C# Cannot implicitly & Argument error
body: <p>I am tying to use emguCV to detect circle on webcam. i don't have any experience in that and this is first time. i am trying to follow this tutorial <a href="https://www.youtube.com/watch?v=vdjoutNR2DQ" rel="nofollow noreferrer">https://www.youtube.com/watch?v=vdjoutNR2DQ</a> but it seem he using different version </p>
  
  <p>-In line 168 Error: Cannot implicitly convert type Emgu.CV.Mat'to 'Emgu.CV.Image'   </p>
  
  <p>-In line 171     Error  Cannot implicitly convert type 'Emgu.CV.Image' to 'Emgu.CV.Image'</p>
  
  <p>-In line 173 Error: The best overloaded method match for 'Emgu.CV.Image.HoughCircles(Emgu.CV.Structure.Bgr, Emgu.CV.Structure.Bgr,double, double, int, int)' has some invalid arguments</p>
  
  <p>-In same line 173 Error :Argument 1 &amp;2: cannot convert from 'Emgu.CV.Structure.Gray' to 'Emgu.CV.Structure.Bgr</p>
  
  <p>these the references I am using from emguCV</p>
  
  <p><img src="https://i.stack.imgur.com/kkX37.jpg" alt="enter image description here"></p>
  
  <p>this is the code </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.
  using Emgu.CV;
  using Emgu.CV.CvEnum;
  using Emgu.CV.Structure;
  using Emgu.CV.UI;
  
  namespace videosearch
  {
  public partial class detect : Form
  {
  
      Capture cp = null;
      bool blac = false;
      Image&lt;Bgr, byte&gt; imageorgnal;
      Image&lt;Bgr, byte&gt; imgproc;
  
      public detect()
      {
          InitializeComponent();
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          if (blac == true)
          {
              Application.Idle -= procframdatGUI;
              blac = false;
              button1.Text = "Resume";
          }
          else
          {
              Application.Idle += procframdatGUI;
              button1.Text = "pause";
              blac = true;
          }
      }
  
      private void detect_Load(object sender, EventArgs e)
      {
          try
          {
              cp = new Capture(Emgu.CV.CvEnum.CaptureType.DShow);
          }
          catch (NullReferenceException ex)
          {
              MessageBox.Show(ex.Message);
              return;
          }
          Application.Idle += procframdatGUI;
          blac = true;
      }
      private void detect_Close(object sender, FormClosedEventArgs e)
      {
          if (cp!=null)
          {
              cp.Dispose();
          }
      }
      void procframdatGUI(object sender, EventArgs e)
      {
  
          imageorgnal = cp.QueryFrame();//line 168 Error: Cannot implicitly convert type Emgu.CV.Mat'to 'Emgu.CV.Image&lt;Emgu.CV.Structure.Bgr,byte&gt;'   
  
          if (imageorgnal == null)
              return;
          imgproc = imageorgnal.InRange(new Bgr(0, 0, 175), new Bgr(100, 100, 256));// line 171    Error  Cannot implicitly convert type 'Emgu.CV.Image&lt;Emgu.CV.Structure.Gray,byte&gt;' to 'Emgu.CV.Image&lt;Emgu.CV.Structure.Bgr,byte&gt;'
          imgproc = imgproc.SmoothGaussian(9);
          CircleF[] cir = imgproc.HoughCircles(new Gray(100), new Gray(50), 2, imgproc.Height / 4, 10, 400); //In line 173 Error: The best overloaded method match for 'Emgu.CV.Image&lt;Emgu.CV.Structure.Bgr,byte&gt;.HoughCircles(Emgu.CV.Structure.Bgr, Emgu.CV.Structure.Bgr,double, double, int, int)' has some invalid arguments
  // in same line Error   :Argument 1 &amp;2: cannot convert from 'Emgu.CV.Structure.Gray' to 'Emgu.CV.Structure.Bgr'
  
          foreach (CircleF ci in cir)
          {
              if (textBox1.Text!="")
              {
                  textBox1.AppendText(Environment.NewLine);
  
              }
  
              textBox1.AppendText("ball position x=" + ci.Center.X.ToString().PadLeft(4) + "\n Y= " + ci.Center.Y.ToString().PadLeft(4)+ "\n ridius"+ci.Radius.ToString("###.000").PadLeft(7));
              textBox1.ScrollToCaret();
              CvInvoke.Circle(imgproc, new Point((int)ci.Center.X, (int)ci.Center.Y), 3, new MCvScalar(0, 255, 0), -1, 0, 0);
              imageorgnal.Draw(ci, new Bgr(Color.Red), 3);
  
  
          }
          imageBox1.Image = imageorgnal;
          imageBox2.Image = imgproc;
      }
  
  }
  }
  </code></pre>