How can I move a binary image to the center?

3 次查看(过去 30 天)
I'm trying to make a character segmentation. I've succesfully extracted the characters but now I need to keep the important bits in the center of the 28x28 image AUTOMATICALLY since it somehow messes up classification. In this instance, this 1 somehow gets read as a 7
.

回答(2 个)

DGM
DGM 2022-5-31
编辑:DGM 2022-5-31
Without knowing how the object images were obtained, it's hard to say how to change the process. You should have the bounding box information for each object. It's then up to you to get that image region and pad it to a fixed geometry. You can use padarray(), but you'll have to calculate individual padding widths.
This is an example using rice grains. A lot of the discussion about masking can be ignored. The relevant part is the padding.

Image Analyst
Image Analyst 2022-5-31

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by