Finding black borders in image

5 ビュー (過去 30 日間)
Alexander Bächi
Alexander Bächi 2022 年 3 月 21 日
回答済み: yanqi liu 2022 年 3 月 22 日
Hello community
I'm on a project on with I need to determine the beginning and the end of the top black border. I want this to tell the OCR from wich position the ROI begins.
From left to right I can see the black border in the plot of the sum of the bw image. But how can I "cut-off" the black part? Or at least determine how many pixels it has in height?
After the determination or crop, I'll set the ROI from 0 (or given offset) to a fixed value (size of the banner) to reduce the false information for the OCR.
Thanks in advance.

回答 (1 件)

yanqi liu
yanqi liu 2022 年 3 月 22 日
yes,sir,may be upload your image file,let's use the follow method
bw2 = ~imclearborder(~bw);
[r,c] = find(bw2);
bw2 = bw(min(r):max(r),min(c):max(c));
figure; imshow(bw2);

カテゴリ

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