After I did a 'imclearborder', there are still a bit of unwanted object around the barcode. How can I remove those objects to isolate the barcode? I have pasted my code for your reference.

rgb = imread('barcode2.jpg'); % Resize Image rgb = imresize(rgb,0.33); figure(),imshow(rgb); % Convert from RGB to Gray Igray = double(rgb2gray(rgb)); % Calculate the Gradients [dIx, dIy] = gradient(Igray); B = abs(dIx) - abs(dIy); % Low-Pass Filtering H = fspecial('gaussian', 20, 10); C = imfilter(B, H); C = imclearborder(C); figure(),imagesc(C);colorbar;
