图像处理—CIF to QCIF记录

这篇博客主要介绍了CIF到QCIF图像格式转换的过程,详细解析了YUV文件的储存格式,并提供了转换的核心代码。在转换时,由于QCIF尺寸为CIF的一半,因此需要采用四取一的方法,正确处理指针跳转,确保Y、U、V三个部分的转换正确。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

第一篇博献给数字图像处理的小赵老师……作业写得这么费劲也是难得,来一发记录,整理下小知识点。感谢明潞用积分换来的参考代码和小学期处理YUV剩下的记忆。

CIF图像格式:352*288;

QCIF图像格式:176*144;

(一)在处理YUV文件的情况下,要明晰YUV文件的储存格式:(参考来源:http://www.360doc.com/content/14/0527/09/474846_381336832.shtml)


(二)注意事项+代码

# Copyright 2022 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Verify video is stable during phone movement.""" import logging import os import threading import time from mobly import test_runner import its_base_test import camera_properties_utils import image_processing_utils import its_session_utils import sensor_fusion_utils import video_processing_utils _ASPECT_RATIO_16_9 = 16/9 # determine if video fmt > 16:9 _IMG_FORMAT = 'png' _MIN_PHONE_MOVEMENT_ANGLE = 5 # degrees _NAME = os.path.splitext(os.path.basename(__file__))[0] _NUM_ROTATIONS = 24 _START_FRAME = 30 # give 3A 1s to warm up _VIDEO_DELAY_TIME = 5.5 # seconds _VIDEO_DURATION = 5.5 # seconds _VIDEO_QUALITIES_TESTED = ('CIF:3', '480P:4', '720P:5', '1080P:6', 'QVGA:7', 'VGA:9') _VIDEO_STABILIZATION_FACTOR = 0.7 # 70% of gyro movement allowed _VIDEO_STABILIZATION_MODE = 1 _SIZE_TO_PROFILE = {'176x144': 'QCIF:2', '352x288': 'CIF:3', '320x240': 'QVGA:7'} def _collect_data(cam, tablet_device, video_profile, video_quality, rot_rig): """Capture a new set of data from the device. Captures camera frames while the user is moving the device in the prescribed manner. Args: cam: camera object tablet_device: boolean; based on config.yml video_profile: str; number of video profile video_quality: str; key string for video quality. ie. 1080P rot_rig: dict with 'cntl' and 'ch' defined Returns: recording
最新发布
03-14
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值