centerobject(bw)

a small function that centers an object with its centroid to the center of the image
ダウンロード: 752
更新 2015/8/19

ライセンスの表示

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)

引用

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

MATLAB リリースの互換性
作成: R2013a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersZernike Polynomials についてさらに検索

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0