国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Android OpenGLES + Camera1 相機(jī)預(yù)覽(2)

這篇具有很好參考價(jià)值的文章主要介紹了Android OpenGLES + Camera1 相機(jī)預(yù)覽(2)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

private void checkRenderThreadState() {
if (mGLThread != null) {
throw new IllegalStateException(
“setRenderer has already been called for this instance.”);
}
}

也就是說(shuō),設(shè)置了Renderer后,就不能更換了,那么如果有需求:本來(lái)是渲染一個(gè)灰度濾鏡的,當(dāng)想變換其他濾鏡的時(shí)候,又不能重新設(shè)置Renderer,此時(shí)應(yīng)該如何

其實(shí)可以這樣,Renderer可以只做一個(gè)調(diào)度者,Renderer里面可以寫(xiě)很多的濾鏡,也可以變換濾鏡,那么就可以滿(mǎn)足我們的需求

那么接下來(lái)就先來(lái)定義一個(gè)基礎(chǔ)濾鏡

首先第一步,創(chuàng)建一個(gè)IRender

public interface IRender {
/**

  • 創(chuàng)建
    */
    void onCreate();

/**

  • 設(shè)置尺寸
    */
    void onChange(int width, int height);

/**

  • 繪制
    */
    void onDraw(int textureId);

/**

  • 釋放資源
    */
    void onRelease();
    }

Renderer有些許不同,修改和增加了一些方法

新建BaseRender,實(shí)現(xiàn)IRender接口

public class BaseRender implements IRender {
/**

  • Context
    */
    private Context context;

/**

  • 渲染數(shù)據(jù)
    */
    private BaseRenderBean renderBean;

/**

  • 頂點(diǎn)坐標(biāo)
    */
    private FloatBuffer vertexBuffer;

/**

  • 紋理坐標(biāo)
    */
    private FloatBuffer coordinateBuffer;

/**

  • 頂點(diǎn)坐標(biāo)維數(shù)(即x, y, z)
    */
    private int vertexSize = 2;

/**

  • 紋理坐標(biāo)維數(shù)(即x, y, z)
    */
    private int coordinateSize = 2;

/**

  • 頂點(diǎn)坐標(biāo)步長(zhǎng)(即維數(shù) * 字節(jié)數(shù))
    */
    private int vertexStride = vertexSize * 4;

/**

  • 紋理坐標(biāo)步長(zhǎng)(即維數(shù) * 字節(jié)數(shù))
    */
    private int coordinateStride = coordinateSize * 4;

/**

  • 頂點(diǎn)個(gè)數(shù)
    */
    private int vertexCount = 4;

/**

  • 紋理點(diǎn)個(gè)數(shù)
    */
    private int coordinateCount = 4;

/**

  • vertex shader
    */
    private int vertexShader;

/**

  • frag shader
    */
    private int fragShader;

/**

  • program
    */
    private int program;

/**

  • 紋理 id
    */
    private int textureId;

/**

  • fbo紋理id
    */
    private int fboTextureId;

/**

  • fbo id
    */
    private int fboId;

/**

  • vbo id
    */
    private int vboId;

/**

  • 頂點(diǎn)著色器代碼路徑
    */
    private String vertexFilename;

/**

  • 片元著色器代碼路徑
    */
    private String fragFilename;

/**

  • 尺寸
    */
    private int width;
    private int height;

/**

  • 是否綁定Fbo
    */
    private boolean isBindFbo = false;

/**

  • 著色器頂點(diǎn)坐標(biāo)位置
    */
    private int aPosLocation;

/**

  • 著色器紋理坐標(biāo)位置
    */
    private int aCoordinateLocation;

/**

  • 著色器紋理位置
    */
    private int uSamplerLocation;

/**

  • 是否執(zhí)行了onCreate
    */
    private boolean isCreate = false;

/**

  • 是否執(zhí)行了onChange
    */
    private boolean isChange = false;

public BaseRender(Context context) {
this(context, “render/base/base/vertex.frag”, “render/base/base/frag.frag”);
}

public BaseRender(Context context, String vertexFilename, String fragFilename) {
this.context = context;
this.vertexFilename = vertexFilename;
this.fragFilename = fragFilename;
}

@Override
public void onCreate() {
if (isCreate) {
return;
}
onCreatePre();
onClearColor();
onInitBlend();
onInitVertexBuffer();
onInitCoordinateBuffer();
onInitVbo();
onInitProgram();
onCreateAfter();
isCreate = true;
}

@Override
public void onChange(int width, int height) {
if (isChange) {
return;
}
onChangePre();
setWidth(width);
setHeight(height);
onViewport();
onInitFbo();
onChangeAfter();
isChange = true;
}

@Override
public void onDraw(int textureId) {
if (!onReadyToDraw()) {
return;
}
onDrawPre();
onClear();
onUseProgram();
onInitLocation();
onBindFbo();
onBindVbo();
onActiveTexture(textureId);
onEnableVertexAttributeArray();
onSetVertexData();
onSetCoordinateData();
onSetOtherData();
onDraw();
onDisableVertexAttributeArray();
onUnBind();
onDrawAfter();
}

@Override
public void onRelease() {
onDeleteProgram(program);
onDeleteShader(vertexShader);
onDeleteShader(fragShader);
onDeleteTexture(textureId);
onDeleteTexture(fboTextureId);
onDeleteFbo(fboId);
onDeleteVbo(vboId);
}

/**

  • 創(chuàng)建之前
    */
    public void onCreatePre() {

}

/**

  • 設(shè)置背景顏色
    */
    public void onClearColor() {
    GLES20.glClearColor(0, 0, 0, 1);
    }

/**

  • 是否啟用混色
    */
    public boolean onEnableBlend() {
    return false;
    }

/**

  • 初始化混色
    */
    private void onInitBlend() {
    if (!onEnableBlend()) {
    return;
    }
    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    }

/**

  • 初始化頂點(diǎn)坐標(biāo)
    */
    public void onInitVertexBuffer() {
    vertexBuffer = OpenGLESUtils.getSquareVertexBuffer();
    }

/**

  • 初始化紋理坐標(biāo)
    */
    public void onInitCoordinateBuffer() {
    if (isBindFbo) {
    coordinateBuffer = OpenGLESUtils.getSquareCoordinateReverseBuffer();
    } else {
    coordinateBuffer = OpenGLESUtils.getSquareCoordinateBuffer();
    }
    }

/**

  • 初始化Vbo
    */
    public void onInitVbo() {
    vboId = OpenGLESUtils.getVbo(vertexBuffer, coordinateBuffer);
    }

/**

  • 初始化Program
    */
    public void onInitProgram() {
    String vertexShaderCode = OpenGLESUtils.getShaderCode(context, vertexFilename);
    String fragShaderCode = OpenGLESUtils.getShaderCode(context, fragFilename);

vertexShader = OpenGLESUtils.loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
fragShader = OpenGLESUtils.loadShader(GLES20.GL_FRAGMENT_SHADER, fragShaderCode);

program = OpenGLESUtils.linkProgram(vertexShader, fragShader);
}

/**

  • 創(chuàng)建之后
    */
    public void onCreateAfter() {

}

/**

  • 設(shè)置尺寸之前
    */
    public void onChangePre() {

}

/**

  • 設(shè)置窗口尺寸
    */
    public void onViewport() {
    GLES20.glViewport(0, 0, width, height);
    }

/**

  • 初始化Fbo
    */
    public void onInitFbo() {
    if (!isBindFbo) {
    return;
    }
    int[] fboData = OpenGLESUtils.getFbo(width, height);
    fboId = fboData[0];
    fboTextureId = fboData[1];
    }

/**

  • 設(shè)置尺寸之后
    */
    public void onChangeAfter() {

}

/**

  • 繪制之前的準(zhǔn)備
    */
    public boolean onReadyToDraw() {
    return true;
    }

/**

  • 繪制之前
    */
    public void onDrawPre() {

}

/**

  • 清屏
    */
    public void onClear() {
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
    }

/**

  • 使用Program
    */
    public void onUseProgram() {
    GLES20.glUseProgram(program);
    }

/**

  • 初始化著色器各個(gè)位置
    */
    public void onInitLocation() {
    aPosLocation = GLES20.glGetAttribLocation(program, “aPos”);
    aCoordinateLocation = GLES20.glGetAttribLocation(program, “aCoordinate”);
    uSamplerLocation = GLES20.glGetUniformLocation(program, “uSampler”);
    }

/**

  • 綁定Fbo
    */
    public void onBindFbo() {
    if (!isBindFbo) {
    return;
    }
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboId);
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
    GLES20.GL_TEXTURE_2D, fboTextureId, 0);
    GLES20.glViewport(0, 0, width, height);
    }

/**

  • 綁定Vbo
    */
    public void onBindVbo() {
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vboId);
    }

/**

  • 激活并綁定紋理
    */
    public void onActiveTexture(int textureId) {
    this.textureId = textureId;
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
    GLES20.glUniform1i(uSamplerLocation, 0);
    }

/**

  • 啟用頂點(diǎn)坐標(biāo)
    */
    public void onEnableVertexAttributeArray() {
    GLES20.glEnableVertexAttribArray(aPosLocation);
    GLES20.glEnableVertexAttribArray(aCoordinateLocation);
    }

/**

  • 設(shè)置頂點(diǎn)坐標(biāo)
    */
    public void onSetVertexData() {
    GLES20.glVertexAttribPointer(aPosLocation, vertexSize, GLES20.GL_FLOAT, false, vertexStride, 0);
    }

/**

  • 設(shè)置紋理坐標(biāo)
    */
    public void onSetCoordinateData() {
    GLES20.glVertexAttribPointer(aCoordinateLocation, coordinateSize, GLES20.GL_FLOAT, false, coordinateStride, vertexBuffer.limit() * 4);
    }

/**

  • 設(shè)置其他數(shù)據(jù)
    */
    public void onSetOtherData() {

}

/**

  • 繪制
    */
    public void onDraw() {
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, vertexCount);
    }

/**

  • 禁用頂點(diǎn)坐標(biāo)
    */
    public void onDisableVertexAttributeArray() {
    GLES20.glDisableVertexAttribArray(aPosLocation);
    GLES20.glDisableVertexAttribArray(aCoordinateLocation);
    }

/**

  • 解除綁定
    */
    public void onUnBind() {
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
    }

/**

  • 繪制之后
    */
    public void onDrawAfter() {

}

/**

  • 刪除Program
    */
    public void onDeleteProgram(int program) {
    GLES20.glDeleteProgram(program);
    }

/**

  • 刪除Shader
    */
    public void onDeleteShader(int shader) {
    GLES20.glDeleteShader(shader);
    }

/**

  • 刪除紋理
    */
    public void onDeleteTexture(int textureId) {
    GLES20.glDeleteTextures(1, new int[]{textureId}, 0);
    }

/**

  • 刪除Fbo
    */
    public void onDeleteFbo(int fboId) {
    GLES20.glDeleteFramebuffers(1, new int[]{fboId}, 0);
    }

/**

  • 刪除Vbo
    */
    public void onDeleteVbo(int vboId) {
    GLES20.glDeleteBuffers(1, new int[]{vboId}, 0);
    }

public Context getContext() {
return context;
}

public void setContext(Context context) {
this.context = context;
}

public FloatBuffer getVertexBuffer() {
return vertexBuffer;
}

public void setVertexBuffer(FloatBuffer vertexBuffer) {
this.vertexBuffer = vertexBuffer;
}

public FloatBuffer getCoordinateBuffer() {
return coordinateBuffer;
}

public void setCoordinateBuffer(FloatBuffer coordinateBuffer) {
this.coordinateBuffer = coordinateBuffer;
}

public int getVertexSize() {
return vertexSize;
}

public void setVertexSize(int vertexSize) {
this.vertexSize = vertexSize;
}

public int getCoordinateSize() {
return coordinateSize;
}

public void setCoordinateSize(int coordinateSize) {
this.coordinateSize = coordinateSize;
}

public int getVertexStride() {
return vertexStride;
}

public void setVertexStride(int vertexStride) {
this.vertexStride = vertexStride;
}

public int getCoordinateStride() {
return coordinateStride;
}

public void setCoordinateStride(int coordinateStride) {
this.coordinateStride = coordinateStride;
}

public int getVertexCount() {
return vertexCount;
}

public void setVertexCount(int vertexCount) {
this.vertexCount = vertexCount;
}

public int getCoordinateCount() {
return coordinateCount;
}

public void setCoordinateCount(int coordinateCount) {
this.coordinateCount = coordinateCount;
}

public int getProgram() {
return program;
}

public void setProgram(int program) {
this.program = program;
}

public int getFboTextureId() {
return fboTextureId;
}

public void setFboTextureId(int fboTextureId) {
this.fboTextureId = fboTextureId;
}

public int getFboId() {
return fboId;
}

public void setFboId(int fboId) {
this.fboId = fboId;
}

public int getVboId() {
return vboId;
}

public void setVboId(int vboId) {
this.vboId = vboId;
}

public String getVertexFilename() {
return vertexFilename;
}

public void setVertexFilename(String vertexFilename) {
this.vertexFilename = vertexFilename;
}

public String getFragFilename() {
return fragFilename;
}

public void setFragFilename(String fragFilename) {
this.fragFilename = fragFilename;
}

public int getWidth() {
return width;
}

public void setWidth(int width) {
this.width = width;
}

public int getHeight() {
return height;
}

public void setHeight(int height) {
this.height = height;
}

public boolean isBindFbo() {
return isBindFbo;
}

public void setBindFbo(boolean bindFbo) {
isBindFbo = bindFbo;
}

public int getPosLocation() {
return aPosLocation;
}

public void setPosLocation(int aPosLocation) {
this.aPosLocation = aPosLocation;
}

public int getCoordinateLocation() {
return aCoordinateLocation;
}

public void setCoordinateLocation(int aCoordinateLocation) {
this.aCoordinateLocation = aCoordinateLocation;
}

public int getSamplerLocation() {
return uSamplerLocation;
}

public void setSamplerLocation(int uSamplerLocation) {
this.uSamplerLocation = uSamplerLocation;
}

public boolean isCreate() {
return isCreate;
}

public void setCreate(boolean create) {
isCreate = create;
}

public boolean isChange() {
return isChange;
}

public void setChange(boolean change) {
isChange = change;
}

public BaseRenderBean getRenderBean() {
return renderBean;
}

public void setRenderBean(BaseRenderBean renderBean) {
this.renderBean = renderBean;
}

public void updateRenderBean(BaseRenderBean renderBean) {
setRenderBean(renderBean);
}
}

代碼有點(diǎn)長(zhǎng),但是里面盡可能地考慮到了渲染和擴(kuò)展的需求

頂點(diǎn)著色器 vertex.frag

attribute vec4 aPos;
attribute vec2 aCoordinate;
varying vec2 vCoordinate;
void main(){
vCoordinate = aCoordinate;
gl_Position = aPos;
}

片元著色器 frag.frag

precision mediump float;
uniform sampler2D uSampler;
varying vec2 vCoordinate;
void main(){
gl_FragColor = texture2D(uSampler, vCoordinate);
}

注意到,里面有用到一個(gè)工具類(lèi)OpenGLESUtils和實(shí)體類(lèi)BaseRenderBean具體就不貼出來(lái)了,可以到Github上查看

四、BaseOesRender

注意到,BaseRender里面綁定的紋理是2D紋理,而如果想實(shí)現(xiàn)相機(jī)預(yù)覽,則需要使用Oes紋理,所以需要?jiǎng)?chuàng)建一個(gè)BaseOesRender為相機(jī)做渲染

package com.yk.media.opengles.render.base;

import android.content.Context;
import android.graphics.SurfaceTexture;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;

import com.yk.media.utils.OpenGLESUtils;

public class BaseOesRender extends BaseRender {
/**

  • oes紋理id
    */
    private int oesTextureId;

/**

  • 頂點(diǎn)變換矩陣位置
    */
    private int uMatrixLocation;

/**

  • 紋理變換矩陣位置
    */
    private int uOesMatrixLocation;

/**

  • oes尺寸
    */
    private int oesW = -1;
    private int oesH = -1;

/**

  • 頂點(diǎn)變換矩陣
    */
    private float[] mMVPMatrix = new float[16];

/**

  • 紋理變換矩陣
    */
    private float[] mOesMatrix = {
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    0, 0, 0, 1
    };

/**

  • 是否準(zhǔn)備好繪制
    */
    private boolean isReadyToDraw = false;

/**

  • SurfaceTexture
    */
    private SurfaceTexture surfaceTexture;

/**

  • SurfaceTexture回調(diào)
    */
    private OnSurfaceTextureListener onSurfaceTextureListener;

public BaseOesRender(Context context) {
super(context, “render/base/oes/vertex.frag”, “render/base/oes/frag.frag”);
setBindFbo(true);
oesTextureId = OpenGLESUtils.getOesTexture();
}

@Override
public void onInitCoordinateBuffer() {
setCoordinateBuffer(OpenGLESUtils.getSquareCoordinateBuffer());
}

@Override
public boolean onReadyToDraw() {
if (!isReadyToDraw) {
if (onSurfaceTextureListener != null) {
if (surfaceTexture != null) {
surfaceTexture.release();
surfaceTexture = null;
}
surfaceTexture = new SurfaceTexture(oesTextureId);
onSurfaceTextureListener.onSurfaceTexture(surfaceTexture);
isReadyToDraw = true;
} else if (surfaceTexture != null) {
surfaceTexture.attachToGLContext(oesTextureId);
isReadyToDraw = true;
} else {
return false;
}
}
return oesW != -1 && oesH != -1;
}

@Override
public void onDrawPre() {
super.onDrawPre();
mMVPMatrix = OpenGLESUtils.getMatrix(getWidth(), getHeight(), oesW, oesH);

surfaceTexture.updateTexImage();

float[] oesMatrix = new float[16];
surfaceTexture.getTransformMatrix(oesMatrix);
if (!OpenGLESUtils.isIdentityM(oesMatrix)) {
mOesMatrix = oesMatrix;
}
}

@Override
public void onInitLocation() {
super.onInitLocation();
uMatrixLocation = GLES20.glGetUniformLocation(getProgram(), “uMatrix”);
uOesMatrixLocation = GLES20.glGetUniformLocation(getProgram(), “uOesMatrix”);
}

@Override
public void onActiveTexture(int textureId) {
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureId);
GLES20.glUniform1i(getSamplerLocation(), 0);
}

@Override
public void onSetOtherData() {
super.onSetOtherData();
GLES20.glUniformMatrix4fv(uMatrixLocation, 1, false, mMVPMatrix, 0);
GLES20.glUniformMatrix4fv(uOesMatrixLocation, 1, false, mOesMatrix, 0);
}

@Override
public void onRelease() {
super.onRelease();
onDeleteTexture(oesTextureId);
}

/**

  • 繪制
    */
    public void onDrawSelf() {
    super.onDraw(oesTextureId);
    }

/**

  • 設(shè)置oes尺寸
    */
    public void setOesSize(int width, int height) {
    oesW = width;
    oesH = height;
    }

/**

  • 設(shè)置SurfaceTexture
    */
    public void setSurfaceTexture(SurfaceTexture surfaceTexture) {
    this.surfaceTexture = surfaceTexture;
    isReadyToDraw = false;
    }

/**

  • 設(shè)置SurfaceTexture回調(diào)
    自我介紹一下,小編13年上海交大畢業(yè),曾經(jīng)在小公司待過(guò),也去過(guò)華為、OPPO等大廠(chǎng),18年進(jìn)入阿里一直到現(xiàn)在。

深知大多數(shù)初中級(jí)Android工程師,想要提升技能,往往是自己摸索成長(zhǎng)或者是報(bào)班學(xué)習(xí),但對(duì)于培訓(xùn)機(jī)構(gòu)動(dòng)則近萬(wàn)的學(xué)費(fèi),著實(shí)壓力不小。自己不成體系的自學(xué)效果低效又漫長(zhǎng),而且極易碰到天花板技術(shù)停滯不前!

因此收集整理了一份《2024年Android移動(dòng)開(kāi)發(fā)全套學(xué)習(xí)資料》,初衷也很簡(jiǎn)單,就是希望能夠幫助到想自學(xué)提升又不知道該從何學(xué)起的朋友,同時(shí)減輕大家的負(fù)擔(dān)。

Android OpenGLES + Camera1 相機(jī)預(yù)覽(2),程序員,android,數(shù)碼相機(jī)

Android OpenGLES + Camera1 相機(jī)預(yù)覽(2),程序員,android,數(shù)碼相機(jī)

Android OpenGLES + Camera1 相機(jī)預(yù)覽(2),程序員,android,數(shù)碼相機(jī)

Android OpenGLES + Camera1 相機(jī)預(yù)覽(2),程序員,android,數(shù)碼相機(jī)

Android OpenGLES + Camera1 相機(jī)預(yù)覽(2),程序員,android,數(shù)碼相機(jī)

既有適合小白學(xué)習(xí)的零基礎(chǔ)資料,也有適合3年以上經(jīng)驗(yàn)的小伙伴深入學(xué)習(xí)提升的進(jìn)階課程,基本涵蓋了95%以上Android開(kāi)發(fā)知識(shí)點(diǎn),真正體系化!

由于文件比較大,這里只是將部分目錄截圖出來(lái),每個(gè)節(jié)點(diǎn)里面都包含大廠(chǎng)面經(jīng)、學(xué)習(xí)筆記、源碼講義、實(shí)戰(zhàn)項(xiàng)目、講解視頻,并且會(huì)持續(xù)更新!

如果你覺(jué)得這些內(nèi)容對(duì)你有幫助,可以?huà)叽a獲?。。。▊渥ⅲ篈ndroid)

Android OpenGLES + Camera1 相機(jī)預(yù)覽(2),程序員,android,數(shù)碼相機(jī)

最后

對(duì)于程序員來(lái)說(shuō),要學(xué)習(xí)的知識(shí)內(nèi)容、技術(shù)有太多太多,要想不被環(huán)境淘汰就只有不斷提升自己,從來(lái)都是我們?nèi)ミm應(yīng)環(huán)境,而不是環(huán)境來(lái)適應(yīng)我們!

最后,我再重復(fù)一次,如果你想成為一個(gè)優(yōu)秀的 Android 開(kāi)發(fā)人員,請(qǐng)集中精力,對(duì)基礎(chǔ)和重要的事情做深度研究

對(duì)于很多初中級(jí)Android工程師而言,想要提升技能,往往是自己摸索成長(zhǎng),不成體系的學(xué)習(xí)效果低效漫長(zhǎng)且無(wú)助。整理的這些架構(gòu)技術(shù)希望對(duì)Android開(kāi)發(fā)的朋友們有所參考以及少走彎路,本文的重點(diǎn)是你有沒(méi)有收獲與成長(zhǎng),其余的都不重要,希望讀者們能謹(jǐn)記這一點(diǎn)。

為了大家能夠順利進(jìn)階中高級(jí)、架構(gòu)師,我特地為大家準(zhǔn)備了一套高手學(xué)習(xí)的源碼和框架視頻等精品Android架構(gòu)師教程,保證你學(xué)了以后保證薪資上升一個(gè)臺(tái)階。

以下是今天給大家分享的一些獨(dú)家干貨:

Android OpenGLES + Camera1 相機(jī)預(yù)覽(2),程序員,android,數(shù)碼相機(jī)

《互聯(lián)網(wǎng)大廠(chǎng)面試真題解析、進(jìn)階開(kāi)發(fā)核心學(xué)習(xí)筆記、全套講解視頻、實(shí)戰(zhàn)項(xiàng)目源碼講義》點(diǎn)擊傳送門(mén)即可獲??!文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-858149.html

[外鏈圖片轉(zhuǎn)存中…(img-y1L4m8WK-1713087540265)]

[外鏈圖片轉(zhuǎn)存中…(img-VNAZQs1M-1713087540265)]

[外鏈圖片轉(zhuǎn)存中…(img-0UNrd0xk-1713087540266)]

既有適合小白學(xué)習(xí)的零基礎(chǔ)資料,也有適合3年以上經(jīng)驗(yàn)的小伙伴深入學(xué)習(xí)提升的進(jìn)階課程,基本涵蓋了95%以上Android開(kāi)發(fā)知識(shí)點(diǎn),真正體系化!

由于文件比較大,這里只是將部分目錄截圖出來(lái),每個(gè)節(jié)點(diǎn)里面都包含大廠(chǎng)面經(jīng)、學(xué)習(xí)筆記、源碼講義、實(shí)戰(zhàn)項(xiàng)目、講解視頻,并且會(huì)持續(xù)更新!

如果你覺(jué)得這些內(nèi)容對(duì)你有幫助,可以?huà)叽a獲?。。。▊渥ⅲ篈ndroid)

Android OpenGLES + Camera1 相機(jī)預(yù)覽(2),程序員,android,數(shù)碼相機(jī)

最后

對(duì)于程序員來(lái)說(shuō),要學(xué)習(xí)的知識(shí)內(nèi)容、技術(shù)有太多太多,要想不被環(huán)境淘汰就只有不斷提升自己,從來(lái)都是我們?nèi)ミm應(yīng)環(huán)境,而不是環(huán)境來(lái)適應(yīng)我們!

最后,我再重復(fù)一次,如果你想成為一個(gè)優(yōu)秀的 Android 開(kāi)發(fā)人員,請(qǐng)集中精力,對(duì)基礎(chǔ)和重要的事情做深度研究

對(duì)于很多初中級(jí)Android工程師而言,想要提升技能,往往是自己摸索成長(zhǎng),不成體系的學(xué)習(xí)效果低效漫長(zhǎng)且無(wú)助。整理的這些架構(gòu)技術(shù)希望對(duì)Android開(kāi)發(fā)的朋友們有所參考以及少走彎路,本文的重點(diǎn)是你有沒(méi)有收獲與成長(zhǎng),其余的都不重要,希望讀者們能謹(jǐn)記這一點(diǎn)。

為了大家能夠順利進(jìn)階中高級(jí)、架構(gòu)師,我特地為大家準(zhǔn)備了一套高手學(xué)習(xí)的源碼和框架視頻等精品Android架構(gòu)師教程,保證你學(xué)了以后保證薪資上升一個(gè)臺(tái)階。

以下是今天給大家分享的一些獨(dú)家干貨:

[外鏈圖片轉(zhuǎn)存中…(img-raEGnOu0-1713087540266)]

《互聯(lián)網(wǎng)大廠(chǎng)面試真題解析、進(jìn)階開(kāi)發(fā)核心學(xué)習(xí)筆記、全套講解視頻、實(shí)戰(zhàn)項(xiàng)目源碼講義》點(diǎn)擊傳送門(mén)即可獲?。?/strong>

到了這里,關(guān)于Android OpenGLES + Camera1 相機(jī)預(yù)覽(2)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶(hù)投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Android 使用Camera2 API 和 GLSurfaceView實(shí)現(xiàn)相機(jī)預(yù)覽

    GLSurfaceView 和 SurfaceView 是 Android 中用于顯示圖像的兩個(gè)視圖類(lèi),它們?cè)趯?shí)現(xiàn)方式和使用場(chǎng)景上有一些區(qū)別。 實(shí)現(xiàn)方式:GLSurfaceView 基于 OpenGL ES 技術(shù)實(shí)現(xiàn),可以通過(guò) OpenGL ES 渲染圖像。而 SurfaceView 則是通過(guò)基于線(xiàn)程的繪制方式,可以在獨(dú)立的線(xiàn)程中進(jìn)行繪制操作。 性能:由于

    2024年02月09日
    瀏覽(20)
  • Android之camera1和2的簡(jiǎn)單使用

    前言 Android Framework提供Camera API來(lái)實(shí)現(xiàn)拍照與錄制視頻的功能,目前Android有三類(lèi)API, Camera 此類(lèi)是用于控制設(shè)備相機(jī)的舊版 API,現(xiàn)已棄用,在Android5.0以下使用 Camera2 此軟件包是用于控制設(shè)備相機(jī)的主要 API,Android5.0以上使用 CameraX 基于Camera 2 API封裝,簡(jiǎn)化了開(kāi)發(fā)流程,并增加

    2024年02月09日
    瀏覽(21)
  • android camera系列(Camera1、Camera2、CameraX)的使用以及輸出的圖像格式

    android camera系列(Camera1、Camera2、CameraX)的使用以及輸出的圖像格式

    1.1.1、布局 1.1.2、實(shí)現(xiàn)預(yù)覽 Camera.open() 打開(kāi)攝像頭 setPreviewDisplay 設(shè)置預(yù)覽展示的控件 startPreview 開(kāi)始預(yù)覽 發(fā)現(xiàn)預(yù)覽是橫著的,需要使用 setDisplayOrientation 調(diào)整預(yù)覽圖像的方向 1.1.3、獲取攝像頭的原始數(shù)據(jù) setPreviewCallback 設(shè)置預(yù)覽數(shù)據(jù)的回調(diào) 2560*1440 默認(rèn)返回圖像的分辨率 Image

    2024年02月21日
    瀏覽(29)
  • OpenGLES:glReadPixels()獲取相機(jī)GLSurfaceView預(yù)覽數(shù)據(jù)并保存

    OpenGLES:glReadPixels()獲取相機(jī)GLSurfaceView預(yù)覽數(shù)據(jù)并保存

    Android 現(xiàn)行的 Camera API2 機(jī)制可以通過(guò) onImageAvailable(ImageReader reader) 回調(diào)從底層獲取到 Jpeg、Yuv 和 Raw 三種格式的 Image ,然后通過(guò)保存 Image 實(shí)現(xiàn)拍照功能,但是卻并沒(méi)有 Api 能直接在上層直接拿到預(yù)覽Surface上的實(shí)顯數(shù)據(jù)。 Android Camera 預(yù)覽的實(shí)現(xiàn)是上層下發(fā) Surface 到 CameraHAL ,由

    2024年02月03日
    瀏覽(17)
  • Android相機(jī)開(kāi)發(fā)實(shí)戰(zhàn),Android程序員必看

    Android相機(jī)開(kāi)發(fā)實(shí)戰(zhàn),Android程序員必看

    由于需求不同,所以選擇的方案固然也不同,至于第二種調(diào)用系統(tǒng)相機(jī),這里就不過(guò)多講解了,使用Intent對(duì)象設(shè)置一個(gè)Action動(dòng)作即可,跳轉(zhuǎn)時(shí)使用startActivityForResult,然后在onActivityResult處理相關(guān)數(shù)據(jù)便可,關(guān)鍵代碼: intent.setAction(“android.media.action.STILL_IMAGE_CAMERA”); 至于使用

    2024年04月15日
    瀏覽(29)
  • 在基于 Android 相機(jī)預(yù)覽的 CV 應(yīng)用程序中使用 OpenCL

    在基于 Android 相機(jī)預(yù)覽的 CV 應(yīng)用程序中使用 OpenCL

    組裝和配置 Android OpenCL SDK。 示例的 JNI 部分依賴(lài)于標(biāo)準(zhǔn) Khornos OpenCL 標(biāo)頭,以及 OpenCL 和 libOpenCL.so 的C++包裝器。標(biāo)準(zhǔn) OpenCL 標(biāo)頭可以從 OpenCV 存儲(chǔ)庫(kù)中的第三方目錄或 Linux 發(fā)行版包中復(fù)制。C++包裝器在Github上的官方Khronos存儲(chǔ)庫(kù)中可用。按以下方式將頭文件復(fù)制到專(zhuān)用目錄:

    2024年01月21日
    瀏覽(25)
  • 安卓camera1設(shè)置自動(dòng)連續(xù)對(duì)焦

    camera 1實(shí)現(xiàn)的控制攝像頭拍照功能. adb控制自動(dòng)拍照,發(fā)現(xiàn)近點(diǎn)時(shí)拍照很模糊,需要自動(dòng)連續(xù)對(duì)焦. mCamera.autoFocus(null) 這個(gè)接口只能實(shí)現(xiàn)單次對(duì)焦.不適用. 作者:帥得不敢出門(mén)

    2024年02月14日
    瀏覽(20)
  • Android Camera預(yù)覽畫(huà)面變形問(wèn)題

    Android Camera預(yù)覽畫(huà)面變形問(wèn)題

    csdn 安卓camera1在預(yù)覽時(shí),預(yù)覽畫(huà)面看起來(lái)被拉伸了. 如圖,圓形的蓋子,變成橢圓形了. 默認(rèn)流程,如下為大致的打開(kāi)攝像頭并進(jìn)行預(yù)覽顯示的代碼 網(wǎng)上大部分的解決方法(實(shí)測(cè)不一定有效) 原理是遍歷攝像頭分辨率,找到與當(dāng)前屏幕契合的分辨率,并設(shè)置為預(yù)覽大?。?如下

    2024年02月13日
    瀏覽(25)
  • Android Camera2-預(yù)覽、拍照、錄像流程

    Android Camera2-預(yù)覽、拍照、錄像流程

    一、Camera2實(shí)現(xiàn)預(yù)覽、拍照、錄像三大基礎(chǔ)功能的流程框架圖 Camera2關(guān)鍵幾個(gè)類(lèi): CameraManager 管理手機(jī)上的所有攝像頭設(shè)備。管理手機(jī)上的所有攝像頭設(shè)備,它的作用主要是獲取攝像頭列表和打開(kāi)(openCamera)指定的攝像頭。 它其實(shí)是一個(gè)系統(tǒng)服務(wù),通過(guò)getSystemService(Context.CAM

    2024年02月16日
    瀏覽(26)
  • Android Camera2(1)-Camera2在textureView中的預(yù)覽和拍照

    Android Camera2(1)-Camera2在textureView中的預(yù)覽和拍照

    解釋上訴示意圖,假如想要同時(shí)拍攝兩張不同尺寸的圖片,并且在拍攝過(guò)程中閃光燈必須亮起來(lái)。整個(gè)拍攝流程如下: 創(chuàng)建一個(gè)用于從 Pipeline 獲取圖片的 CaptureRequest。 修改 CaptureRequest 的閃光燈配置,讓閃光燈在拍照過(guò)程中亮起來(lái)。 創(chuàng)建兩個(gè)不同尺寸的 Surface 用于接收?qǐng)D片

    2024年02月05日
    瀏覽(26)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包