Automatic curve extraction from image

17 ビュー (過去 30 日間)
rastak rastaki
rastak rastaki 2023 年 2 月 12 日
コメント済み: rastak rastaki 2023 年 2 月 12 日
Hi everybody.
I have a series of images like this:
How can I remove background of this image automatically and extract the curves which is shown in the following image?
The output image must be binary. simple thresholding doesn't work.

回答 (1 件)

Image Analyst
Image Analyst 2023 年 2 月 12 日
I'd threshold the image to get a mask, then scan across column by column getting the first row and last row. Something like
mask = grayImage > someThreshold;
[rows, columns] = size(mask);
topRows = nan(1, columns);
bottomrows = nan(1, columns);
for col = 1 : columns
t = find(mask(:, col), 1, 'first');
if ~isempty(t)
topRows(col) = 1;
bottomRows(col) = find(mask(:, col), 1, 'last');
end
end
hold on;
plot(topRows, 'w-', 'LineWidth', 5);
plot(bottomRows, 'n-', 'LineWidth', 5);
adapt as needed.
If you really can't figure it out, then attach your original image (not a screenshot with tickmarks, etc.).
  1 件のコメント
rastak rastaki
rastak rastaki 2023 年 2 月 12 日
hi dear image analyst.
first of all thanks for your fast response. I applied your code to my image and the result is like this:
The result strongly depends on the threshold value. I used 0.2 of max value. As you can see, because of noisey-like pattern between up and buttom curvs, the result is not as good.
Thanks any way.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by