Code Monkey home page Code Monkey logo

Comments (4)

CainKernel avatar CainKernel commented on July 24, 2024

预览变形主要是因为分辨率宽高与预览的尺寸不一致导致的。你可以看看cameralibrary里面的RenderManager.java。里面将纹理尺寸和预览尺寸的VertexBuffer、TextureBuffer 做了拆分。全屏预览时需要将预览尺寸做调节处理。比如你相机输入的纹理是16:9的,而你全屏预览时SurfaceView的尺寸是18:9还是其他什么奇怪比例。这是你就需要调整预览的顶点坐标或者纹理坐标了。关于如何调整,你先理解顶点坐标(-1.0 ~ 1.0)和纹理坐标(0.0 ~ 1.0)映射到图像分辨率的关系,调整实际的预览顶点坐标/纹理坐标即可。

from caincamera.

CarlLu avatar CarlLu commented on July 24, 2024

十分感谢

from caincamera.

CarlLu avatar CarlLu commented on July 24, 2024

大神,能不能麻烦再帮忙提示一下。具体怎么改啊。本人初学者。还望见谅

from caincamera.

CainKernel avatar CainKernel commented on July 24, 2024

个人建议初学者先好好把OpenGL ES的基础知识弄懂了再来搞美颜类相机等涉及GPU编程的应用开发,要不然遇到其他问题还是不搞不明白的,Shader 的方方面面都跟这个密切相关。OpenGLES的基础知识是移动端GPU编程应用开发的先决条件。技术这饭是要一口一口吃的,这跟初学者没任何关系,谁第一次接触不是初学者?

解决思路的话,可以参考以往的讨论正方形录制的issue,里面涉及了关键的技术要点:
正方形录制
你先配合这个isssue里面的技术要点,自己找关于OpenGLES顶点坐标和纹理坐标的文章配合起来看,自己弄懂怎么去实现这个。关于顶点坐标/纹理坐标映射图像之后,怎么裁剪怎么处理变形都是一样的套路,剩下的都是数学计算了。你可以尝试着调整VertexBuffer/TexturBuffer 的坐标值,然后看图像的变化,这样会理解得更深入一点。

from caincamera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.