hey i just tried decoding a QR code and it worked fine as well. you just need to import /zxing/qrcode.QRcode and then create it instanse like i did with MultiFormatReader. I also tried decoding a datamatrix image using its class DataMatrixReader but its not working. but i am happy up till now.
On 10/8/09, wahib haq <wahib.t...@gmail.com> wrote: > hi abhishek !! I am a newbie and my first initiative is also building > a simple barcode decoding module. I dont have a android phone so i > have to go on a different path to do this barcode app thing. :S > > can you plz guide me what to be on right side of BufferedImage myImage = ... > ?? > I am using this code .... > > I have imported these ... > > import android.graphics.Bitmap; > > import android.graphics.BitmapFactory; > import android.widget.TextView; > import com.google.zxing.MonochromeBitmapSource; > import com.google.zxing.MultiFormatReader; > import com.google.zxing.Reader; > import com.google.zxing.ReaderException; > import com.google.zxing.client.androidtest.*; > import com.google.zxing.common.BaseMonochromeBitmapSource; > > Bitmap bitmap = > BitmapFactory.decodeResource(getResources(),R.drawable.bar5); > > Bitmap bitmap1 = > BitmapFactory.decodeFile("file://sdcard/DCIM/Camera/2009-10-04 > 21.31.02.jpg"); > > > > MultiFormatReader reader1=new MultiFormatReader();//For all > barcode formats > > > try > { > > result=reader1.decode(new RGBMonochromeBitmapSource(bitmap)); > tv.setText(result.getText()); > } > catch (Exception e) > { > tv.setText("Error occured !!"); > } > } > > ////// > > I have tried it with reading bmp and jpeg image from pasting in > res/drawable folder and it works fine with 1D barcode. Its not working > with 2D and i dont know how to do it though multiformat i guess means > it shud support 2D as well. Well this will solve ur problem. I also > tried to read it with a sdcard image coz after all it has to fetch > from the image taken by camera. but i dont have a camera and unable to > push image in gallery after lots of tries so it still undone. > Share anything else you cum to know abt barcode decoding task. > > Regards, > wahib > > > On 10/6/09, Abhishek <abhishek.moh...@gmail.com> wrote: >> >> Hello All, >> >> I am writing an application to scan a bar code. >> As a small module of it I am trying to decode the bar code form the >> image file stored as resource. (R.raw.bc02) where bc02.jpg is my bar >> code image file. >> >> I am using http://code.google.com/p/zxing/wiki/DeveloperNotes to write >> a program for decoding. >> I am stuck up at following step: i.e. reading the image as >> bufferedImage >> >> BufferedImage myImage = ...; >> MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource >> (myImage); >> >> I have written following code to read the image which works fine >> InputStream is= this.getApplicationContext().getResources >> ().openRawResource(R.raw.bc02); >> The run time object is of class "android.content.res.AssetManager >> $AssetInputStream" >> >> Can any help me in reading the file and decoding? Please let me know >> if I am doing correct or not. >> >> >> Thank you, >> Abhishek >> >> >> >> > > > -- > Wahib-ul-haq > > Communications Engineering Student, > NUST, Pakistan. > www.sizzlotech.com > -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan. www.sizzlotech.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---