This image correspond to a specimen deformed in the vertical direction. Would you have any suggestion to lift deformed pixels and make a "perfecly horizontal block"

1 次查看(过去 30 天)
NOTE: A mask can be easily created. Thank you.

采纳的回答

Image Analyst
Image Analyst 2016-12-20
Just go along your mask finding the top line, then use circshift or imtranslate or simple indexing to lift the line.
[rows, columns] = size(mask);
for col = 1 : columns
thisColumn = grayImage(:, col);
topLine = find(mask(:, col), 1, 'first');
thisColumn = [thisColumn(topLine:end), zeros(topLine-1, 1)];
grayImage(:, col) = thisColumn;
end

更多回答(1 个)

Santi
Santi 2016-12-21
编辑:Santi 2016-12-21
Thank you for this great approach; worked and very easy to understand.
Best regards

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by