Extracting multiple numerical values from an image

조회 수: 1 (최근 30일)
Mohsin Shah
Mohsin Shah 2020년 11월 26일
댓글: Mohsin Shah 2021년 2월 4일
Is it possible
to extract multiple numerical values from the this image?

채택된 답변

yanqi liu
yanqi liu 2021년 2월 1일
clc; clear all; close all;
img = imread('demo.jpg');
J = rgb2hsv(img);
s = mat2gray(J(:,:,2));
bw = im2bw(s, 0.2);
bw = imclose(bw, strel('line', 5, 0));
bw = bwareaopen(bw, 6);
stats = regionprops(bw);
figure;
imshow(img);
for i = 1 : length(stats)
rect = stats(i).BoundingBox;
hold on; rectangle('Position', rect, 'EdgeColor', 'm', 'LineWidth', 1);
if rect(3) > 20
rectangle('Position', rect, 'EdgeColor', 'r', 'LineWidth', 1);
imi = imcrop(img, round(rect));
imi2 = imresize(imi, 3, 'bilinear');
txt = ocr(imi2);
text(rect(1), rect(2)-rect(4)/2, txt.Words{1}, 'Color', 'g', 'FontSize', 16)
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Support에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by