CN102446344A - Direct FB (Frame Buffer) based method for realizing picture rotation - Google Patents
Direct FB (Frame Buffer) based method for realizing picture rotation Download PDFInfo
- Publication number
- CN102446344A CN102446344A CN201110275023XA CN201110275023A CN102446344A CN 102446344 A CN102446344 A CN 102446344A CN 201110275023X A CN201110275023X A CN 201110275023XA CN 201110275023 A CN201110275023 A CN 201110275023A CN 102446344 A CN102446344 A CN 102446344A
- Authority
- CN
- China
- Prior art keywords
- picture
- pixel
- postrotational
- directfb
- direct
- 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
Images
Landscapes
- Editing Of Facsimile Originals (AREA)
- Processing Or Creating Images (AREA)
- Image Processing (AREA)
Abstract
The invention relates to a picture processing technology and discloses a direct FB (Frame Buffer) based method for realizing picture rotation. By means of the method, for a user who uses a direct FB graphics accelerating engine, a picture can be rotated at any angle when an application program is wrote by utilizing an API (Application Programming Interface). The key point of the technical scheme comprises the steps of: a, analyzing the picture format and the storage format of pixel points; b, calculating the vertex coordinate value of the picture after being rotated on the basis of the vertex coordinate value and the rotation matrix of the current picture; c, creating a picture data buffer zone after being rotated; d, locking the picture data buffer zone by utilizing a Lock function of the direct FB; e, calculating the change of the coordinate value of each pixel point before and after rotation; f, moving the pixel point on the basis of a new coordinate of certain pixel point after being rotated, which is obtained through the calculation; and g, repeating the step f till the move of all the pixel points in the picture is completed. The method disclosed by the invention is suitable for the user who uses the direct FB graphics accelerating engine and needs to rotate the picture at any angle when the application program is wrote by utilizing the API.
Description
Technical field
The present invention relates to the picture treatment technology, particularly a kind of implementation method of rotating based on the picture of DirectFB.
Background technology
Along with the continuous development of picture treatment technology, the ways of presentation of present various pictures becomes and becomes increasingly complex, and a large amount of embedded devices also begins to support the hardware-accelerated to reach the more gorgeous effect that represents of figure.
DirectFB is that provide hardware graphics acceleration, the input equipment of a lightweight handled and abstract shape library, and it is integrated supports translucent windows system and the multilayer on Linux Framebuffer drives to show.DirectFB is specially for embedded system designs, and its resource overhead with minimum is realized the highest hardware acceleration performance.
Because of above advantage; A lot of embedded chips all provide the support to DirectFB; The software developer can use the api interface (API) of DirectFB to write based on hardware-accelerated application program; Yet the api interface that DirectFB provides can not satisfy all application demands.
In the application of reality; We may run into the rotation at any angle of picture; And in the standard A PI of present DirectFB; Only supporting the rotation of 90,180,270,360 degree, is the ranks inverse manner that adopt the picture pixel for 90 degree rotations, is capable turned upside down, the side-inverted modes of row that adopt the picture pixel for 180 degree rotations; For 270 degree also is to adopt the ranks inverse manner, but inverted direction is opposite with 90 degree; Just simpler for 360 degree rotations, only need the location of pixels of picture is kept getting final product with former picture is consistent;
Above-mentioned four kinds of rotation modes are realized simple, therefore for present DirectFB, also enough support, yet if want picture is rotated arbitrarily angled (as: 27 degree), present DirectFB just can't support this operation.This is owing to rotate the algorithm more complicated at any angle: total how many row of the picture after at first we do not know to rotate; Do not know what pixels every row has yet; How many starting points of more not knowing the valid pixel of every row is; How many terminal points is again, and these all need obtain through the calculating of complicacy.Therefore, to rotation at any angle, the size of picture maybe be different before and after the rotation, also possibly cause losing of picture pixel data, need carry out individual processing to each pixel.Also there is not at present a kind of method that can realize based on the picture rotation of DirectFB.
Summary of the invention
Technical matters to be solved by this invention is: propose a kind of implementation method of rotating based on the picture of DirectFB; For the user who uses DirectFB figure accelerating engine; When utilizing api interface to write application program, can realize arbitrarily angled rotation to picture.
The present invention solves the problems of the technologies described above the technical scheme that is adopted: a kind of implementation method of rotating based on the picture of DirectFB may further comprise the steps:
A. resolve the storage format of picture format and pixel;
B. the apex coordinate value of calculating postrotational picture according to the apex coordinate value and the rotation matrix of photo current;
C. create postrotational image data buffer zone;
D. utilize the Lock function of DirectFB to lock said image data buffer zone;
E. calculate each pixel at postrotational new coordinate figure;
F. this pixel is moved at postrotational new coordinate figure according to certain pixel that calculates;
G. repeating step f, the moving of all pixels in accomplishing picture.
Further, among the step b, also comprise: the size of calculating postrotational picture according to the apex coordinate value of postrotational picture.
Further, among the step c, create postrotational image data buffer zone according to the form and the size of postrotational picture.
The invention has the beneficial effects as follows: on the basis of original DirectFB; According to picture format and pixel storage principle; Use rotation matrix to calculate the postrotational coordinate position of pixel in the picture file one by one; Carry out pixel number according to moving in internal memory, thereby realize any rotary manipulation of picture, to reach the rotate effect of user expectation.
Description of drawings
The implementation method process flow diagram that Fig. 1 rotates for the picture based on DirectFB among the present invention.
Embodiment
Can only support the rotation of 90,180,270,360 degree to DirectFB engine in the conventional art; Can not realize the deficiency of arbitrarily angled rotation; The present invention proposes a kind of implementation method of rotating based on the picture of DirectFB, on the basis of original DirectFB, according to picture format and pixel storage principle; Use rotation matrix to calculate the postrotational coordinate position of pixel in the picture file one by one; Carry out pixel number according to moving in internal memory, thereby realize any rotary manipulation of picture, to reach the rotate effect of user expectation.
Referring to Fig. 1, the implementation method that the picture based on DirectFB among the present invention rotates may further comprise the steps:
1. resolve the storage format of picture format and pixel: different pictures has different header files, and the reference position of its valid pixel value is different; And the storage format of pixel also is diversified; Same pixel can be respectively represented with the internal storage location of different lengths such as 8,16,32; Even 8 pixel; Also be divided into different storage formats such as 5,5,6 and 5,6,5, therefore must analyze the storage format of picture format and pixel earlier, could guarantee to read correct pixel value;
2. the apex coordinate value of calculating postrotational picture according to the apex coordinate value and the rotation matrix of photo current: the picture of present common form; Like JPEG, BMP, PNG etc.; Its border must be one by two horizontal sides and two rectangular areas that vertical edges constitutes; Its apex coordinate has 4, i.e. the coordinate figure at four angles; After the picture rotation is arbitrarily angled; Its original border no longer level with vertical; For guarantee final picture border be level with vertical; So must construct a rectangle more postrotational picture is included, 4 rectangular areas that apex coordinate surrounded of this rectangle are exactly the zone that postrotational picture occupies, common rectangular area greater than original picture, this zone; And the concrete sizes values in this zone need obtain through the new apex coordinate value of calculating postrotational picture;
3. create postrotational image data buffer zone: go on foot by the 2nd and obtained postrotational picture size, will create picture buffer zone to deposit the pixel data value of this picture according to this size;
4. utilize the Lock function of DirectFB to lock said image data buffer zone: for the rotation of picture, the method that the individual element of employing is handled is in DirectFB; If want to single pixel operation, no matter read or write, all need at first lock whole picture buffer zone; So must carry out the Lock function, this is a key point of this algorithm, has only and carried out after the Lock operation; Could handle single pixel, could realize the function of this algorithm;
5. calculate each pixel at postrotational new coordinate figure: must calculate the new coordinate figure of postrotational pixel, just can put it to the tram of rotation back picture buffer zone;
6. this pixel is moved at postrotational new coordinate according to certain pixel that calculates: the operation of moving to pixel is the new coordinate place that this pixel is moved its correspondence of rotation back from former coordinate;
7. repeating step 6, the moving of all pixels in accomplishing picture: accomplished the moving of all pixels of picture, be the rotation that has realized this picture.
Claims (3)
1. the implementation method based on the picture rotation of DirectFB is characterized in that, may further comprise the steps:
A. resolve the storage format of picture format and pixel;
B. the apex coordinate value of calculating postrotational picture according to the apex coordinate value and the rotation matrix of photo current;
C. create postrotational image data buffer zone;
D. utilize the Lock function of DirectFB to lock said image data buffer zone;
E. calculate each pixel at postrotational new coordinate figure;
F. this pixel is moved at postrotational new coordinate according to certain pixel that calculates;
G. repeating step f, the moving of all pixels in accomplishing picture.
2. a kind of implementation method of rotating based on the picture of DirectFB as claimed in claim 1 is characterized in that, among the step b, also comprises: the size of calculating postrotational picture according to the apex coordinate value of postrotational picture.
3. a kind of implementation method of rotating based on the picture of DirectFB as claimed in claim 2 is characterized in that, among the step c, creates postrotational image data buffer zone according to the form and the size of postrotational picture.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110275023XA CN102446344A (en) | 2011-09-16 | 2011-09-16 | Direct FB (Frame Buffer) based method for realizing picture rotation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110275023XA CN102446344A (en) | 2011-09-16 | 2011-09-16 | Direct FB (Frame Buffer) based method for realizing picture rotation |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102446344A true CN102446344A (en) | 2012-05-09 |
Family
ID=46008825
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110275023XA Pending CN102446344A (en) | 2011-09-16 | 2011-09-16 | Direct FB (Frame Buffer) based method for realizing picture rotation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102446344A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105739874A (en) * | 2016-03-11 | 2016-07-06 | 沈阳聚德视频技术有限公司 | EDMA achieving method in image rotation based on DSP |
CN105786449A (en) * | 2014-12-26 | 2016-07-20 | 龙芯中科技术有限公司 | Instruction scheduling method and device based on graphic processing |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH11306341A (en) * | 1998-04-20 | 1999-11-05 | Nippon Telegr & Teleph Corp <Ntt> | Method and device for correcting binary picture |
CN1691069A (en) * | 2004-04-20 | 2005-11-02 | 香港中文大学 | Real-time volume drawing method for block-based fragment filtration with multi-GPU acceleration |
-
2011
- 2011-09-16 CN CN201110275023XA patent/CN102446344A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH11306341A (en) * | 1998-04-20 | 1999-11-05 | Nippon Telegr & Teleph Corp <Ntt> | Method and device for correcting binary picture |
CN1691069A (en) * | 2004-04-20 | 2005-11-02 | 香港中文大学 | Real-time volume drawing method for block-based fragment filtration with multi-GPU acceleration |
Non-Patent Citations (1)
Title |
---|
李筱琳等: "基于DSP的图像旋转算法数据调度策略", 《微电脑应用》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105786449A (en) * | 2014-12-26 | 2016-07-20 | 龙芯中科技术有限公司 | Instruction scheduling method and device based on graphic processing |
CN105786449B (en) * | 2014-12-26 | 2018-07-24 | 龙芯中科技术有限公司 | Instruction dispatching method based on graphics process and device |
CN105739874A (en) * | 2016-03-11 | 2016-07-06 | 沈阳聚德视频技术有限公司 | EDMA achieving method in image rotation based on DSP |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9786075B2 (en) | Image extraction and image-based rendering for manifolds of terrestrial and aerial visualizations | |
US20230053462A1 (en) | Image rendering method and apparatus, device, medium, and computer program product | |
US8571338B2 (en) | Image file generation device, image processing device, image file generation method, and image processing method | |
US9024947B2 (en) | Rendering and navigating photographic panoramas with depth information in a geographic information system | |
US8410993B2 (en) | Systems, methods, and devices for highly interactive large image display and manipulation on tiled displays | |
US9189884B2 (en) | Using video to encode assets for swivel/360-degree spinners | |
US11252300B2 (en) | Training and upscaling of large size image | |
US20120320073A1 (en) | Multiple Spatial Partitioning Algorithm Rendering Engine | |
CN107256207B (en) | Apparatus and method for generating 3D object | |
US20120313960A1 (en) | Image processing device, image data generation device, image processing method, image data generation method, and data structure of image file | |
CN106251392A (en) | For the method and apparatus performing to interweave | |
US20150228106A1 (en) | Low latency video texture mapping via tight integration of codec engine with 3d graphics engine | |
CN102999946B (en) | A kind of 3D Disposal Method about Graphics Data, device and equipment | |
CN1329870C (en) | Block-based rotation of arbitrary-shaped images | |
WO2010000126A1 (en) | Method and system for generating interactive information | |
EP2997547B1 (en) | Primitive-based composition | |
CN102436669A (en) | Two-dimensional vector map drawing method | |
Rodriguez et al. | Compression-domain seamless multiresolution visualization of gigantic triangle meshes on mobile devices | |
US20140368512A1 (en) | Systems, methods, and devices for animation on tiled displays | |
CN102446344A (en) | Direct FB (Frame Buffer) based method for realizing picture rotation | |
CN105204727B (en) | A kind of image presentation method and device | |
CN114616596A (en) | Free view video decoding | |
Yin et al. | Multi-screen Tiled Displayed, Parallel Rendering System for a Large Terrain Dataset. | |
WO2016107356A1 (en) | Static picture-based dynamic interaction method and device | |
US11657562B2 (en) | Utilizing hemispherical clamping for importance sampling of image-based light to render a virtual environment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20120509 |