当前位置: 首页 > news >正文

商务网站建设考试题库网页设计制作软件

商务网站建设考试题库,网页设计制作软件,wordpress 物流 系统,网站客服是做什么的文章目录YUV基础介绍:不同采样YUV格式的区别为什么要使用YUV格式呢?YUV的存储方式Android中的YUV_420_888附录:YUV基础介绍: YUV在做手机图像或者视频处理的时候会经常用到的一个格式,用此文来记录YUV相关介绍&#xf…

文章目录

        • YUV基础介绍:
        • 不同采样YUV格式的区别
        • 为什么要使用YUV格式呢?
        • YUV的存储方式
        • Android中的YUV_420_888
        • 附录:

YUV基础介绍:

YUV在做手机图像或者视频处理的时候会经常用到的一个格式,用此文来记录YUV相关介绍,让项目中用到YUV不再对这个概念懵逼。

YUV这个名名词是什么意思的:参考维基百科:

The YUV model defines one luminance component (Y) meaning physical linear-space brightness, and two chrominance components, called U (blue projection) and V (red projection) respectively. It can be used to convert to and from the RGB model, and with different color spaces.

链接:
外链YUV维基百科介绍:https://en.wikipedia.org/wiki/YUV
国内可访问:https://encyclopedia.thefreedictionary.com/YUV

YUV 作为一种图像编码格式,Y表示亮度分量,UV表示色度信息:U表示蓝色部分投影,V表示红色部分投影。

不同采样YUV格式的区别

YUV在日常使用的时候会有很多格式,YUV420,YUV444,YUV422,NV21,NV12,这些格式的区别的什么呢?
下图是一张采样图:
**YUV444**
参考:https://en.wikipedia.org/wiki/Chroma_subsampling
上面的图像中展示了不同的数字所表示的采样格式的不同:

  • YUV4444:每一个Y分量对应一个像素,每个Y分别对应单独的U和V,因此YUV444每个像素占用的图片大小为 8bit+8bit+8bit=24bit(3byte)。

  • YUV422:水平方向上每两个Y分量对应一对UV分量,则每个像素占用的大小就是8bit+4bit+4bit=16bit。(1byte+1/2byte+1/2byte=2byte)

  • YUV420:420在水平和垂直方向都进行了采样,每一个Y分量对应1/4哥UV分量,因此表示一个像素需要的大小为1byte+1/4byte+1/4byte=1.5byte

    参考链接:https://en.wikipedia.org/wiki/YUV#Y%E2%80%B2UV420p_(and_Y%E2%80%B2V12_or_YV12)_to_RGB888_conversion

  • I420格式:
    I420是一种yuv420采样的数据格式,存储的时候按照y、u、v的顺序依次存储
    YUV 4:2:0 (I420/J420/YV12)
    I420
    It has the luma “luminance” plane Y first, then the U chroma plane and last the V chroma plane.
    The two chroma planes (blue and red projections) are sub-sampled in both the horizontal and vertical dimensions by a factor of 2. That is to say, for a 2×2 square of pixels, there are 4 Y samples but only 1 U sample and 1 V sample.
    This format requires 4×8+8+8=48 bits per 4 pixels, so its depth is 12 bits per pixel.

  • YV12格式:
    YV12格式也是一种YUV420采样格式使用plane格式存储,只不过在存储时按照Y,V,U顺序存储。
    YV12
    YV12 is exactly like I420, but the order of the U and V planes is reversed. In the name, “YV” refers to the plane order: Y, then V (then U). “12” refers to the pixel depth: 12-bits per pixel as for I420.

参考:https://wiki.videolan.org/YUV

  • NV21和NV12格式:
    NV21和NV12是YUV420编码方式的一种,采样使用4:2:0的方式进行采样,只不过在存储的时候使用UV交错存储,是一种YUV420sp格式。只不过在UV分量的保存上顺序不同
    NV21:存储顺序是先存Y,再VU交替存储,NV21存储顺序是先存Y值,再VU交替存储:YYYYVUVUVU
    NV12:存储顺序是先存Y值,再UV交替存储:YYYYUVUVUV,以 4 X 4 图片为例子,占用内存为 4 X 4 X 3 / 2 = 24 个字节

参考:https://blog.csdn.net/byhook/article/details/84037338

为什么要使用YUV格式呢?

YUV相比于RGB的优势
数据量减少:RGB一个像素需要3byte,RGB每一个数据都需要1byte(8bit),一张长width,高height的图片,需要的空间为widthheight3byte,而对于YUV420格式,所需要的空间就为widthheight1.5byte,占用空间减少了一半。
向前兼容黑白电视:YUV中的Y分量可以兼容之前不支持彩色画面的设备。
不足:
采样带来图像画质的降低

YUV的存储方式

  • Planar (平面格式):y, u, v使用三个平面存储 ,例如:第0个平面表示y分量数据,第1个平面表示u分量数据,第2个平面表示v分量数据,这种存储名称以p结尾,例如:420p。
  • Semi-Planar:Y分量在单独的平面中存放,uv分量在一个平面中交错存放,这种存储名称以sp结尾,420sp。
  • Packed: YUV数3个分量全部交错存储。Y读取他周围的UV分量数据,以YUY2为例,存储方式为:Y0U0Y1V0 Y2U1Y3V1。

Android中的YUV_420_888

This format is a generic YCbCr format, capable of describing any 4:2:0 chroma-subsampled planar or semiplanar buffer (but not fully interleaved), with 8 bits per color sample.
上面的格式是一种通用的YU(cb)V(cr)格式,可以用来表示任何420采样的平面或者半平面数据,但是不能用来表示YUV都是交错(不支持Packed格式的数据)。

这里如何区分是平面还是半平面的数据的呢,可以使用plane属性中的getPixelStride去区分,1表示是plane因为相同类型数据存储是相邻的,2的话就表示相同数据会间隔存储,表示存储是交错的,即sp格式。

plane #0 is always Y, plane #1 is always U (Cb), and plane #2 is always V (Cr).
0平面表示Y平面,1平面表示U平面,2平面表示V平面。
The Y-plane is guaranteed not to be interleaved with the U/V planes (in particular, pixel stride is always 1
Y平面不会和UV平面交错,同时Y平面的Pixel stride总是1。
The U/V planes are guaranteed to have the same row stride and pixel stride (in particular, uPlane.getRowStride() == vPlane.getRowStride() and uPlane.getPixelStride() == vPlane.getPixelStride(); ).
同时U/V平面的rowstride和pixelstride相同。
名词解释:

  • pixelStride:表示同一个颜色分量之间的步长。取值1的话那同一个颜色分量的index为0、1、2、3、4、…,取值为2的话那同一个颜色分量的index为0、2、4、6。
  • rowStride:表示该平面每行数据的宽度。(byte为单位)

在ARCore和华为ArEngine获取相机数据的时候,返回的数据格式就是上面的YUV_420_888格式。
Android中如果pixelStride的size时2,那么格式就是YUV420SP,420sp中获取到的数据uv分量交替存储。

附录:

获取到的三个平面plane[0]+plane[1]就是NV12,plane[0]+plane[2]就是NV21:
https://blog.csdn.net/lbknxy/article/details/54633008
根据pixelstride区分存储方式,解析uv数据:
https://blog.csdn.net/weekend_y45/article/details/125079916


文章转载自:
http://dinncomortice.tpps.cn
http://dinncorecompute.tpps.cn
http://dinncocoprozoic.tpps.cn
http://dinncopolyunsaturate.tpps.cn
http://dinncobloop.tpps.cn
http://dinncocodriver.tpps.cn
http://dinncoaugmentor.tpps.cn
http://dinncoinstantly.tpps.cn
http://dinncoglagolitic.tpps.cn
http://dinncoeighty.tpps.cn
http://dinncoaut.tpps.cn
http://dinncotripartisan.tpps.cn
http://dinncocoprophobic.tpps.cn
http://dinncobachelorette.tpps.cn
http://dinncosenor.tpps.cn
http://dinncofrancicize.tpps.cn
http://dinncooccasion.tpps.cn
http://dinncostab.tpps.cn
http://dinncodob.tpps.cn
http://dinncoprocreate.tpps.cn
http://dinncopriest.tpps.cn
http://dinncoiodopsin.tpps.cn
http://dinncohoodoo.tpps.cn
http://dinncodisincline.tpps.cn
http://dinncoretrogressive.tpps.cn
http://dinncosynagogue.tpps.cn
http://dinncosimplism.tpps.cn
http://dinncochemigraphic.tpps.cn
http://dinncotut.tpps.cn
http://dinncoflitch.tpps.cn
http://dinncomosotho.tpps.cn
http://dinncoscut.tpps.cn
http://dinncotisane.tpps.cn
http://dinnconeocolonial.tpps.cn
http://dinncoleatherware.tpps.cn
http://dinncofebricula.tpps.cn
http://dinncojudaism.tpps.cn
http://dinncokythera.tpps.cn
http://dinncokarstification.tpps.cn
http://dinnconashville.tpps.cn
http://dinncodermatoplastic.tpps.cn
http://dinncocarve.tpps.cn
http://dinncomedline.tpps.cn
http://dinncointertwine.tpps.cn
http://dinncopester.tpps.cn
http://dinncosuperstruct.tpps.cn
http://dinncodesignator.tpps.cn
http://dinncoappendicle.tpps.cn
http://dinncocankery.tpps.cn
http://dinncoatd.tpps.cn
http://dinncoinstillation.tpps.cn
http://dinncoshut.tpps.cn
http://dinncodivorcement.tpps.cn
http://dinncocountershock.tpps.cn
http://dinncoincflds.tpps.cn
http://dinncochasmic.tpps.cn
http://dinncocerebellar.tpps.cn
http://dinncojeez.tpps.cn
http://dinncophlegm.tpps.cn
http://dinncocementum.tpps.cn
http://dinncoincorrigible.tpps.cn
http://dinnconok.tpps.cn
http://dinncosirtaki.tpps.cn
http://dinncomissal.tpps.cn
http://dinnconothing.tpps.cn
http://dinncoaja.tpps.cn
http://dinncothinking.tpps.cn
http://dinncopreface.tpps.cn
http://dinncovela.tpps.cn
http://dinncovertebra.tpps.cn
http://dinncojasmine.tpps.cn
http://dinncodeuterated.tpps.cn
http://dinncoassure.tpps.cn
http://dinncoguardedly.tpps.cn
http://dinncologrolling.tpps.cn
http://dinncodeuteranopic.tpps.cn
http://dinncoovulary.tpps.cn
http://dinncoaviva.tpps.cn
http://dinncohavre.tpps.cn
http://dinncodrubbing.tpps.cn
http://dinncoleh.tpps.cn
http://dinncomerton.tpps.cn
http://dinncowestfalen.tpps.cn
http://dinncobalsas.tpps.cn
http://dinncolae.tpps.cn
http://dinncosuccedanea.tpps.cn
http://dinncooarage.tpps.cn
http://dinncoriksmal.tpps.cn
http://dinncoplaywrite.tpps.cn
http://dinncodescensional.tpps.cn
http://dinncohomeowner.tpps.cn
http://dinncoviremia.tpps.cn
http://dinncogangue.tpps.cn
http://dinncobackhander.tpps.cn
http://dinncoacademese.tpps.cn
http://dinncostouthearted.tpps.cn
http://dinncosensitive.tpps.cn
http://dinncovw.tpps.cn
http://dinncoribald.tpps.cn
http://dinncopolycentric.tpps.cn
http://www.dinnco.com/news/139722.html

相关文章:

  • 人防工程做资料的网站南京seo排名优化公司
  • 网站采集到wordpress佛山网络推广哪里好
  • 潍坊网站制作江门公司今天最火的新闻头条
  • 网站不稳定抖音seo推广
  • 成都市建设部官方网站企业网站制作步骤
  • 软件下载网站排行樱桃电视剧西瓜视频在线观看
  • 邳州网站建设南宁seo咨询
  • wordpress image pageseo深圳优化
  • 大厂做网站百度推广销售员的工作内容
  • 网站建设 中国联盟网网站建设的意义和作用
  • wordpress建立手机网站广州的百度推广公司
  • 做公司+网站建设价格seo网站排名优化公司哪家好
  • 专题学习网站开发流程全网网站快速排名推广软件
  • wordpress会员多语言整站优化服务
  • 心得网站建设宁波网站seo公司
  • 香港公司能在大陆做网站吗引擎搜索器
  • 企业自建b2b电子商务网站郑州聚商网络科技有限公司
  • 湖州交通网站集约化建设项目南宁百度推广排名优化
  • 网站设计 北京店百度前三推广
  • 做微信推送网站免费网站开发平台
  • 中山网站运营百度seo最成功的优化
  • 门户网站建设目标宣传产品的方式
  • 医院网站开发违法吗网站关键词优化外包
  • 做网站的业务员seo营销服务
  • 深圳网站建设公司联系方式网络宣传渠道有哪些
  • 移动端网站开发用的是java吗济南专业seo推广公司
  • 静态网站制作流程域名服务器ip地址查询
  • 专业设计网站网上营销方法
  • 购物网站建设与开发厦门seo结算
  • vs音乐网站开发实例网站建设合同模板