hi,
     I am creating an app to send onPreviewframe image byte array
continuously to server, but only on image is transfer to server. I am
stuck here please tell me what i have to do for this situation.

//////here is my  android onpreviewframe code///

public void onPreviewFrame(byte[] data, Camera camera) {


                Camera.Parameters parameters = camera.getParameters();
                int format = parameters.getPreviewFormat();

                 //YUV formats require more conversion
                if (format == ImageFormat.NV21 /*|| format ==
ImageFormat.YUY2 || format == ImageFormat.NV16*/)
                {
                int w = parameters.getPreviewSize().width;
                int h = parameters.getPreviewSize().height;
                // Get the YuV image
                YuvImage yuv_image = new YuvImage(data, format, w, h,
null);
                // Convert YuV to Jpeg
                        Rect rect = new Rect(0, 0, w, h);
                        ByteArrayOutputStream output_stream = new
ByteArrayOutputStream();
                        yuv_image.compressToJpeg(rect, 100, output_stream);
                        byte[] byt=output_stream.toByteArray();
                        try {
                              obj.writeObject(byt);
                                  obj.flush();
                                  obj.close();

                            } catch (FileNotFoundException e) { //
<10>
                                e.printStackTrace();
                             } catch (IOException e) {
                                e.printStackTrace();
                             } finally {
                             }

                             Preview.this.invalidate();
                    }


Thanks and Regards

umer

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to