您的位置:首页 > 游戏 > 游戏 > 自己创建的网站_北京网站设计公司兴田德润放心_百度推广找谁做_seo搜索排名影响因素主要有

自己创建的网站_北京网站设计公司兴田德润放心_百度推广找谁做_seo搜索排名影响因素主要有

2025/2/24 8:04:05 来源:https://blog.csdn.net/qq_40500571/article/details/143144136  浏览:    关键词:自己创建的网站_北京网站设计公司兴田德润放心_百度推广找谁做_seo搜索排名影响因素主要有
自己创建的网站_北京网站设计公司兴田德润放心_百度推广找谁做_seo搜索排名影响因素主要有
#pip install opencv-python# from PIL import Image
from PIL import Image
import cv2
import numpy as npfile_path='/home/pozhu/Desktop/dog.jpeg'
img= Image.open(file_path)# img_nv12 = img.convert('NV12')# img_nv12.save("output.nv12")def bgr2nv12(image): image = image.astype(np.uint8) height, width = image.shape[0], image.shape[1] yuv420p = cv2.cvtColor(image, cv2.COLOR_BGR2YUV_I420).reshape((height * width * 3 // 2, )) y = yuv420p[:height * width] uv_planar = yuv420p[height * width:].reshape((2, height * width // 4)) uv_packed = uv_planar.transpose((1, 0)).reshape((height * width // 2, )) nv12 = np.zeros_like(yuv420p) nv12[:height * width] = y nv12[height * width:] = uv_packed return nv12image_cv = cv2.imread(file_path)
nv12_image= bgr2nv12(image_cv)
nv12_image_path="output_"+str(image_cv.shape[1])+'_'+str(image_cv.shape[0]) + ".nv12"
nv12_image.tofile(nv12_image_path)

OpenGL 进行 RGBA 转 NV12
https://blog.csdn.net/weixin_48711201/article/details/132360752

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com