stright line in one column or raw
1 次查看(过去 30 天)
显示 更早的评论
could any one help me ?
if i have a line as figure shown with pexils which does not exixt in one line (raw or column ) how can i make this line completely stright ? what code i hav to write ?
0 个评论
采纳的回答
Image Analyst
2015-3-14
Just get the coordinates
[rows, columns] = find(grayImage < 128);
Then find the max and min:
row1 = min(rows);
row2 = max(rows);
% Find average column
meanColumn = int32(mean(columns));
Then draw the line
grayImage(row1:row2, meanColumn) = 0;
4 个评论
Image Analyst
2015-3-15
What "cells"? Do you mean pixels? And what does "delete" mean to you, keeping in mind that an image must remain rectangular. Do you just want to replace them (not delete them) with white pixels? Then why not just draw the line on a completely new white image
whiteImage = 255 * ones(rows, columns, 'uint8');
whiteImage(row1:row2, meanColumn) = 0;
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!