🌐
OpenCV
docs.opencv.org › 4.13.0 › d9 › d61 › tutorial_py_morphological_ops.html
OpenCV: Morphological Transformations
void morphologyEx(InputArray src, OutputArray dst, int op, InputArray kernel, Point anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar &borderValue=morphologyDefaultBorderValue())
🌐
PyImageSearch
pyimagesearch.com › home › blog › opencv morphological operations
OpenCV Morphological Operations - PyImageSearch
May 9, 2021 - The first required argument of cv2.morphologyEx is the image we want to apply the morphological operation to. The second argument is the actual type of morphological operation — in this case, it’s an opening operation.
🌐
Python Geeks
pythongeeks.org › python geeks › learn opencv › morphological operations in opencv
Morphological Operations in OpenCV - Python Geeks
February 14, 2023 - # Defining the kernel kernel = np.ones((5,5),np.uint8) # Apply the opening morphological operation using cv2.morphologyEx() function img_opening = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel) # Displaying the image after the opening morphological operation cv2.imshow('Opening',img_opening) cv2.waitKey(0) cv2.destroyAllWindows()
🌐
Readthedocs
opencv-laboratory.readthedocs.io › en › latest › nodes › imgproc › morphologyEx.html
morphologyEx — OpenCV Laboratory 1.0 alpha documentation
morphologyEx · Edit on GitHub · Performs advanced morphological transformations. anchor_in – Position of the anchor within the element. borderType_in – Border mode used to extrapolate pixels outside of the image, see cv::BorderTypes · image_in – Source image.
🌐
Shimat
shimat.github.io › opencvsharp_docs › html › ac97c723-12f2-cf13-aec6-8eea9e8b96b9.htm
Cv2.MorphologyEx Method
static member MorphologyEx : src : InputArray * dst : OutputArray * op : MorphTypes * element : InputArray * ?anchor : Nullable<Point> * ?iterations : int * ?borderType : BorderTypes * ?borderValue : Nullable<Scalar> (* Defaults: let _anchor = defaultArg anchor null let _iterations = defaultArg iterations 1 let _borderType = defaultArg borderType BorderTypes.Constant let _borderValue = defaultArg borderValue null *) -> unit
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-opencv-morphological-operations
Python OpenCV - Morphological Operations - GeeksforGeeks
June 12, 2026 - import cv2, numpy as np, matplotlib.pyplot as plt img = cv2.imread(r"Downloads\test (2).png", 0) bin = cv2.threshold(img, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)[1] k = np.ones((3, 3), np.uint8) opened = cv2.morphologyEx(bin, cv2.MORPH_OPEN, k) plt.imshow(opened, cmap='gray'), plt.axis('off'), plt.show()
🌐
EDUCBA
educba.com › home › software development › software development tutorials › programming languages tutorial › opencv morphology
OpenCV Morphology | How to work Morphology function in OpenCV?
April 18, 2023 - OpenCV program in python to demonstrate morphologyEx() function to read the given image using imread() function, perform morphological gradient operation on the given image and display the output on the screen: #importing the required modules import cv2 import numpy as np #reading the image on which opening morphological operation is to be performed using imread() function imageread = cv2.imread('C:/Users/admin/Desktop/images/educba1.jpg') #defining the kernel matrix kernel = np.ones((4,4),np.uint8) #using morphologyEx function by specifying the MORPH_GRADIENT operation on the input image gradientimage = cv2.morphologyEx(imageread, cv2.MORPH_GRADIENT, kernel) #displaying the morphed image as the output on the screen cv2.imshow('Morphed_image', gradientimage) cv2.waitKey(0)
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
Find elsewhere
🌐
WPILib
docs.wpilib.org › en › stable › docs › software › vision-processing › wpilibpi › morphological-operations.html
Morphological Operations — FIRST Robotics Competition documentation
September 1, 2024 - kernel = np.ones((3, 3), np.uint8) binary_img = cv2.morphologyEx(binary_img, cv2.MORPH_OPEN, kernel) Note · In this specific case, it is appropriate to do more iterations of opening in order to get rid of the pixels in the top right. Closing is dilation followed by erosion.
🌐
Python Programming
pythonprogramming.net › morphological-transformation-python-opencv-tutorial
Morphological Transformations OpenCV Python Tutorial
cap = cv2.VideoCapture(1) while(1): _, frame = cap.read() hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) lower_red = np.array([30,150,50]) upper_red = np.array([255,255,180]) mask = cv2.inRange(hsv, lower_red, upper_red) res = cv2.bitwise_and(frame,frame, mask= mask) kernel = np.ones((5,5),np.uint8) opening = cv2.morphologyEx(mask, cv2.MORPH_OPEN, kernel) closing = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, kernel) cv2.imshow('Original',frame) cv2.imshow('Mask',mask) cv2.imshow('Opening',opening) cv2.imshow('Closing',closing) k = cv2.waitKey(5) & 0xFF if k == 27: break cv2.destroyAllWindows() cap.release()
🌐
TutorialsPoint
tutorialspoint.com › opencv › opencv_morphological_operations.htm
OpenCV - Morphological Operations
import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; public class MorphologyExTest { public static void main(String args[]) { // Loading the OpenCV core library System.loadLibrary( Core.NATIVE_LIBRARY_NAME ); // Reading the Image from the file and storing it in to a Matrix object String file ="E:/OpenCV/chap12/morph_input.jpg"; Mat src = Imgcodecs.imread(file); // Creating an empty matrix to store the result Mat dst = new Mat(); // Creating kernel matrix Mat kernel = Mat.ones(5,5, CvType.CV_32F); // Applying Blur effect on the Image Imgproc.morphologyEx(src, dst, Imgproc.MORPH_TOPHAT, kernel); // Writing the image Imgcodecs.imwrite("E:/OpenCV/chap12/morph_tophat.jpg", dst); System.out.println("Image Processed"); } }
🌐
Medium
medium.com › analytics-vidhya › morphological-transformations-of-images-using-opencv-image-processing-part-2-f64b14af2a38
Morphological Transformations of Images using OpenCV | Image Processing Part-2 | by Ravjot Singh | Analytics Vidhya | Medium
November 5, 2020 - Opening is just another name of erosion followed by dilation. It is useful in removing noise, as we explained above. Here we use the function, cv2.morphologyEx().
🌐
Jancy Standard Library
vovkos.github.io › doxyrest-showcase › opencv › sphinx_rtd_theme › page_tutorial_opening_closing_hats.html
More Morphology Transformations — OpenCV Documentation
void Morphology_Operations( int, void* ) { // Since MORPH_X : 2,3,4,5 and 6 int operation = morph_operator + 2; Mat element = getStructuringElement( morph_elem, Size( 2*morph_size + 1, 2*morph_size+1 ), Point( morph_size, morph_size ) ); morphologyEx( src, dst, operation, element ); imshow( window_name, dst ); }
🌐
Medium
mamuncseru.medium.com › a-brief-discussion-on-morphological-operators-using-opencv-ccf6be076896
A brief discussion on Morphological operators using OpenCV | by Md. Abdullah Al Mamun | Medium
January 20, 2023 - white_noise = (np.random.randint(low=0, high=2, size=binary_img.shape) * 255)\ .astype('uint8') binary_with_noise_img = binary_img + white_noise opening_img = cv2.morphologyEx(binary_with_noise_img, cv2.MORPH_OPEN,\ morph_rect) plt.imshow(opening_img)
🌐
OpenCV
docs.opencv.org › 3.4.20 › d3 › dbe › tutorial_opening_closing_hats.html
OpenCV: More Morphology Transformations
} We can observe that the key function to perform the morphology transformations is cv::morphologyEx .
🌐
coseries
coseries.com › morphological-transformations-in-python-using-opencv
Morphological Transformations in Python using OpenCV | coseries
November 22, 2020 - The cv2.morphologyEx() is used to perform compound morphological operations. It takes an image, type of the operation, kernel, anchor position, iterations, borderType, and borderValue.
🌐
DataFlair
data-flair.training › blogs › opencv-morphological-operations
OpenCV Morphological Operations - DataFlair
March 14, 2024 - OpenCV, the bedrock of computer vision libraries, provides a seamless gateway through the `cv2.morphologyEx()` function to execute these operations. In this section, we delve into the heart of Top Hat and Black Hat operations, deconstructing their syntax, parameters, and accompanying code. ... Src: The source image, typically in grayscale or binary form. Op: Specifies the morphological operation to be performed – either cv2.MORPH_TOPHAT for Top Hat or cv2.MORPH_BLACKHAT for Black Hat.
🌐
PyTutorial
pytutorial.com › python-opencv-cv2morphologyex-guide
PyTutorial | Python OpenCV cv2.morphologyEx() Guide
January 16, 2025 - Learn how to use Python OpenCV cv2.morphologyEx() for advanced image processing. Includes examples, code, and explanations for beginners.