小编use*_*037的帖子

通过图像处理识别纸币

在纸币我想检查条带是破碎还是实线.为此我拍了一张强烈的背景照片.我得到了以下两张照片,一张是真货币,另一张是假币.我在条带存在的位置裁剪图像并进行开合重建,最后计算黑色像素.但结果并不如我所愿.有帮助吗?

这是图像:

在此输入图像描述 在此输入图像描述

%Code for the thine strip
clear all;
close all;
I = imread('IMG_4267.jpg');
imageSize = size(I);
croppedImage = imcrop(I,[300 0 30 570]);
gray=rgb2gray(croppedImage);
se1 = strel('square',2);
I1e = imerode(gray, se1);
I1e = imreconstruct(I1e, gray);
I1b = imdilate(I1e, se1);
I1c = imreconstruct(imcomplement(I1b), imcomplement(I1e));
I1d = imcomplement(I1c);
Edge2=edge(I1d,'canny');
BW1 = im2bw(Edge2);
nBlack = sum(BW1(:));
Run Code Online (Sandbox Code Playgroud)

matlab image-processing image-recognition computer-vision image-segmentation

6
推荐指数
1
解决办法
1万
查看次数

边缘检测和分割

我试图从纸币图像中提取对象.在原始图像上我应用了sobel边缘检测.这是图像:

在此输入图像描述

我的问题是在下面的裁剪图像中,我希望只显示数字100而不显示其他噪音.我该怎么办?

在此输入图像描述

我到目前为止使用的代码是:

close All;
clear All;
Note1 = imread('0001.jpg');
Note2 = imread('0007.jpg');
figure(1), imshow(Note1);
figure(2), imshow(Note2);

Note1=rgb2gray(Note1);
Note2=rgb2gray(Note2);
Edge1=edge(Note1,'sobel');
Edge2=edge(Note2,'sobel');
figure(5), imshow(Edge1),title('Edge sobel1');
figure(6), imshow(Edge2),title('Edge sobel2');

rect_Note1 = [20 425 150 70];
rect_Note2 = [20 425 150 70];
sub_Note1 = imcrop(Edge1,rect_Note1);
sub_Note2 = imcrop(Edge2,rect_Note2);
figure(7), imshow(sub_Note1);
figure(8), imshow(sub_Note2);
Run Code Online (Sandbox Code Playgroud)

为完整起见,原始图像:

matlab image-processing edge-detection image-segmentation

5
推荐指数
1
解决办法
3587
查看次数