久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android中的視頻處理

Video processing in Android(Android中的視頻處理)
本文介紹了Android中的視頻處理的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在使用帶有 Eclipse 的 Android 2.2.

I'm using Android 2.2 with Eclipse.

我想制作一個捕獲視頻的應用程序,并且對于每一幀,將其作為位圖發送到處理它的方法并返回一個新位圖并顯示處理后的位圖.

I would like to make an application that captures video, and for each frame, its send it as a bitmap to a method that processes it and returns a new bitmap and shows the processed bitmap.

我對 Android 不是很熟悉,所以請誰能給我發一份我需要查看的資源來做這樣的事情?

I am not very familiar with Android, so please, can anyone send me to the resources I need to look at to do such a thing?

推薦答案

使用Android SDK完成以下步驟很簡單:

It is simple enough to accomplish the following steps using the Android SDK:

  • 將相機中的預覽幀捕獲為位圖數據.Camera.PreviewCallback 將返回一個 byte[] 數據,以多種可能的圖像格式表示幀.
  • 修改像素數據.由于數據以原始字節的形式返回,因此對數據進行調整相對容易......這里的困難在于為您想要執行的特定圖像處理應用算法.沒有任何內置效果(4.0 之前)可以簡單地應用于圖像,因此您必須自己編寫.
  • 還可以將數據解碼為 Bitmap 對象,以便更輕松地處理像素.在 2.2 中,您可以選擇使用 NDK 和 jnigraphics 在本機代碼中處理位圖的像素,這比 Java 層要快得多.
  • 獲取生成的 Bitmap 的內容并顯示它.對于快速移動的數據,您可能希望在 SurfaceView 上顯示它;使用視圖包含的 SurfaceHolder 提供的 lockCanvas()unlockCanvasAndPost() 方法.
  • Capture the preview frames from the camera as bitmapped data. Camera.PreviewCallback will return a byte[] of data representing the frame in a number of possible image formats.
  • Modify the pixel data. Since the data comes back as raw bytes, making adjustments to the data is relatively easy...the difficulty here is applying an algorithm for the particular image processing you want to do. There aren't any built-in effects (pre-4.0) that can be applied simply to images so you will have to write your own.
  • It is also possible to decode the data into a Bitmap object to make working with the pixels easier. In 2.2, you have the option of using the NDK and jnigraphics to work with a Bitmap's pixels in native code, which is significantly faster than at the Java layer.
  • Take the contents of your resultant Bitmap and display it. For fast moving data, you would want to display this on a SurfaceView; using the lockCanvas() and unlockCanvasAndPost() methods available from the SurfaceHolder that view contains.

如果這就是您想做的全部,您可以輕松完成.但是,這與捕獲視頻不同.Android 目前不提供掛鉤讓您將幀實時流式傳輸到編碼的視頻容器(MPEG4、3GP 等)中.它的視頻捕獲功能被緊緊地包裹在 MediaRecorder 中,它控制著從幀捕獲到編寫編碼視頻的整個過程.您將需要一個第三部分庫,例如 FFMPEG(已在 Android 應用程序中多次使用 NDK 層構建和運行)來協助修改幀的編碼過程.

If this is all you are wanting to do, you could accomplish this with little difficulty. However, this is not the same as capturing video. Android does not currently provide hooks for you to stream frames out into an encoded video container (MPEG4, 3GP, etc.) in real-time. It's video capture capabilities are wrapped up tightly into the MediaRecorder which controls the process from frame capture all the way to writing the encoded video. You would need a 3rd part library such as FFMPEG (which has been built and run using the NDK layer a number of times in Android applications) to assist in the encoding process of your modified frames.

我知道您的目標是 2.2,但 Android 4.0 確實在這方面提供了一些緩解,因為他們發布了新版本的 NDK,它允許人們在從流中讀取圖像數據然后將其交給之前有更多發言權表示層.但是,我沒有花足夠的時間來了解它是否適??合您的情況.

I know you have a 2.2 target, but Android 4.0 does provide some relief here as they have released a new version of the NDK which allows one to have more say in what happens when reading image data from a stream before handing it to the presentation layer. However, I have not spent enough time with it to know whether it could be recommended for your situation.

這篇關于Android中的視頻處理的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Why does the android emulator camera stop unexpectedly?(為什么android模擬器相機會意外停止?)
Android camera , onPictureTaken(byte[] imgData, Camera camera) method amp; PictureCallback never called(Android camera , onPictureTaken(byte[] imgData, Camera camera) 方法 amp;PictureCallback 從未調用過) - IT屋-程序員軟件開發技
Understanding the libGDX Projection Matrix(了解 libGDX 投影矩陣)
QR code reading with camera - Android(使用相機讀取二維碼 - Android)
IP camera with OpenCv in Java(Java中帶有OpenCv的IP攝像頭)
Android mock Camera(Android 模擬相機)
主站蜘蛛池模板: 国产精品无码久久久久 | 狠狠操狠狠 | 人人做人人澡人人爽欧美 | 伊人网在线看 | 精品国产成人 | 欧美日韩在线综合 | 国产中文字幕亚洲 | 欧美日韩国产一区二区三区 | 欧美黄色一区 | 欧美aaaaa| 天天躁日日躁aaaa视频 | 日本a级大片 | 天天弄| 久久99精品久久久久久噜噜 | 国产一级精品毛片 | 最新日韩在线视频 | 激情五月婷婷在线 | 日批av| 免费亚洲一区二区 | 欧美精选一区二区 | 欧美乱淫视频 | 欧美国产日韩精品 | 久草视频观看 | 91九色在线观看 | 欧日韩不卡在线视频 | 日本欧美视频 | 99re国产精品 | 亚洲一区精品在线 | 中文字幕91 | 国产美女自拍视频 | 亚洲国产一区二区视频 | 99久久精品国产麻豆演员表 | 香蕉一区 | av天天干| 国产日韩欧美在线 | 91亚洲国产成人久久精品网站 | 男女激情网| 日韩一二区在线 | 一级大片网站 | 欧美 日韩 国产 一区 | 国产精品v |