title: Very Simple Edge Detection
body: <p>I have a simple, high-contrast, black &amp; white video image on which I need to find the X value of a vertical edge and the Y value of a horizontal edge. I also need to know the direction of the edges (white->black or black->white).</p>
  
  <p>There will be:</p>
  
  <ol>
  <li>Zero or one horizontal edge</li>
  <li>Zero or one vertical edge.</li>
  <li>The edges are perfectly straight.</li>
  <li>The edges will be defined by a sharp(ish) transition from black to white or white to black.</li>
  </ol>
  
  <p>I've been reading about edge detection algorithms and understanding very little of it, but what I do understand is that they are all far more complex than my requirements. They are all designed to produce an image of simple edges from a complex image. My requirements (my images) are much simpler, I only need the X and a Y value of zero to two edges.</p>
  
  <p>If I plot say one row of pixels on a graph (X=pixel index, Y=pixel intensity), I will get something like a line, a rising slope, and another line. The center point of the slope would be what I need. But the lines are not perfect. They are noisy and there can be small bumps or dips, or it can be (mostly) flat if no edge is visible.</p>
  
  <p>So is there a simple algorithm to smooth that plot and produce both the direction and the center point of "the slope"?</p>
  
  <p><a href="https://i.stack.imgur.com/htNcl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/htNcl.png" alt="Sample Image"></a></p>