Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:49:55+00:00 2026-06-04T15:49:55+00:00

Some details about my problem: I’m trying to realize corner detector in openCV (another

  • 0

Some details about my problem:

I’m trying to realize corner detector in openCV (another algorithm, that are built-in: Canny, Harris, etc).

I’ve got a matrix filled with the response values. The biggest response value is – the biggest probability of corner detected is.

I have a problem, that in neighborhood of a point there are few corners detected (but there is only one). I need to reduce number of false-detected corners.

Exact problem:

I need to walk through the matrix with a kernel, calculate maximum value of every kernel, leave max value, but others values in kernel make equal zero.

Are there build-in openCV functions to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:49:58+00:00Added an answer on June 4, 2026 at 3:49 pm

    This is how I would do it:

    1. Create a kernel, it defines a pixels neighbourhood.
    2. Create a new image by dilating your image using this kernel. This dilated image contains the maximum neighbourhood value for every point.
    3. Do an equality comparison between these two arrays. Wherever they are equal is a valid neighbourhood maximum, and is set to 255 in the comparison array.
    4. Multiply the comparison array, and the original array together (scaling appropriately).
    5. This is your final array, containing only neighbourhood maxima.

    This is illustrated by these zoomed in images:

    9 pixel by 9 pixel original image:

    enter image description here

    After processing with a 5 by 5 pixel kernel, only the local neighbourhood maxima remain (ie. maxima seperated by more than 2 pixels from a pixel with a greater value):

    enter image description here

    There is one caveat. If two nearby maxima have the same value then they will both be present in the final image.

    Here is some Python code that does it, it should be very easy to convert to c++:

    import cv
    
    im = cv.LoadImage('fish2.png',cv.CV_LOAD_IMAGE_GRAYSCALE)
    maxed = cv.CreateImage((im.width, im.height), cv.IPL_DEPTH_8U, 1)
    comp = cv.CreateImage((im.width, im.height), cv.IPL_DEPTH_8U, 1)
    #Create a 5*5 kernel anchored at 2,2
    kernel = cv.CreateStructuringElementEx(5, 5, 2, 2, cv.CV_SHAPE_RECT)
    
    cv.Dilate(im, maxed, element=kernel, iterations=1)
    cv.Cmp(im, maxed, comp, cv.CV_CMP_EQ)
    cv.Mul(im, comp, im, 1/255.0)
    
    cv.ShowImage("local max only", im)
    cv.WaitKey(0)
    

    I didn’t realise until now, but this is what @sansuiso suggested in his/her answer.

    This is possibly better illustrated with this image, before:

    enter image description here

    after processing with a 5 by 5 kernel:

    enter image description here

    solid regions are due to the shared local maxima values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a product built on the Client-Server architecture. Some details about the technology
The documentation lacks some details about ACL . It' simple as invoking createAcl on
I am thinking about some details regarding stringByReplacingOccurrencesOfString:withString: in NSString class According to document.
I currently have a table structure that looks something like this(some details omitted): ColumnName
I have a query that returns data with group category and some details like
Recently, I was investigating into some details about classes in Ruby, and was confused
I encountered a problem when running some old code that was handed down to
I'm trying to write some code that deletes an image off the hard-disk once
Can anybody provide some details on <:< operator in scala. I think: if(apple <:<
I my wordpress blog in home page which shows some details of products.I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.