We have optimized the MATLAB function imreconstruct of Image Processing Toolbox writing a mex function to reduce the execution time of Vincent's algorithm. Imreconstruct is called by the following functions:imclearborder, imextendedmax, imextendedmin, imfill, imhmax, imhmin, imimposemin.
"Morphological Grayscale Reconstruction in Image Analysis: Applications and Efficient Algorithms", technical report 91-16, Harvard Robotics Laboratory, November 1991, IEEE Transactions on Image Processing, Vol. 2, No. 2, pp. 176-201, April 1993.
Best results were obtained for matrices up to 2048^2 pixels: with a greater number of pixels the execution time of our algorithm converges to MATLAB's one. Tipically our codes run 2-3 times faster than imreconstruct function.
Luigi Rosa (2020). Imreconstruct (https://www.mathworks.com/matlabcentral/fileexchange/4044-imreconstruct), MATLAB Central File Exchange. Retrieved .