Answers.Body: <p><strong>The threshold is typically chosen empirically, so there is no exact answer.</strong></p>
  <p>It's dependent on how many corners you wish to select, and how strict you want the detection, which could depend on the use case, the dataset, and the block size of the algorithm. If you’re not sure what to choose for the threshold, I would suggest using a scheme relative to your images to deduce the best threshold, based on what performs best for your use case.</p>
  <p>For example, let the criteria for selection, or scoring function, be <span class="math-container">$R$</span>, which in the Shi-Tomasi case is <span class="math-container">$R = min(\lambda_1, \lambda_2)$</span>. We could choose some value <span class="math-container">$q \in (0,1)$</span>, so that the threshold becomes</p>
  <p><span class="math-container">$t = q\max_p{R}$</span>,</p>
  <p>where the max <span class="math-container">$R$</span> is calculated over all points <span class="math-container">$p$</span>, an approach similar to <a href="https://docs.opencv.org/master/d4/d8c/tutorial_py_shi_tomasi.html" rel="nofollow noreferrer">OpenCV Good Features to Track</a>.</p>
  <p>You could examine the corners detected and adjust <span class="math-container">$q$</span> based on how stringently you wanted to select corners. If you don't want to waste the time manually fine-tuning the threshold, you could check out some automated approaches in the literature, such as <a href="https://ieeexplore.ieee.org/document/6880164" rel="nofollow noreferrer">Automated thresholding for low-complexity corner detection
  </a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-10T00:54:26.987Z
Answers.LastActivityDate: 2020-07-10T00:54:26.987Z
Answers.UserDisplayName: Ren
Body: <p>While implementing the <a href="http://www.ai.mit.edu/courses/6.891/handouts/shi94good.pdf" rel="nofollow noreferrer">Shi-Tomasi corner detection algorithm</a>, I got stuck in deciding a suitable threshold for corner detection.</p>
  <p>In the Shi-Tomasi algorithm, all those points that qualify <span class="math-container">$\min( \lambda_1, \lambda_2) &gt; \text{threshold}$</span> are considered as corner points. (where <span class="math-container">$\lambda_1, \lambda_2$</span> are eigenvalues).</p>
  <p>My question is: what is a suitable criterion to decide that threshold?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-02T08:39:13.167Z
Comments.Text: [If the answer below answers your question, you should upvote and accept it](https://ai.stackexchange.com/help/someone-answers).
Comments.UserDisplayName: nbro
Tags: <computer-vision><hyperparameter-optimization><feature-extraction>
Title: How to choose a suitable threshold value for the Shi-Tomasi corner detection algorithm?
UserDisplayName: Hisan
ThreadText: # How to choose a suitable threshold value for the Shi-Tomasi corner detection algorithm?
  
  (Asked by: username_0 on 2020-06-09)
  
  While implementing the [Shi-Tomasi corner detection algorithm](http://www.ai.mit.edu/courses/6.891/handouts/shi94good.pdf), I got stuck in deciding a suitable threshold for corner detection.
  
  In the Shi-Tomasi algorithm, all those points that qualify $\min( \lambda\_1, \lambda\_2) > \text{threshold}$ are considered as corner points. (where $\lambda\_1, \lambda\_2$ are eigenvalues).
  
  My question is: what is a suitable criterion to decide that threshold?
  
  **Tags:** computer-vision, hyperparameter-optimization, feature-extraction
  > **Comments:**
  > **username_1**: [If the answer below answers your question, you should upvote and accept it](https://ai.stackexchange.com/help/someone-answers).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-07-10. Score: 1
  
  **The threshold is typically chosen empirically, so there is no exact answer.**
  
  It's dependent on how many corners you wish to select, and how strict you want the detection, which could depend on the use case, the dataset, and the block size of the algorithm. If you’re not sure what to choose for the threshold, I would suggest using a scheme relative to your images to deduce the best threshold, based on what performs best for your use case.
  
  For example, let the criteria for selection, or scoring function, be $R$, which in the Shi-Tomasi case is $R = min(\lambda\_1, \lambda\_2)$. We could choose some value $q \in (0,1)$, so that the threshold becomes
  
  $t = q\max\_p{R}$,
  
  where the max $R$ is calculated over all points $p$, an approach similar to [OpenCV Good Features to Track](https://docs.opencv.org/master/d4/d8c/tutorial_py_shi_tomasi.html).
  
  You could examine the corners detected and adjust $q$ based on how stringently you wanted to select corners. If you don't want to waste the time manually fine-tuning the threshold, you could check out some automated approaches in the literature, such as [Automated thresholding for low-complexity corner detection](https://ieeexplore.ieee.org/document/6880164)
  
  
  ---
  
  