How can I move a binary image to the center?
1 回表示 (過去 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
.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1017195/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1017195/image.png)
0 件のコメント
回答 (2 件)
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.
0 件のコメント
Image Analyst
2022 年 5 月 31 日
I don't think it should matter if you're doing classification properly. Here's one way:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!