i want to add rows and columns to a binary image
2 次查看(过去 30 天)
显示 更早的评论
Hi, am working on words i want to add rows and columns to a binary image based on threshold values and also add nodes based on center of mass. please help me and i have attached an images for your refernces
5 个评论
Walter Roberson
2017-2-22
I need you to say clearly that you want to overwrite parts of the binary image, or that you want to conceptually break the image up into parts without actually changing the image.
回答(1 个)
Image Analyst
2017-2-21
You can use padarray() to add any number of rows or columns to any side.
5 个评论
Image Analyst
2017-2-22
bw = ones(3, 5)
% Add one row to the top, 2 rows to the bottom,
% 3 columns to the left, and 4 columns to the right
bw2 = padarray(bw, [1, 3]);
bw2(6,12) = 0
And get this:
bw =
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
bw2 =
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 1 1 1 0 0 0 0
0 0 0 1 1 1 1 1 0 0 0 0
0 0 0 1 1 1 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Analytics Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!