Fastest way to find reference point in image

后端 未结 1 601
萌比男神i
萌比男神i 2021-01-24 14:17

i\'m searching for the fastest way to find one or more reference points, (could be +, or a rectangle).

My first idea is, to go from the mid point of the image and look i

1条回答
  •  既然无缘
    2021-01-24 14:30

    I don't know the relative performance of all the aspects of the OpenCV code, but I assume it is pretty good at vector type operations across whole rows of an image rather than scalar operations such as you suggest when you propose doing ever increasing circles radiating from the centre to find the cross. Here is one approach that may work.

    First, squidge (TM) all the pixels together to make a column as tall as the original image but just a single pixel wide. I have coloured this in red in the diagram. The darkest pixel in this column gives you the y-coordinate of your reference points.

    Then, squidge (TM) all the pixels together to make a row as wide as the original image but just a single pixel high. I have coloured this in blue in the diagram. The darkest of the middle black bar then gives you the x-coordinate of your central reference point.

    enter image description here

    This will also handle small rotations as well as translations - and if the rotations are larger, you will get 3 black bars on the right.

    You may also decide that, in general, and to save time, you only need process the image from the 1/3 to the 2/3 point in the vertical direction and the 1/4 to the 3/4 point in the horizontal direction since that is most likely to include the reference points.

    0 讨论(0)
提交回复
热议问题