CN105791981A - 一种可实现视频画面旋转预设角度的方法 - Google Patents
一种可实现视频画面旋转预设角度的方法 Download PDFInfo
- Publication number
- CN105791981A CN105791981A CN201610128148.2A CN201610128148A CN105791981A CN 105791981 A CN105791981 A CN 105791981A CN 201610128148 A CN201610128148 A CN 201610128148A CN 105791981 A CN105791981 A CN 105791981A
- Authority
- CN
- China
- Prior art keywords
- angle
- rotation
- video
- video data
- playing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 19
- 238000006243 chemical reaction Methods 0.000 claims description 8
- 230000008569 process Effects 0.000 claims description 5
- 230000005484 gravity Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 235000013350 formula milk Nutrition 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/4402—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
- H04N21/440263—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by altering the spatial resolution, e.g. for displaying on a connected PDA
- H04N21/440272—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by altering the spatial resolution, e.g. for displaying on a connected PDA for performing aspect ratio conversion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/222—Studio circuitry; Studio devices; Studio equipment
- H04N5/262—Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
- H04N5/2628—Alteration of picture size, shape, position or orientation, e.g. zooming, rotation, rolling, perspective, translation
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Television Signal Processing For Recording (AREA)
Abstract
本发明公开了一种可实现视频画面旋转预设角度的方法,其步骤为:创建一个对象SetPlayDirection(angle),其中,angle表示视频画面旋转的角度;创建播放器对象;设置播放文件路径;设置旋转角度,之后开始播放;解码并获取视频数据;将视频数据按照如下公式做数据旋转处理:x=cos(θ)*x’‑sin(θ)*y’;y=sin(θ)*x’‑cos(θ)*y’;返回旋转处理后的视频数据;播放旋转后的视频内容,直至用户退出当前播放或者视频结束,销毁占用的解码、内存,退出播放。本发明能够在保持播放设备位置不变的情况下,实现视频画面旋转后播放。
Description
技术领域
本发明涉及视频数据处理方法,尤其涉及一种可实现视频画面旋转预设角度的方法。
背景技术
生活中,经常需要用相机、摄像机、手机等拍摄视频,在拍摄设备上观看时没有任何差错,一旦传入电脑,就经常看到视频翻转了90或者180度,其原因是手持设备本身存在翻转机制,即通过重力感应装置监听屏幕的旋转方向,进而设置视频播放的方向,譬如横拍与竖拍,手持设备上看不出问题,但传入电脑后则由于缺少重力感应装置,则无法正常显示。
发明内容
本发明要解决的技术问题在于,针对现有技术的不足,提供一种可实现视频画面旋转预设角度的方法,进而在保持播放设备位置不变的情况下,实现视频画面旋转后播放。
为解决上述技术问题,本发明采用如下技术方案。
一种可实现视频画面旋转预设角度的方法,其包括有如下步骤:步骤S1,创建一个对象SetPlayDirection(angle),其中,angle表示视频画面旋转的角度;步骤S2,创建播放器对象;步骤S3,设置播放文件路径;步骤S4,设置旋转角度,之后开始播放;步骤S5,解码并获取视频数据;步骤S6,将视频数据按照如下公式做数据旋转处理:x=cos(θ)*x’-sin(θ)*y’;y=sin(θ)*x’-cos(θ)*y’;其中,x和y是视频数据变换之前的坐标系中的坐标,x’和y’是视频数据变换之后的坐标系中的坐标;步骤S7,返回旋转处理后的视频数据;步骤S8,播放旋转后的视频内容,直至用户退出当前播放或者视频结束,销毁占用的解码、内存,退出播放。
优选地,angle所表示的角度为0、90、180或270。
本发明公开的可实现视频画面旋转预设角度的方法中,通过创建对象SetPlayDirection(angle),以及设置旋转角度,再结合数据旋转处理公式,得到旋转处理后的视频数据,并对该视频数据进行播放。本发明相比现有技术而言的有益效果在于,本发明无需重力感应装置,硬件成本低,并且本发明能够在保持设备不动的情况下,根据需要得到旋转播放的视频画面。
具体实施方式
下面结合实施例对本发明作更加详细的描述。
本发明公开了一种可实现视频画面旋转预设角度的方法,其包括有如下步骤:
步骤S1,创建一个对象SetPlayDirection(angle),其中,angle表示视频画面旋转的角度;
步骤S2,创建播放器对象;
步骤S3,设置播放文件路径;
步骤S4,设置旋转角度,之后开始播放;
步骤S5,解码并获取视频数据;
步骤S6,将视频数据按照如下公式做数据旋转处理:
x=cos(θ)*x’-sin(θ)*y’;
y=sin(θ)*x’-cos(θ)*y’;
其中,x和y是视频数据变换之前的坐标系中的坐标,x’和y’是视频数据变换之后的坐标系中的坐标;
步骤S7,返回旋转处理后的视频数据;
步骤S8,播放旋转后的视频内容,直至用户退出当前播放或者视频结束,销毁占用的解码、内存,退出播放。
作为一种优选方式,angle所表示的角度为0、90、180或270,进而满足用户的不同需求。
上述步骤S6中,对画面旋转功能的处理原理如下:
以画面的中心点为坐标原点,先把像素在目标图像中的位置变化为坐标系中的位置,做旋转变换求出变换之前的在坐标系中的坐标,再变换为旋转后图片中的位置。假设图像上所有点都绕原点逆时针旋转θ度,则变换公式如下:
x=x′cosθ-y′sinθ
y=x′sinθ+y′cosθ
其中(x,y)为原始图像像素坐标,为旋转后的坐标,则逆变换为:
x′=xcosθ+ysinθ
y′=-xsinθ+ycosθ
用矩阵表示如下:
其中,x和y是视频数据变换之前的坐标系中的坐标,x’和y’是视频数据变换之后的坐标系中的坐标,angle为逆时针旋转的角度数。
本发明公开的可实现视频画面旋转预设角度的方法中,通过创建对象SetPlayDirection(angle),以及设置旋转角度,再结合数据旋转处理公式,得到旋转处理后的视频数据,并对该视频数据进行播放。本发明相比现有技术而言的有益效果在于,本发明无需重力感应装置,硬件成本低,并且本发明能够在保持设备不动的情况下,根据需要得到旋转播放的视频画面。
以上所述只是本发明较佳的实施例,并不用于限制本发明,凡在本发明的技术范围内所做的修改、等同替换或者改进等,均应包含在本发明所保护的范围内。
Claims (2)
1.一种可实现视频画面旋转预设角度的方法,其特征在于,包括有如下步骤:
步骤S1,创建一个对象SetPlayDirection(angle),其中,angle表示视频画面旋转的角度;
步骤S2,创建播放器对象;
步骤S3,设置播放文件路径;
步骤S4,设置旋转角度,之后开始播放;
步骤S5,解码并获取视频数据;
步骤S6,将视频数据按照如下公式做数据旋转处理:
x=cos(θ)*x’-sin(θ)*y’;
y=sin(θ)*x’-cos(θ)*y’;
其中,x和y是视频数据变换之前的坐标系中的坐标,x’和y’是视频数据变换之后的坐标系中的坐标;
步骤S7,返回旋转处理后的视频数据;
步骤S8,播放旋转后的视频内容,直至用户退出当前播放或者视频结束,销毁占用的解码、内存,退出播放。
2.如权利要求1所述的可实现视频画面旋转预设角度的方法,其特征在于,angle所表示的角度为0、90、180或270。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610128148.2A CN105791981A (zh) | 2016-03-07 | 2016-03-07 | 一种可实现视频画面旋转预设角度的方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610128148.2A CN105791981A (zh) | 2016-03-07 | 2016-03-07 | 一种可实现视频画面旋转预设角度的方法 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105791981A true CN105791981A (zh) | 2016-07-20 |
Family
ID=56387142
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610128148.2A Pending CN105791981A (zh) | 2016-03-07 | 2016-03-07 | 一种可实现视频画面旋转预设角度的方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105791981A (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10831314B2 (en) | 2016-12-16 | 2020-11-10 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | Method and electronic device for preventing touch button from being false triggered |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101527795A (zh) * | 2009-04-13 | 2009-09-09 | 腾讯科技(深圳)有限公司 | 一种在播放中旋转视频的处理方法、装置与*** |
US20120218311A1 (en) * | 2000-07-17 | 2012-08-30 | Sony Computer Entertainment Inc. | Program execution system, program execution device and recording medium and computer executable program therefor |
US20130169630A1 (en) * | 2010-09-09 | 2013-07-04 | Sony Corporation | Information processing device, information processing method, and program |
CN103220485A (zh) * | 2012-01-18 | 2013-07-24 | 腾讯科技(深圳)有限公司 | 视频播放旋转画面的方法及*** |
CN103377030A (zh) * | 2012-04-26 | 2013-10-30 | 华为技术有限公司 | 图像旋转控制方法及装置 |
-
2016
- 2016-03-07 CN CN201610128148.2A patent/CN105791981A/zh active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120218311A1 (en) * | 2000-07-17 | 2012-08-30 | Sony Computer Entertainment Inc. | Program execution system, program execution device and recording medium and computer executable program therefor |
CN101527795A (zh) * | 2009-04-13 | 2009-09-09 | 腾讯科技(深圳)有限公司 | 一种在播放中旋转视频的处理方法、装置与*** |
US20130169630A1 (en) * | 2010-09-09 | 2013-07-04 | Sony Corporation | Information processing device, information processing method, and program |
CN103220485A (zh) * | 2012-01-18 | 2013-07-24 | 腾讯科技(深圳)有限公司 | 视频播放旋转画面的方法及*** |
CN103377030A (zh) * | 2012-04-26 | 2013-10-30 | 华为技术有限公司 | 图像旋转控制方法及装置 |
Non-Patent Citations (1)
Title |
---|
徐飞: "基于FPGA的视频图像旋转的设计与实现", 《信息科技辑》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10831314B2 (en) | 2016-12-16 | 2020-11-10 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | Method and electronic device for preventing touch button from being false triggered |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10721439B1 (en) | Systems and methods for directing content generation using a first-person point-of-view device | |
US10332237B2 (en) | Equatorial stitching of hemispherical images in a spherical image capture system | |
CN105519097B (zh) | 用于显示画中画的***、装置和方法 | |
WO2018214365A1 (zh) | 图像校正方法、装置、设备、***及摄像设备和显示设备 | |
US20170339341A1 (en) | 360 degree video recording and playback with object tracking | |
US20210067758A1 (en) | Method and apparatus for processing virtual reality image | |
CN106780550B (zh) | 一种目标跟踪方法及电子设备 | |
US20190141252A1 (en) | Systems and methods for controlling a field of view | |
CN112543343B (zh) | 基于连麦直播的直播画面处理方法、装置及电子设备 | |
US10846535B2 (en) | Virtual reality causal summary content | |
TW201520827A (zh) | 針對多媒體資料提供擴增實境效果之系統和方法 | |
CN107734244A (zh) | 全景影片播放方法及播放装置 | |
CN108702430B (zh) | 用于控制相机的差异瞄准方向的方法和装置 | |
CN105791981A (zh) | 一种可实现视频画面旋转预设角度的方法 | |
CN109040654B (zh) | 外部拍摄设备的识别方法、装置及存储介质 | |
CN104331241A (zh) | 一种全景互动移动终端展示***及方法 | |
US20180109723A1 (en) | Information processing device, information processing method, and program | |
CN104866809B (zh) | 画面播放方法和装置 | |
US10778891B2 (en) | Panoramic portals for connecting remote spaces | |
US9904355B2 (en) | Display method, image capturing method and electronic device | |
CN113223185B (zh) | 一种图像处理方法、装置、电子设备及存储介质 | |
US10419666B1 (en) | Multiple camera panoramic images | |
US8553986B2 (en) | Method for processing image and system processing the same | |
WO2017092261A1 (zh) | 一种摄像头模组、移动终端及其拍摄图像的方法和装置 | |
TWM419956U (en) | Ultra-wide-angle camera with function of intelligent identification |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160720 |