![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/505898/image.png)
Extracting multiple numerical values from an image
2 ビュー (過去 30 日間)
古いコメントを表示
Is it possible
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/429963/image.jpeg)
to extract multiple numerical values from the this image?
0 件のコメント
採用された回答
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/505898/image.png)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Language Support についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!