centerobject(bw)

a small function that centers an object with its centroid to the center of the image
757 Descargas
Actualizado 19 ago 2015

Ver licencia

For a lot of shape descriptors (e.g. Fourier descriptors, Zernike Moments etc.) in image feature generation it is necessary to have the objected centered to the image center. Meaning that the center of mass of the object lies in the middle of the image.
Because i couldn't find any similar function to center objects in images i wrote this little function for myself. With this submission i hope i can save some of your working time to figure out a similar script.
The function does extend the image in case that the translation needed to put the object to the image center does not fit withhin the image boundarys.
CM = CENTERMASK(BW) needs and MxN logical image as input with only one object present and returns and RxR logical image with the object centered to the middle of the image.
Due to numerical reasons there can be a shift of maximum +- 0.5.
The function is tested with the MPEG-7 Dataset and worked for all images perfectly. The above image is one of the results.
Look at the centerobject_example file to see how the function works and what it needs as input etc.
If you have any suggestions or questions, feel free to write a comment.
(I wrote this function with Matlab 8.1 (R2013a) but i am pretty sure it will work with older releases)

Citar como

Frederik Kratzert (2025). centerobject(bw) (https://www.mathworks.com/matlabcentral/fileexchange/52560-centerobject-bw), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2013a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Zernike Polynomials en Help Center y MATLAB Answers.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0