CopyPastor

Detecting plagiarism made easy.

Score: 0.8221754431724548; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2016-11-07
by Riyaz Parasara

Original Post

Original - Posted on 2013-05-22
by Stanislav Vitvitskyy



            
Present in both answers; Present only in the new answer; Present only in the old answer;

you have bitmaps you can flip it into video using JCodec
Here's a sample image sequence encoder:
- https://github.com/jcodec/jcodec/blob/master/src/main/java/org/jcodec/api/SequenceEncoder.java
You can modify it for your purposes by replacing BufferedImage with Bitmap.

Use these methods according your need.

public static Picture fromBitmap(Bitmap src) { Picture dst = Picture.create((int)src.getWidth(), (int)src.getHeight(), RGB); fromBitmap(src, dst); return dst; } public static void fromBitmap(Bitmap src, Picture dst) { int[] dstData = dst.getPlaneData(0); int[] packed = new int[src.getWidth() * src.getHeight()]; src.getPixels(packed, 0, src.getWidth(), 0, 0, src.getWidth(), src.getHeight()); for (int i = 0, srcOff = 0, dstOff = 0; i < src.getHeight(); i++) { for (int j = 0; j < src.getWidth(); j++, srcOff++, dstOff += 3) { int rgb = packed[srcOff]; dstData[dstOff] = (rgb >> 16) & 0xff; dstData[dstOff + 1] = (rgb >> 8) & 0xff; dstData[dstOff + 2] = rgb & 0xff; } } } public static Bitmap toBitmap(Picture src) { Bitmap dst = Bitmap.create(pic.getWidth(), pic.getHeight(), ARGB_8888); toBitmap(src, dst); return dst; } public static void toBitmap(Picture src, Bitmap dst) { int[] srcData = src.getPlaneData(0); int[] packed = new int[src.getWidth() * src.getHeight()]; for (int i = 0, dstOff = 0, srcOff = 0; i < src.getHeight(); i++) { for (int j = 0; j < src.getWidth(); j++, dstOff++, srcOff += 3) { packed[dstOff] = (srcData[srcOff] << 16) | (srcData[srcOff + 1] << 8) | srcData[srcOff + 2]; } } dst.setPixels(packed, 0, src.getWidth(), 0, 0, src.getWidth(), src.getHeight()); }
As long as you have bitmaps you can flip it into video using JCodec ( http://jcodec.org ).
Here's a sample image sequence encoder: https://github.com/jcodec/jcodec/blob/master/src/main/java/org/jcodec/api/SequenceEncoder.java . You can modify it for your purposes by replacing BufferedImage with Bitmap.
Use these helper methods:
public static Picture fromBitmap(Bitmap src) { Picture dst = Picture.create((int)src.getWidth(), (int)src.getHeight(), RGB); fromBitmap(src, dst); return dst; }
public static void fromBitmap(Bitmap src, Picture dst) { int[] dstData = dst.getPlaneData(0); int[] packed = new int[src.getWidth() * src.getHeight()];
src.getPixels(packed, 0, src.getWidth(), 0, 0, src.getWidth(), src.getHeight());
for (int i = 0, srcOff = 0, dstOff = 0; i < src.getHeight(); i++) { for (int j = 0; j < src.getWidth(); j++, srcOff++, dstOff += 3) { int rgb = packed[srcOff]; dstData[dstOff] = (rgb >> 16) & 0xff; dstData[dstOff + 1] = (rgb >> 8) & 0xff; dstData[dstOff + 2] = rgb & 0xff; } } }
public static Bitmap toBitmap(Picture src) { Bitmap dst = Bitmap.create(pic.getWidth(), pic.getHeight(), ARGB_8888); toBitmap(src, dst); return dst; }
public static void toBitmap(Picture src, Bitmap dst) { int[] srcData = src.getPlaneData(0); int[] packed = new int[src.getWidth() * src.getHeight()];
for (int i = 0, dstOff = 0, srcOff = 0; i < src.getHeight(); i++) { for (int j = 0; j < src.getWidth(); j++, dstOff++, srcOff += 3) { packed[dstOff] = (srcData[srcOff] << 16) | (srcData[srcOff + 1] << 8) | srcData[srcOff + 2]; } } dst.setPixels(packed, 0, src.getWidth(), 0, 0, src.getWidth(), src.getHeight()); }
You can as well wait for JCodec team to implement full Android support, they are working on it according to this: http://jcodec.org/news/no_deps.html

        
Present in both answers; Present only in the new answer; Present only in the old answer;