MATLAB Answers


barcode detection....i wanted to draw a red box around a barcode image...showing that the barcode is detected from the image...

i wanted to draw a red box around a barcode image... showing that the barcode is detected from the image... my image is a barcode image itself... (means barcode is not a portion of my image..the full image is barcode itself...



No products are associated with this question.

1 Answer

Answer by michael scheinfeild on 17 Oct 2012
 Accepted answer

hold on use line command you have option of color


Irgb = imread('15wmqe9.jpg');
Irgb = imread('av672a.jpg');
Iresize = imresize(Irgb,0.33);
Igray = double(rgb2gray(Iresize));
[dIx dIy] = gradient(Igray);
B = imabsdiff(abs(dIx),abs(dIy));
H = fspecial('gaussian', 20, 10);
C = imfilter(B, H);
Th = max(C(:));
D = C < Th-10;
stat = regionprops(~D,'Area','BoundingBox');
for i = 1 : numel(stat), 
    Iarea(i) = stat(i).Area;
[C I] = max(Iarea);
bb = stat(I).BoundingBox;
imshow(Iresize); hold on

Now my error code is:

??? Index exceeds matrix dimensions.
Error in ==> Untitled6 at 20 
bb = stat(I).BoundingBox;

Can u rectify the above error for me?

What's the URL where you uploaded 15wmqe9.jpg?????

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!