CN108399603A - A kind of atwirl method and device of image - Google Patents

A kind of atwirl method and device of image Download PDF

Info

Publication number
CN108399603A
CN108399603A CN201710067843.7A CN201710067843A CN108399603A CN 108399603 A CN108399603 A CN 108399603A CN 201710067843 A CN201710067843 A CN 201710067843A CN 108399603 A CN108399603 A CN 108399603A
Authority
CN
China
Prior art keywords
image data
rotation
polar coordinates
postrotational
image
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.)
Granted
Application number
CN201710067843.7A
Other languages
Chinese (zh)
Other versions
CN108399603B (en
Inventor
施正
姚亮
黄睿欣
牟韵文
何展然
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Yaxon Networks Co Ltd
Original Assignee
Xiamen Yaxon Networks Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Xiamen Yaxon Networks Co Ltd filed Critical Xiamen Yaxon Networks Co Ltd
Priority to CN201710067843.7A priority Critical patent/CN108399603B/en
Publication of CN108399603A publication Critical patent/CN108399603A/en
Application granted granted Critical
Publication of CN108399603B publication Critical patent/CN108399603B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/60Rotation of whole images or parts thereof
    • G06T3/604Rotation of whole images or parts thereof using coordinate rotation digital computer [CORDIC] devices

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The present invention proposes a kind of atwirl method and device of image, by using graphics processor(GPU, Graphics Processing Unit)Multi-core parallel concurrent calculate replace central processing unit(CPU, Central Processing Unit)In data processing to image rotation, greatly increase the efficiency of rotation, and the statistics of operation use time is increased during calculating, enable calling program on different devices or with operation fluency is all ensured as far as possible under equipment different conditions, thus improves the using experience degree of client.

Description

A kind of atwirl method and device of image
Technical field
The present invention relates to Computer Image Processing fields, and in particular to a kind of atwirl method and device of image.
Background technology
It is more and more to be developed with the relevant software of map with the fast development of cell phone software.When we are making When making software relevant with map in mobile phone, rotation process inevitably is carried out to map, Rotation Algorithm is numerous, algorithm Complexity is different with result.It, can for the equipment of better performances if carrying out the rotation of map only with complicated algorithm Smooth operation completely, but for the poor equipment of performance or in the equipment of busy state, then when being rotated to map The case where will appear interim card.Therefore we need a kind of rotation side for capableing of high speed processing image rotation and adaptive equipment situation Case.
Invention content
The purpose of the present invention is to provide a kind of atwirl method and device of image, this method energy high speed processing images It rotates and being capable of adaptive equipment situation.
Concrete scheme is as follows:
A kind of atwirl method of image, including step:
Complete image data is converted into polar coordinates matrix using bilinear interpolation, obtains user's rotation angle and to pole by S10 Coordinate uses bilinear interpolation conversion polar coordinates to obtain the complete image data after rotation once into line displacement;
S20 exports postrotational complete image data;
S30, statistics execute the duration of step S10, and preset first threshold value repeats to hold if duration is less than preset first threshold Row step S10 to S20 until complete image data be finally completed with the matched rotation of user rotation angle institute, if duration is more than etc. In preset first threshold, S40 is thened follow the steps to S50;
The image data that the circumscribed circle range of screen data is included is converted into polar coordinates square by S40 using bilinear interpolation Battle array, wherein the image data that the circumscribed circle range of screen data is included is denoted as the first image data, removes the external of screen data Image data except the image data that circle range is included is denoted as the second image data, obtains user's rotation angle and is sat to pole It marks into line displacement, uses bilinear interpolation conversion polar coordinates to obtain the first image data after rotation once, output first Image data;It repeats the above process until the first image data is finally completed and the matched rotation of user's rotation angle;
Second image data is converted into polar coordinates matrix by S50 when user terminates image rotation using bilinear interpolation, It obtains user's rotation angle final after S40 and to polar coordinates into line displacement, is sat using bilinear interpolation conversion pole It is marked with to obtain final postrotational second image data, it will final postrotational second image data and final postrotational first Image data is combined, and forms postrotational complete image data for follow-up other calculating.
Further, the step S30 is replaced with into S30 ', and further includes step S60 and S70, wherein:
S30 ', statistics execute the duration of step S10, preset first threshold value and second threshold, if duration is less than preset first threshold Value, then repeat step S10 to S20 until complete image data be finally completed with the matched rotation of user rotation angle institute, If duration be more than or equal to preset first threshold and be less than preset second threshold, then follow the steps S40 to S50, if when grow up In equal to preset second threshold, S60 is thened follow the steps to S70;
First image data is converted into polar coordinates matrix using closest interpolation method, obtains user's rotation angle and to pole by S60 Coordinate uses closest interpolation method conversion polar coordinates to obtain the first image data after rotation once, output rotation into line displacement The first image data after turning;Repeat the above process until the first image data be finally completed it is matched with user rotation angle institute Rotation, and during last time repeats, after using bilinear interpolation to convert polar coordinates to obtain rotating for the last time The first image data and export;
Second image data is converted into polar coordinates matrix by S70 when user terminates image rotation using bilinear interpolation, It obtains user's rotation angle and to polar coordinates into line displacement, is directly obtained using bilinear interpolation conversion polar coordinates postrotational Final postrotational second image data is combined with final postrotational first image data, forms by the second image data Postrotational complete image data is for follow-up other calculating.
Further, further include:Step S00 obtains complete image data.
A kind of device, including:
Processor and memory;
The memory is for storing program;
The processor is used to execute the program in the memory so that it is atwirl that described device executes above-mentioned image Method.
Further, described program includes the first program and the second program,
The processor includes central processing unit and graphics processor,
The central processing unit is for executing first program so that described device executes the atwirl side of above-mentioned image Step S00 in method;
The graphics processor is for executing second program so that described device executes the atwirl side of above-mentioned image Method.
Advantageous effect of the present invention:By using graphics processor(GPU, Graphics Processing Unit)Multinuclear Parallel computation replaces central processing unit(CPU, Central Processing Unit)In data processing to image rotation, greatly The earth improves the efficiency of rotation, and the statistics of operation use time is increased during calculating so that program can be not With equipment on or with operation fluency is all ensured under equipment different conditions as far as possible, that thus improves client uses body Degree of testing.
Description of the drawings
Fig. 1 is one embodiment of the invention method flow diagram.
Specific implementation mode
To further illustrate that each embodiment, the present invention are provided with attached drawing.These attached drawings are that the invention discloses one of content Point, mainly to illustrate embodiment, and the associated description of specification can be coordinated to explain the operation principles of embodiment.Cooperation ginseng These contents are examined, those of ordinary skill in the art will be understood that other possible embodiments and advantages of the present invention.Now tie Closing the drawings and specific embodiments, the present invention is further described.
Embodiment 1 is a kind of atwirl method of image, including step:
Complete image data is converted into polar coordinates matrix using bilinear interpolation, obtains user's rotation angle and to pole by S10 Coordinate uses bilinear interpolation conversion polar coordinates to obtain the complete image data after rotation once into line displacement;
S20 exports postrotational complete image data;
S30, statistics execute the duration of step S10, and preset first threshold value repeats to hold if duration is less than preset first threshold Row step S10 to S20 until complete image data be finally completed with the matched rotation of user rotation angle institute, if duration is more than etc. In preset first threshold, S40 is thened follow the steps to S50;
The image data that the circumscribed circle range of screen data is included is converted into polar coordinates square by S40 using bilinear interpolation Battle array, wherein the image data that the circumscribed circle range of screen data is included is denoted as the first image data, removes the external of screen data Image data except the image data that circle range is included is denoted as the second image data, obtains user's rotation angle and is sat to pole It marks into line displacement, uses bilinear interpolation conversion polar coordinates to obtain the first image data after rotation once, output first Image data;It repeats the above process until the first image data is finally completed and the matched rotation of user's rotation angle;
Second image data is converted into polar coordinates matrix by S50 when user terminates image rotation using bilinear interpolation, It obtains user's rotation angle and to polar coordinates into line displacement, is directly obtained using bilinear interpolation conversion polar coordinates postrotational Final postrotational second image data is combined with final postrotational first image data, forms by the second image data Postrotational complete image data is for follow-up other calculating.
Embodiment 2
On the basis of embodiment 1, change step S30 is S30 ' and further includes step S60 and S70 embodiment 2, wherein:
S30 ', statistics execute the duration of step S10, preset first threshold value and second threshold, if duration is less than preset first threshold Value, then repeat step S10 to S20 until complete image data be finally completed with the matched rotation of user rotation angle institute, If duration be more than or equal to preset first threshold and be less than preset second threshold, then follow the steps S40 to S50, if when grow up In equal to preset second threshold, S60 is thened follow the steps to S70;
First image data is converted into polar coordinates matrix using closest interpolation method, obtains user's rotation angle and to pole by S60 Coordinate uses closest interpolation method conversion polar coordinates to obtain the first image data after rotation once, output rotation into line displacement The first image data after turning;Repeat the above process until the first image data be finally completed it is matched with user rotation angle institute Rotation, and during last time repeats, after using bilinear interpolation to convert polar coordinates to obtain rotating for the last time The first image data and export;
Second image data is converted into polar coordinates matrix by S70 when user terminates image rotation using bilinear interpolation, It obtains user's rotation angle and to polar coordinates into line displacement, is directly obtained using bilinear interpolation conversion polar coordinates postrotational Final postrotational second image data is combined with final postrotational first image data, forms by the second image data Postrotational complete image data is for follow-up other calculating.
Next the method for embodiment 2 is illustrated in conjunction with another 3 device of embodiment, in example, with map datum Rotation is shown, it is appreciated that image data includes but not limited to map datum, the device of the present embodiment 3 contains center Three processor, memory, video card units.The wherein GPU of video card is formant, at least needs to support openCL2.0 or more Or the multi-thread programming ability of CUDA, main data computing function are realized in GPU, GPU program carries out the used time of processing Statistics, and different rotation strategies is used by the difference of processing time.Memory is for storing program, and program is obtaining The data of map and the rotation calculating for completing map datum.Central processing unit is auxiliary unit, is mainly used to obtain the number of map Operational order is sent out according to and to GPU.In 4 device of other embodiment, including central processing unit and memory, memory storage Program executes method of the program of memory to complete embodiment 1 and embodiment 2 by central processing unit
From the point of view of hardware aspect, it is contemplated that the multi-core processor of GPU has discrete type, the progress parallel computation of orthogonal data Natural advantage, and current GPU general-purpose computations technology relative maturity.We will when carrying out the calculating of map datum CPU processor is replaced to carry out the operation of data using GPU processors, can not only reduce the utilization rate of CPU can also improve number According to calculating speed.
From the point of view of the Rotation Algorithm of image, the mode of image rotation is numerous at present, each spinning solution has its respective The rate of feature, the effect and rotation that in general rotate is inversely proportional.So we should be to the equipment of different hardware using not With algorithm carry out the processing of data.It is understood that the rotation for carrying out image with polar coordinates is a kind of common mode, pole is sat Mark in the rotation of map with there is special effect, because continuously to export display to the rotation of map.It is revolved with polar coordinates It only needs offset polar coordinates matrix that can complete the rotation of image during turning, is deviated by the parallel computation of GPU Time complexity is O (1).The image rotation used time in GPU is counted, two time thresholds t1 and t2 are set(t1<t2), when Using the distributed rotation processing for carrying out image when used time is more than t1 and is less than t2, we change polar coordinates rotation when more than t2 When interpolation algorithm, with achieve the effect that reduce operation delay.As shown in Figure 1, the flow chart of the method for the present invention, flow is such as Under:
1, program is opened, the data in map are obtained.
2, the data in map are imported into GPU cachings.
3, map is switched to by polar coordinates matrix using bilinear interpolation in GPU.
4, the rotation angle of user is obtained.
5, in GPU to polar coordinates into line displacement, deviate a pixel every time.
6, the polar coordinates matrix after deviating converts back cartesian coordinate matrix using bilinear interpolation, obtains postrotational Cartographic information.
7, postrotational cartographic information is exported, step 5 is returned to and is rotated until completing.
8, timing is carried out to step 3- steps 6, exceed schedule time t1, and the circumscribed circle with regard to screen printing data is included Data(It is denoted as A)Rotated, after user stops rotating again to A except data B calculate.
9, if it exceeds the fitting algorithm in rotary course, is just changed to closest to differential technique by stipulated time t2.
9.1, the fitting for first carrying out a bilinearity difference arithmetic to A after user stops rotating exports after having been calculated To screen.Then again to data B into using bilinearity difference arithmetic to calculate.
In other one embodiment, method is only set there are one stipulated time t1, and do not include step 9 and 9.1。
It is in GPU the specific implementation process is as follows:
Also having the arithmetic between a large amount of image, this part in whole flow process is very suitable for using at parallel method Reason, because being all the operation between pixel.For this part, realized using the method for thread parallel.Thread number in GPU (id) it is total Thread Count (b) in thread block by thread block number (a), thread 3 part of thread number (c) composition in the block.So will There are id=a × b+c, wherein the value range of id is exactly from 0 to total Thread Count.Set total Thread Count to the pixel of image Value, then each pixel in image is just assigned with a thread, as long as per thread has executed an arithmetic, then right The operation of one entire image is also just completed.
The first step copies to data in GPU video memorys from CPU memories.
Memory headroom in second step, application GPU needed for polar coordinates.
Third step starts timing.
4th step, the total Thread Counts of GPU are defined as the pixel value of polar coordinates matrix, and each of polar coordinates matrix point is distributed To a thread, polar conversion is carried out using bilinear interpolation.
5th step, when image shift, create a matrix, the total Thread Counts of GPU are defined as the pixel of new matrix Value, a thread is allocated to by each of new matrix point.
6th step, the assignment that different initial position progress corresponding points are selected according to the difference of offset.
7th step, setting synchronize, and calculating of the polar coordinates to rectangular coordinate system is carried out using bilinear interpolation.
8th step terminates timing.
9th step outputs image to CPU for showing.
The 6th step to the 9th step is repeated, until completing to rotate.
Statistic procedure three arrives the time t of step 8, judges the relationship with threshold value t1, t2.
Work as t1<t<It is made an amendment since second step when t2,
Second step:The data that screen printing size circumscribed circle is included in the caching of GPU, are denoted as A.
Third walks:The total Thread Counts of GPU are defined as the pixel value of polar coordinates matrix corresponding to A, and A is passed through bilinear interpolation Method switchs to polar coordinates matrix, is denoted as A '.
4th step:Thread is distributed, to A ' into line displacement.
5th step:A ' after offset bilinearity differential techniques are switched into rectangular co-ordinate matrix, output is shown to CPU.
The 4th step and the 5th step are repeated, until completing to rotate.
6th step:By the region other than A after user's rotation(It is denoted as B)It is rotated again.
Work as t>When=t2
Second step:The data that screen printing size circumscribed circle is included in the caching of GPU, are denoted as A.
Third walks:The total Thread Counts of GPU are defined as the pixel value of polar coordinates matrix corresponding to A, and A is passed through closest interpolation Method switchs to polar coordinates matrix, is denoted as A '.
4th step:Thread is distributed, to A ' into line displacement.
5th step:The closest interpolation methods of A ' after offset are switched into rectangular co-ordinate matrix, output is shown to CPU.
The 4th step and the 5th step are repeated, until completing to rotate.
6th step:Rectangular co-ordinate matrix is switched to final A ' bilinear interpolations, obtains preferable rotated image, Output display.
7th:By the region other than A(It is denoted as B)It is rotated again.
Although specifically showing and describing the present invention in conjunction with preferred embodiment, those skilled in the art should be bright In vain, it is not departing from the spirit and scope of the present invention defined by the appended claims, it in the form and details can be right The present invention makes a variety of changes, and is protection scope of the present invention.

Claims (5)

1. a kind of atwirl method of image, which is characterized in that including step:
Complete image data is converted into polar coordinates matrix using bilinear interpolation, obtains user's rotation angle and to pole by S10 Coordinate uses bilinear interpolation conversion polar coordinates to obtain the complete image data after rotation once into line displacement;
S20 exports postrotational complete image data;
S30, statistics execute the duration of step S10, and preset first threshold value repeats to hold if duration is less than preset first threshold Row step S10 to S20 until complete image data be finally completed with the matched rotation of user rotation angle institute, if duration is more than etc. In preset first threshold, S40 is thened follow the steps to S50;
The image data that the circumscribed circle range of screen data is included is converted into polar coordinates square by S40 using bilinear interpolation Battle array, wherein the image data that the circumscribed circle range of screen data is included is denoted as the first image data, removes the external of screen data Image data except the image data that circle range is included is denoted as the second image data, obtains user's rotation angle and is sat to pole It marks into line displacement, uses bilinear interpolation conversion polar coordinates to obtain the first image data after rotation once, output first Image data;It repeats the above process until the first image data is finally completed and the matched rotation of user's rotation angle;
Second image data is converted into polar coordinates matrix by S50 when user terminates image rotation using bilinear interpolation, It obtains user's rotation angle final after S40 and to polar coordinates into line displacement, is sat using bilinear interpolation conversion pole It is marked with to obtain final postrotational second image data, it will final postrotational second image data and final postrotational first Image data is combined, and forms postrotational complete image data for follow-up other calculating.
2. the atwirl method of image according to claim 1, which is characterized in that replace with the step S30 S30 ', and further include step S60 and S70, wherein:
S30 ', statistics execute the duration of step S10, preset first threshold value and second threshold, if duration is less than preset first threshold Value, then repeat step S10 to S20 until complete image data be finally completed with the matched rotation of user rotation angle institute, If duration be more than or equal to preset first threshold and be less than preset second threshold, then follow the steps S40 to S50, if when grow up In equal to preset second threshold, S60 is thened follow the steps to S70;
First image data is converted into polar coordinates matrix using closest interpolation method, obtains user's rotation angle and to pole by S60 Coordinate uses closest interpolation method conversion polar coordinates to obtain the first image data after rotation once, output rotation into line displacement The first image data after turning;Repeat the above process until the first image data be finally completed it is matched with user rotation angle institute Rotation, and during last time repeats, after using bilinear interpolation to convert polar coordinates to obtain rotating for the last time The first image data and export;
Second image data is converted into polar coordinates matrix by S70 when user terminates image rotation using bilinear interpolation, It obtains user's rotation angle and to polar coordinates into line displacement, is directly obtained using bilinear interpolation conversion polar coordinates postrotational Final postrotational second image data is combined with final postrotational first image data, forms by the second image data Postrotational complete image data is for follow-up other calculating.
3. the atwirl method of image according to claim 1 or 2, which is characterized in that further include:Step S00 is obtained Complete image data.
4. a kind of device, which is characterized in that including:
Processor and memory;
The memory is for storing program;
The processor is used to execute the program in the memory so that it is any that described device executes the claims 1 to 3 The atwirl method of the image.
5. a kind of device according to claim 4, which is characterized in that described program includes the first program and the second journey Sequence, the processor include central processing unit and graphics processor,
The central processing unit is for executing first program so that described device executes the figure described in the claims 3 As the step S00 in atwirl method;
The graphics processor is for executing second program so that described device executes described in the claims 1 or 2 The atwirl method of image.
CN201710067843.7A 2017-02-07 2017-02-07 Method and device for rapidly rotating image Active CN108399603B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710067843.7A CN108399603B (en) 2017-02-07 2017-02-07 Method and device for rapidly rotating image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710067843.7A CN108399603B (en) 2017-02-07 2017-02-07 Method and device for rapidly rotating image

Publications (2)

Publication Number Publication Date
CN108399603A true CN108399603A (en) 2018-08-14
CN108399603B CN108399603B (en) 2022-12-06

Family

ID=63093668

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710067843.7A Active CN108399603B (en) 2017-02-07 2017-02-07 Method and device for rapidly rotating image

Country Status (1)

Country Link
CN (1) CN108399603B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1759812A (en) * 2004-05-27 2006-04-19 阿洛卡株式会社 Ultrasonic diagnostic equipment and image processing method
CN103295019A (en) * 2013-05-21 2013-09-11 西安理工大学 Self-adaptive Chinese fragment restoration method based on probability statistics
US20160063713A1 (en) * 2014-09-03 2016-03-03 Ricoh Company, Ltd. Information terminal apparatus, information processing method, and system
CN105450908A (en) * 2015-12-02 2016-03-30 厦门雅迅网络股份有限公司 Method and device for removing black edge from video image

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1759812A (en) * 2004-05-27 2006-04-19 阿洛卡株式会社 Ultrasonic diagnostic equipment and image processing method
CN103295019A (en) * 2013-05-21 2013-09-11 西安理工大学 Self-adaptive Chinese fragment restoration method based on probability statistics
US20160063713A1 (en) * 2014-09-03 2016-03-03 Ricoh Company, Ltd. Information terminal apparatus, information processing method, and system
CN105450908A (en) * 2015-12-02 2016-03-30 厦门雅迅网络股份有限公司 Method and device for removing black edge from video image

Also Published As

Publication number Publication date
CN108399603B (en) 2022-12-06

Similar Documents

Publication Publication Date Title
JP5020393B2 (en) Processing equipment
CN103077088B (en) Based on the dynamic feedback of load equalization methods of PKDT tree in Cluster Rendering environment
CN105487848B (en) A kind of the display method for refreshing and system of 3D application
CN106056529A (en) Method and equipment for training convolutional neural network used for image recognition
CN103167218A (en) Super-resolution reconstruction method and equipment based on non-locality
CN102044062B (en) System for realizing mirroring in x axis and y axis and 180-degree rotation of image based on image block processing
CN110246081B (en) Image splicing method and device and readable storage medium
CN108416843A (en) Three-dimensional scene construction method, device, equipment and computer readable storage medium
CN111985597B (en) Model compression method and device
JPH0737082A (en) Method and device for rotating multilevel picture 90 degrees
US20220207109A1 (en) Convolution method, electronic device, and computer-readable storage medium
DE102020108526A1 (en) ADAPTIVE PIXEL SCAN ORDER FOR DENSE RENDERING
CN102622723A (en) Image interpolation based on CUDA (compute unified device architecture) and edge detection
CN105023234A (en) Figure acceleration method based on storage optimization of embedded system
CN112700516A (en) Video rendering method and device based on deep learning, computer equipment and storage medium
CN115375815A (en) Shadow rendering method and device, electronic equipment and storage medium
CN106204418A (en) Image warping method based on matrix inversion operation in a kind of virtual reality mobile terminal
CN106355545B (en) A kind of processing method and processing device of digital picture geometric transformation
CN110472588A (en) Anchor point frame determines method, apparatus, computer equipment and storage medium
CN108399603A (en) A kind of atwirl method and device of image
CN108446455A (en) A kind of multiple target Method for HW/SW partitioning based on fireworks algorithm
CN116312412A (en) Bicubic interpolation circuit based on FPGA
CN101452572B (en) Image rotating VLSI structure based on cubic translation algorithm
CN107146193A (en) A kind of GPU parallel calculating methods based on double video cards applied to image procossing
CN109410302B (en) Texture mapping method, texture mapping device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant