I have the following MATLAB code to localize and read barcodes in pictures (JPG,PNG): ## MATLAB CODE ##
%% Read picture
I = imread("4.png");
%% Gray Version
Igray = rgb2gray(I);
%% Localisation Sobel-Technique
[~,threshold] = edge(Igray,'sobel');
fudgeFactor = 0.5;
%Binary image
BWs = edge(Igray,'sobel',threshold * fudgeFactor);
%imshow(BWs)
title('Binary Gradient Mask')
se90 = strel('line',3,90);
se0 = strel('line',3,0);
% cleaned Binary image
BWsdil = imdilate(BWs,[se90 se0]);
%imshow(BWsdil)
title('Dilated Gradient Mask')
% Filled with holes
BWdfill = imfill(BWsdil,'holes');
%imshow(BWdfill)
title('Binary Image with Filled Holes')
% BW image
BWnobord = imclearborder(BWdfill,4);%%% High contrast balck/white area. %%%
imshow(BWnobord), title('BW, Image')
rms = bwareaopen(BWnobord,50);
figure(2), imshow(rms, []), title('Last Update');
This code gives me this result: [https://i.stack.imgur.com/e5ckj.jpg][1]
%% Now the problem is how can I Traite the barcode and eliminate other areas. %% The answer I need is: 130760000102 ("barcodes") %% i don't know how to complete the code.