English 中文(简体)
Matlab: Barcode scanner
原标题:Matlab: Barcode scanner

I m试图使条码扫描仪在书目中。 在一条条码中,每条白色条条条有1条,每条黑条有0条。 i m 试图获得这些酒吧。 但问题是:

“entergraph

你可以看到,酒吧不是一帆风顺,一度是三els......然后是两els......。 更糟的是,图像也有所不同。 因此,我的问题是。 如何在不知道1条酒吧的宽度的情况下获得这些酒吧的价值。 或者如何给予他们同样的宽恕。 同一条条条条有两条可相互接通。 不可能发现酒吧之间的过渡,因为可以在一定数量的餐厅之后进行过渡......然后可以有另一个酒吧或同样的酒吧。 但是,由于无法知道这一数量,因此无法发现过渡。 由于酒吧没有标准宽度,也不可能与某种窗口合作。 因此,如何使这一点正常化?

A barcode : enter image description here

页: 1

最佳回答

让我们假定,这些条条条条条条条条条严格是纵向的(如你的例子)。 可能的工作流程:

%# read the file
filename =  CW4li.jpg ;
x = imread(filename);
%# convert to grayscale
x = rgb2gray(x);

%# get only the bars area
xend = find(diff(sum(x,2)),1);
x(xend:end,:) = [];

%# sum intensities along the bars
xsum = sum(x);

%# threshold the image by half of all pixels intensities
th = ( max(xsum)-min(xsum) ) / 2;
xth = xsum > th;

%# find widths
xstart = find(diff(xth)>0);
xstop = find(diff(xth)<0);
if xstart(1) > xstop(1)
    xstart = [1 xstart];
end
if xstart(end) > xstop(end)
    xstop = [xstop numel(xth)];
end

xwidth = xstop-xstart;

%# look at the histogram
hist(xwidth,1:12)

%# it s clear that single bar has 2 pixels (can be automated), so
barwidth = xwidth / 2;

<>>>>>

To get relative bar width we can devide width in pixels to minimum bar width:

barwidth = xwidth ./ min(xwidth);

I believe it s good assumption that there always will be a bar on width 1.

如果你获得打字价值(例如,由于噪音),试图将数字四舍五入到最接近的愤怒中,并找到剩余物。 你可以总结这些残余物,以获得高质量的承认评估。

一些集束算法(如千米组别法)也可能运转良好。

问题回答

暂无回答




相关问题
Using QCView and iSight to capture image

I have a QCView that loads a Quartz file which gives you iSights feedback (basically like a QTCaptureView) Everything displays fine The button simply takes a snapshot using the following simple ...

Taking picture with QTCaptureView

Is it possible to simply take a picture and save it somewhere using a QTCaptureView and Apple s built-in iSight? I ve seen lots of tutorials on recording video but none on simply taking a picture. Any ...

Transform rectangular image into trapezoid

In .NET how can I transform an image into a trapezoid. The Matrix class supports rotation, shear, etc, but I can t see a trapezoidal transformation. I m using the usual System.Drawing.* API, but I m ...

Rotate image through Y-axis on web page

What are my options for rotating an image on a web page through the Y-axis? I m not sure if I even have the terminology right. Is this called a rotate or a transform. Most of the searches that I ve ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

Convert from 32-BPP to 8-BPP Indexed (C#)

I need to take a full color JPG Image and remap it s colors to a Indexed palette. The palette will consist of specific colors populated from a database. I need to map each color of the image to it s "...

热门标签