मैं एआर ऐप में एक वीडियो कैप्चर फ़ंक्शन जोड़ने की कोशिश कर रहा हूं। मूल रूप से स्क्रीन पर क्या हो रहा है रिकॉर्डिंग, और इसे वीडियो के रूप में सहेजें (उपयोगकर्ता इसे साझा करने की इजाजत देता है)। एआर एपीपी वोफोरिया-यूनिटी एसडीके के साथ लिखा गया है। हमने आईओएस मंच पर सफलतापूर्वक इसे हासिल किया है।एंड्रॉइड प्लेटफार्म में एकता के साथ एआर (वुफोरिया) पर वीडियो कैप्चर
हालांकि, हमें एंड्रॉइड मंच पर एक ही चीज़ करने में बड़ी कठिनाइयां हैं।
कैमरा Vuforia कार्यक्रम द्वारा ocuppied है, मैं वीडियो स्ट्रीम के लिए उपयोग नहीं कर सकते हैं: (हम बाहर डिवाइस पक्ष के साथ इस लक्ष्य को हासिल करने की उम्मीद कर रहे हैं)
निम्नलिखित हमारी प्रगति है।
मैंने प्रत्येक फ्रेम के एक स्क्रैशॉट को कैप्चर करने का प्रयास किया है, और फिर उन्हें कुछ वीडियो आउटपुट में जोड़ दिया है; लेकिन framerate extreamly गरीब (1 एफपीएस से कम) है। स्क्रीन शॉट कैप्चर करने में 700ms लगते हैं।
क्या मैं गलत दिशा से सोच रहा हूं? किसी भी मदद की सराहना की जाएगी! बहुत धन्यवाद!
public void acquireScreenshot() {
DisplayMetrics metrics = new DisplayMetrics();
WindowManager WM = (WindowManager) MainActivity.this.getSystemService(Context.WINDOW_SERVICE);
Display display = WM.getDefaultDisplay();
display.getMetrics(metrics);
int height = metrics.heightPixels; // screen height
int width = metrics.widthPixels; // screen width
int pixelformat = display.getPixelFormat();
PixelFormat localPixelFormat1 = new PixelFormat();
PixelFormat.getPixelFormatInfo(pixelformat, localPixelFormat1);
int deepth = localPixelFormat1.bytesPerPixel;
byte[] arrayOfByte = new byte[height* width* deepth];
long tmp = System.currentTimeMillis();
try {
for(int i = 0 ; i < 10 ; i++){
InputStream localInputStream = readAsRoot();
DataInputStream localDataInputStream = new DataInputStream(
localInputStream);
android.util.Log.e("mytest", "-----read start-------");
localDataInputStream.readFully(arrayOfByte);
android.util.Log.e("mytest", "-----read end-------time = " + (System.currentTimeMillis() -tmp));
localInputStream.close();
File mid = new File("/mnt/sdcard/AAA");
if(!mid.exists()){
mid.mkdir();
}
FileOutputStream out = new FileOutputStream(new File(
"/mnt/sdcard/AAA/"+System.currentTimeMillis()+".png"));
int[] tmpColor = new int[width * height];
int r, g, b;
tmp = System.currentTimeMillis();
android.util.Log.e("mytest", "-----bitmap start-------");
for (int j = 0; j < width * height * deepth; j+=deepth) {
b = arrayOfByte[j]&0xff;
g = arrayOfByte[j+1]&0xff;
r = arrayOfByte[j+2]&0xff;
tmpColor[j/deepth] = (r << 16) | (g << 8) | b |(0xff000000);
}
Bitmap tmpMap = Bitmap.createBitmap(tmpColor, width, height,
Bitmap.Config.ARGB_8888);
android.util.Log.e("mytest", "-----bitmap end-------time = " + (System.currentTimeMillis() -tmp));
tmp = System.currentTimeMillis();
android.util.Log.e("mytest", "-----compress start-------");
tmpMap.compress(Bitmap.CompressFormat.PNG, 100, out);
android.util.Log.e("mytest", "-----compress end-------time = " + (System.currentTimeMillis() -tmp));
out.close();
Thread.sleep(40);
}
} catch (Exception e) {
android.util.Log.e("mytest", "Exception");
e.printStackTrace();
}
}
किसी भी मौके से आपको समाधान मिला :) –
अभी तक नहीं ....... < – user2542563
कोई प्रगति? मैं अब तक कोई भाग्य नहीं कर रहा हूं। – vmachacek