Effects of morphological structural elements on morphological image processing in opencv_

Source: Internet
Author: User

Scene

After the pretreatment of Rice, the two-value image is opened and then canny edge detection is done.

python Code:

1 #kernel = cv2.getstructuringelement (cv2. Morph_ellipse, (3,3)) # The nucleus of the ellipse2 3Kernel = Np.ones ((3,3), np.uint8)#white noise removal, morphological open operation, 3x3 linear core4 5opening = Cv2.morphologyex (Thresh, Cv2. Morph_open, kernel, iterations = 2)6 7Cv2.imshow ("opening", opening)8 9  Ten  Oneedges = Cv2. Canny (opening,50,200) A  -Cv2.imshow ("edges", edges)
View Code

The resulting image is as follows:

The left side is a structured element of the ellipse core, the right is a linear core, you can see the left side is significantly less than the right loss, for specific image processing benefits, it is recommended to use structured elements to build the morphological transformation parameters.

Effects of morphological structural elements on morphological image processing in opencv_

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.