"Python" matches the position in the original image by a screenshot (OPENCV) __python

Source: Internet
Author: User
Installation dependencies
1 Download and install opencv-2.4.9, and copy Cv2.pyd to site-package under the Python installation directory
2 pip install numpy
3) pip install AIRCV
prepare a picture and a screenshot Original Artwork

screenshot

Code

Import cv2
import AIRCV as AC

# print Circle_center_pos
def draw_circle (IMG, POS, Circle_radius, Color, line_ width):
    cv2.circle (IMG, POS, Circle_radius, Color, line_width)
    cv2.imshow (' Objdetect ', imsrc) 
    Cv2.waitkey (0)
    cv2.destroyallwindows ()

if __name__ = = "__main__":
    imsrc = Ac.imread (' bg.jpg ')
    Imobj = Ac.imread (' obj.png ')

    # find the match position
    pos = ac.find_template (IMSRC, imobj)

    Circle_ Center_pos = pos[' result ']
    Circle_radius =
    color = (0, 255, 0)
    line_width = Ten

    # Draw Circle
    D Raw_circle (IMSRC, Circle_center_pos, Circle_radius, color, line_width)
Effect chart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.