Hello,
I'm am currently testing your Mobile Imaging SDK to try reading various 2D Barcodes on Windows Mobile devices using the .NET API (QR and DataMatrix types).
While the provided sample (and one I created myself) just works fine on clear code-generated barcodes pictures, I do not manage to do so with lower quality ones (took from a built-in windows mobile camera for instance). I read some hints on how to try to enhance the barcode detection process by playing with intensity, contrast and level colors but with no luck (can't find the topic back, but it was about playing with AutoColorLevelCommand and DynamicBinaryCommand). Even by updating of a low quality picture with a paint program and producing an image which I think should be clear enough to be read does not seem to produce a readable barcode.
Still, by crawling your web sites, docs and forums, I think that your SDK should be able to handle a wide range of pictures, should they be crystal clear or not. So I think I missed something when testing it because I was expecting your SDK to handle the whole "image correction process" by itself. Here is the relevant code I suspect from not being properly written in my project. Consider that this is embedded in a Form, with a m_CurFileName private member correctly pointing to a QR picture file and searchFlags set to BarcodeSearchTypeFlags.QrCode. Am I missing something or doing anything wrong?
BarcodeColor bColor = new BarcodeColor();
bColor.BarColor = Color.Black;
bColor.SpaceColor = Color.White;
RasterCodecs codecs = new RasterCodecs();
try {
IRasterImage rImg = codecs.Load(m_CurFileName, 0, CodecsLoadByteOrder.Rgb, 1);
int dim = 3;
int contrast = 127;
DynamicBinaryCommand dbc = new DynamicBinaryCommand(dim, contrast);
dbc.Run(rImg);
BarcodeEngine engine = new BarcodeEngine();
BarcodeData[] bData = engine.Read(
rImg,
new Rectangle(0, 0, rImg.Width, rImg.Height),
searchFlags,
BarcodeUnit.ScanlinesPerPixels,
BarcodeReadFlags.None | BarcodeReadFlags.BlockSearch,
0,
null,
null,
bColor
);
// just read the first one for now
if (bData != null && bData.Length > 0) {
if (bData[0].Data != null) {
m_Res.Text = Encoding.Default.GetString(bData[0].Data, 0, bData[0].Data.Length);
}
}
}
catch (Exception ex) {
ShowException(ex); // custom exception handling, basically a MessageBox.ShowMessage
}
I may attach the whole project with picture samples if you require them. My tests fail both on the Device Emulator and various Windows Mobile devices (from Windows Mobile 5.0 to 6.1, using .NET CF 2.0 or 3.5) for low or not so sharp pictures but work on code generated ones (with clean perfect pretty lines and square dots).
Any help or guidance would be welcome :)
-- Bastien
(PS : French native speaker, sorry for any mistakes I could have made)