centerobject(bw)

a small function that centers an object with its centroid to the center of the image
752 download
Aggiornato 19 ago 2015

Visualizza la licenza

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)

Cita come

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

Compatibilità della release di MATLAB
Creato con R2013a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Zernike Polynomials in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0