title: Getting the coordinates from a point from an image
body: <p>I am creating a program that can print out the x- &amp; y- Coordinates from a certain pixel. There is a function like 'GetPixel', this will however get the RGB codes from a given coordinate. What I want is just the vice versa, so I have already the RGB codes and now I'm doing a threshold through my Image to know whether it contains a Color pixel that I desired or not.</p>
  
  <p>This is my code:</p>
  
  <p>So firstly I will upload an image:</p>
  
  <pre><code>    public BitmapImage bitmap;
  
      public void hochladen_Click(object sender, EventArgs e)
      {
          // Create OpenFileDialog 
          Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
  
          // Set filter for file extension and default file extension 
          dlg.DefaultExt = ".bmp";
          dlg.Filter = "BMP Files (*.bmp)|*.bmp";
  
          // Get the selected file name and display in a TextBox 
          if (dlg.ShowDialog() == true)
         { 
              // Open document 
              string filename = dlg.FileName;
              bitmap = new BitmapImage();
              bitmap.BeginInit();
              bitmap.UriSource = new Uri(filename);
              bitmap.EndInit();
              image.Source = bitmap;
          }
      }
  </code></pre>
  
  <p>Then when I click a button in my application, it should do a threshold from my Image, and I am going to detect a red Point (R = 255, G = B = 0)</p>
  
  <pre><code>    public Color c;
  
      private void detektieren_Click(object sender, RoutedEventArgs e)
      {
          double x = bitmap.Width;
          double y = bitmap.Height;
          bl.Content = x + "x" + y;
  </code></pre>
  
  <p>So from this Point on, it shouldn't be difficult to find the coordinate:</p>
  
  <pre><code>        for (int i = 0; i &lt; x; i++)
          {
              for (int j = 0; i &lt; j; j++)
              {
                  if (c.R == 255 &amp;&amp; c.G == 0 &amp;&amp; c.B == 0)
                  {
                      //
                  }
              }
          }
      }
  </code></pre>
  
  <p>Anyone has idea? Thanks in advance.</p>