Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Right, I've just downloaded a PDF of the book, installed Emgu CV, and followed the same process as you did. Except I succeeded ;-)</p> <p>I think all you missed was that you need to create an empty 32-bit float image to receive the corner strengths before you call <code>cvCornerHarris</code>. Then you pass the <code>Image</code> objects to it.</p> <p>Here are the main parts of my code, which I developed in a Windows Forms application in C# using Visual Studio 2012. First, a few member variables I used to hold the image objects:</p> <pre><code>// original source image as grayscale private Image&lt;Gray, Byte&gt; m_SourceImage = null; // raw corner strength image (must be 32-bit float) private Image&lt;Gray, float&gt; m_CornerImage = null; // inverted thresholded corner strengths (for display) private Image&lt;Gray, Byte&gt; m_ThresholdImage = null; </code></pre> <p>Now, a button click handler to prompt for an image to load from file and display it:</p> <pre><code>private void button1_Click(object sender, EventArgs e) { // prompt for source image OpenFileDialog Openfile = new OpenFileDialog(); if (Openfile.ShowDialog() == DialogResult.OK) { // create and show source image as grayscale m_SourceImage = new Image&lt;Gray, byte&gt;(Openfile.FileName); pictureBox1.Image = m_SourceImage.ToBitmap(); } } </code></pre> <p>Finally, the button click handler for performing the corner detection:</p> <pre><code>private void button2_Click(object sender, EventArgs e) { // create corner strength image and do Harris m_CornerImage = new Image&lt;Gray, float&gt;(m_SourceImage.Size); CvInvoke.cvCornerHarris(m_SourceImage, m_CornerImage, 3, 3, 0.01); // create and show inverted threshold image m_ThresholdImage = new Image&lt;Gray, Byte&gt;(m_SourceImage.Size); CvInvoke.cvThreshold(m_CornerImage, m_ThresholdImage, 0.0001, 255.0, Emgu.CV.CvEnum.THRESH.CV_THRESH_BINARY_INV); pictureBox1.Image = m_ThresholdImage.ToBitmap(); } </code></pre> <p>In the above code, you can see I have followed the example from the book and applied a threshold to the corner image and inverted the result for easier display. You could just show <code>m_CornerImage</code> instead. </p> <p>Here are some screenshots of the result - the loaded image (as grayscale) on the left, and the inverted threshold image showing the corner strengths on the right:</p> <p><img src="https://i.stack.imgur.com/gMcgH.png" alt="harris"></p> <p>Please comment or edit your question if you need any further information or help and I'll do my best.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload