android - Capturing Preview Frame in Portrait -
Is there a way to get the preview frame directly into the image on the project frame? I have tried:
camera.SetDisplayOrmentation (90); But it only seems to work for the display. Doctor's report:
Set the clockwise rotation of the preview display in the degree This preview affects the image displayed after the frame and snapshot. This method is useful for portrait mode applications . Before the previewframe (byte [], the camera) does not affect the sequence of byte arrays given. JPEG pictures, or recorded videos. This method is not allowed to call during preview. I type the API level> = 8, and I have a Portrait Lock app. I want to manually avoid the byte array of data passing as a frame. Many thanks in advance.
Try it out This will work
public Void takeSnapPhoto () { Camera.setOneShotPreviewCallback (new camera previewcrollback) {Public record at the prevProame (byte [], camera camera) {camera parameter parameter = camera.getParameters (int); int format = parameters.getPreviewFormat (); //UUV formats Requires more conversion if (format == ImageFormat.NV21 || format == ImageFormat.YUY2 || format == ImageFormat.NV16) {int w = parameters.getPreviewSize (). Width; int h = parameter Change the UV Image UVage UUV_Ijays = New User Image (Data, Format, W, H, Blank); // UV to JPEG Rink Read = New Root (0, 0, W, H); ByteArrayOutputStream output_stream = new byteArrayOutputStream () ; Yuv_image.compressToJpeg (rect, 100, output_stream); Byte [] byt = output_stream.toByteArray (); FileOutputStream outstream = null; Try {// Write in the SD card file
Comments
Post a Comment