04-15-2009 11:19 AM
Hi,
I am looking for a solution how to decode 2D datamatrix code from JPEG/BMP picture in Labwindows/CVI.
The picture will be taken by a non NI product and save it into JPEG/BMP format. I would like to decoded the datamatrix code from this picture by using my own application was written in CVI.
Thx,
04-17-2009 08:03 AM - edited 04-17-2009 08:04 AM
This is Matyas Suveg from National Instruments.
I am not sure I fully understood your question, so forgive me, if I give you unadequate answer.
First of all, I need to know wether you have NI-Imaq installed on your computer. If you have, than you can decode image formats like PNG, JPEG, JPEG2000, TIFF, AIPD, and BMP. Use for example the following function to get spatial information about your image:
int imaqGetFileInfo (const char *File_Name,
CalibrationUnit *Calibration_Unit,
float
*Calibration_X,
float *Calibration_Y, int
*Width,
int *Height, ImageType
*Image_Type);
If you need further file processing, then you have to creat NI Vision images from your JPEG/BMP with the following function:
int imaqReadFile (Image *Image, const char
*File_Name,
RGBValue *Color_Table, int
*Num_Colors);
Creates an NI Vision image from the information in a file. The file can be in one of the following formats: PNG, JPEG, JPEG2000, TIFF, AIPD, or BMP.
Image Types Supported
IMAQ_IMAGE_U8, IMAQ_IMAGE_U16, IMAQ_IMAGE_I16,
IMAQ_IMAGE_SGL, IMAQ_IMAGE_COMPLEX, IMAQ_IMAGE_RGB, IMAQ_IMAGE_HSL,
IMAQ_IMAGE_RGB_U64
If you don't have NI-Imaq, then I suggest you save your images in BMP, because it's extremely simple. You will get a 2D datamatrix where the cells will represent dedicated pixels coded with a predefined depth (usually 8 bits), so the coding is linear. JPEG is more complex, because it defines blocks of pixels within the image and codes it depending on content, so you need to know JPEG standard in depth in order to decode the image.
I hope I could help you! If it doesn't answer your question, please, explain a little bit deeper what you're up to!
Best regards,
Matyas
05-06-2009 09:42 AM
Hi Matyas,
I am looking for a similar solution for CVI like http://zone.ni.com/devzone/cda/tut/p/id/3932.
The input of the application is a picture file and the output is a "data read".
Regards,
Raybie
05-07-2009 03:10 AM
CVI can load an image file (jpeg, bitmap, wmf...) into memory using the standard library function GetBitmapFromFile(). You can then extract information from it (including the pixels themselves, if you want) with GetBitmapData(). I suggest you check out the CVI help on these functions - they may form a basis for what you are trying to do.
JR