CN110033406A - Method and apparatus for handling image - Google Patents
Method and apparatus for handling image Download PDFInfo
- Publication number
- CN110033406A CN110033406A CN201910289762.0A CN201910289762A CN110033406A CN 110033406 A CN110033406 A CN 110033406A CN 201910289762 A CN201910289762 A CN 201910289762A CN 110033406 A CN110033406 A CN 110033406A
- Authority
- CN
- China
- Prior art keywords
- image processing
- processing function
- computing architecture
- target
- target computing
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/20—Processor architectures; Processor configuration, e.g. pipelining
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2200/00—Indexing scheme for image data processing or generation, in general
- G06T2200/28—Indexing scheme for image data processing or generation, in general involving image processing hardware
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Stored Programmes (AREA)
Abstract
The embodiment of the present application discloses the method and apparatus for handling image.One specific embodiment of this method comprises determining whether there is the graphics processor GPU for supporting target computing architecture;Indexed variable is updated based on definitive result;In response to receiving image sequence, described image sequence is handled based on the image processing function in the indexed variable invocation target image processing function library.The embodiment accelerates the image processing function in target image processing function library using target computing architecture, to improve the efficiency of image procossing.
Description
Technical field
The invention relates to field of computer technology, and in particular to the method and apparatus for handling image.
Background technique
Image procossing is to be analyzed with computer image, to reach the technology of required result.Also known as image processing.Figure
As processing refers generally to Digital Image Processing.Digital picture refers to equipment such as industrial camera, video camera, scanners by shooting
The big two-dimensional array arrived, the element of the array are known as pixel.Common method include: image transformation, image compression,
Image enhancement and recovery, image segmentation, iamge description, image classification.
Currently, image procossing mainly goes to realize some rudimentary algorithms in image procossing, packet with the function in OpenCV
Including color conversion is gray scale, morphological operation, threshold binarization, edge extracting etc..In order to consider the platform compatibility of OpenCV,
Current image processing algorithm still still executes on CPU.
Summary of the invention
The embodiment of the present application proposes the method and apparatus for handling image.
In a first aspect, the embodiment of the present application provides a kind of method for handling image, comprising: determine whether there is branch
Hold the graphics processor GPU of target computing architecture;Indexed variable is updated based on definitive result;In response to receiving image sequence,
Image sequence is handled based on the image processing function in indexed variable invocation target image processing function library.
In some embodiments, indexed variable is updated based on definitive result, comprising: support target computing architecture if it exists
Indexed variable is updated to the information that the image processing function accelerated is called in instruction by GPU;And it is marked on a map based on indexed variable calling
As the image processing function in processing function library handles image sequence, comprising: in invocation target image processing function library
Target computing architecture accelerate image processing function image sequence is handled.
In some embodiments, before updating indexed variable based on definitive result, further includes: support target meter if it exists
The GPU for calculating framework, the image processing function for calling the target computing architecture in a target image processing function library to accelerate.
In some embodiments, indexed variable is updated based on definitive result, comprising: support target computing architecture if it does not exist
GPU, indexed variable is updated to the information that unaccelerated image processing function is called in instruction;And it is called based on indexed variable
Image processing function in target image processing function library handles image sequence, comprising: invocation target image procossing letter
Unaccelerated image processing function in number library handles image sequence.
In some embodiments, it is determined whether there is the graphics process for supporting unified calculation equipment framework target computing architecture
Device GPU, comprising: the acquisition target computing architecture in invocation target image processing function library enables unit count function, is propped up
Hold the quantity of the GPU of target computing architecture.
In some embodiments, if target image processing function library compiling when do not enable target computing architecture support or not
In the presence of the GPU for supporting target computing architecture, then support that the quantity of the GPU of target computing architecture is zero.
In some embodiments, this method further include: when the cross-platform compilation tool Cmake of utilization recompilates target figure
When the source code of picture processing function library, the compiling option of target computing architecture is supported in addition in command line parameter.
In some embodiments, target computing architecture includes unified calculation equipment framework CUDA, and target image handles function
Library includes open source computer vision library OpenCV or open computational language OpenCL.
Second aspect, the embodiment of the present application provide a kind of for handling the device of image, comprising: determination unit is matched
It is set to the graphics processor GPU for determining whether there is and supporting target computing architecture;Updating unit is configured to based on definitive result
Update indexed variable;Processing unit is configured in response to receive image sequence, based at indexed variable invocation target image
Image processing function in reason function library handles image sequence.
In some embodiments, updating unit is further configured to: the GPU of target computing architecture is supported if it exists, it will
Indexed variable is updated to the information that the image processing function accelerated is called in instruction;And processing unit is further configured to: being adjusted
Image sequence is handled with the image processing function that the target computing architecture in target image processing function library accelerates.
In some embodiments, device further include: call unit is configured to support target computing architecture if it exists
GPU, the image processing function for calling the target computing architecture in a target image processing function library to accelerate.
In some embodiments, updating unit is further configured to: the GPU of target computing architecture is supported if it does not exist,
Indexed variable is updated to the information that unaccelerated image processing function is called in instruction;And processing unit is further configured
At: the unaccelerated image processing function in invocation target image processing function library handles image sequence.
In some embodiments, determination unit is further configured to: the acquisition in invocation target image processing function library
Target computing architecture enables unit count function, obtains the quantity for supporting the GPU of target computing architecture.
In some embodiments, if target image processing function library compiling when do not enable target computing architecture support or not
In the presence of the GPU for supporting target computing architecture, then support that the quantity of the GPU of target computing architecture is zero.
In some embodiments, device further include: adding unit, being configured to ought be using cross-platform compilation tool
When Cmake recompilates the source code of target image processing function library, target computing architecture is supported in addition in command line parameter
Compile option.
In some embodiments, target computing architecture includes unified calculation equipment framework CUDA, and target image handles function
Library includes open source computer vision library OpenCV or open computational language OpenCL.
The third aspect, the embodiment of the present application provide a kind of server, which includes: one or more processors;
Storage device is stored thereon with one or more programs;When one or more programs are executed by one or more processors, so that
One or more processors realize the method as described in implementation any in first aspect.
Fourth aspect, the embodiment of the present application provide a kind of computer-readable medium, are stored thereon with computer program, should
The method as described in implementation any in first aspect is realized when computer program is executed by processor.
Method and apparatus provided by the embodiments of the present application for handling image, it is first determined with the presence or absence of support target meter
The GPU of framework is calculated, to obtain definitive result;It is then based on definitive result and updates indexed variable;Finally receiving image sequence
In the case where, based on the image processing function in indexed variable invocation target image processing function library to image sequence at
Reason.Accelerate the image processing function in target image processing function library using target computing architecture, to improve image procossing
Efficiency.Also, image processing function executes on GPU, greatly reduces the occupancy of CPU.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other
Feature, objects and advantages will become more apparent upon:
Fig. 1 is that this application can be applied to exemplary system architectures therein;
Fig. 2 is the flow chart according to one embodiment of the method for handling image of the application;
Fig. 3 is the flow chart according to another embodiment of the method for handling image of the application;
Fig. 4 is the structural schematic diagram according to one embodiment of the device for handling image of the application;
Fig. 5 is adapted for the structural schematic diagram for the computer system for realizing the server of the embodiment of the present application.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can be using the method for handling image of the application or the implementation of the device for handling image
The exemplary system architecture 100 of example.
As shown in Figure 1, may include terminal device 101, network 102 and server 103 in system architecture 100.Network 102
To provide the medium of communication link between terminal device 101 and server 103.Network 102 may include various connection classes
Type, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 101 and be interacted by network 102 with server 103, to receive or send message etc..
Various client softwares, such as image processing class application etc. can be installed on terminal device 101.
Terminal device 101 can be hardware, be also possible to software.When terminal device 101 is hardware, support figure can be
As the various electronic equipments of acquisition function.Including but not limited to camera, video camera, camera, smart phone and tablet computer
Etc..When terminal device 101 is software, may be mounted in above-mentioned electronic equipment.Multiple softwares or soft may be implemented into it
Single software or software module also may be implemented into part module.It is not specifically limited herein.
Server 103 can be to provide the server of various services.Such as image processing server.Image processing server
The data such as the image sequence got can be carried out analyzing etc. with processing, generate processing result (such as treated image sequence
Column).
It should be noted that server 103 can be hardware, it is also possible to software.It, can when server 103 is hardware
To be implemented as the distributed server cluster that multiple servers form, individual server also may be implemented into.When server 103 is
When software, multiple softwares or software module (such as providing Distributed Services) may be implemented into, also may be implemented into single
Software or software module.It is not specifically limited herein.
It should be noted that the method provided by the embodiment of the present application for handling image is generally held by server 103
Row, correspondingly, the device for handling image is generally positioned in server 103.
It should be understood that the number of terminal device, network and server in Fig. 1 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
With continued reference to Fig. 2, it illustrates the processes according to one embodiment of the method for handling image of the application
200.The method for being used to handle image, comprising the following steps:
Step 201, it is determined whether there is the GPU for supporting target computing architecture.
It in the present embodiment, can be with for handling the executing subject (such as server 103 shown in FIG. 1) of the method for image
The GPU (GraphicsProcessing Unit, graphics processor) for supporting target computing architecture is determined whether there is, to obtain
Definitive result.Wherein it is determined that as a result can serve to indicate that with the presence or absence of the GPU for supporting target computing architecture.
Wherein, target computing architecture may include preassigned computing architecture.For example, target computing architecture may include
CUDA (Compute Unified Device Architecture unifiedly calculates equipment framework).CUDA is that video card manufacturer releases
Operation platform, be a kind of universal parallel computing architecture, which makes GPU be able to solve complicated computational problem.It is contained
Parallel computation engine inside CUDA instruction set architecture (ISA) and GPU.Developer can be used now C language come for
CUDA writes program, and C language is a kind of most widely used high-level programming language.The program write out can support CUDA
Processor on run with very-high performance.GPU also known as shows core, vision processor, display chip, is one kind specially a
Micro- place that image operation works in people's computer, work station, game machine and some mobile devices (such as tablet computer, smart phone)
Manage device.
In some optional implementations of the present embodiment, above-mentioned executing subject can be with invocation target image processing function
Acquisition target computing architecture in library enables unit count function, obtains the quantity for supporting the GPU of target computing architecture.Wherein,
It may include preassigned image processing function library that target image, which handles function library,.For example, target image processing function library can
To include OpenCV (Open Source Computer Vision Library, computer vision library of increasing income) or OpenCL
(Open Computing Language, open computational language).
Wherein, OpenCV is the cross-platform computer vision library based on BSD license (open source) distribution, be may operate in
In Linux, Windows, Android and Mac OS operating system.Its lightweight and efficiently --- by a series of C functions and few
It measures C++ class to constitute, while providing the interface of the language such as Python, Ruby, MATLAB, realize image procossing and computer view
Feel many general-purpose algorithms of aspect.It can be at this point, the acquisition CUDA in OpenCV enables unit count function
getCudaEnabledDeviceCount.Specifically, if OpenCV does not enable CUDA support, above-mentioned executing subject when compiling
GetCudaEnabledDeviceCount function is called, the quantity of the GPU of obtained support CUDA is zero.If OpenCV is compiled
Shi Qiyong CUDA supports that above-mentioned executing subject calls getCudaEnabledDeviceCount function, obtained support CUDA's
The quantity of GPU.It is supported it should be noted that if enabling CUDA when OpenCV is compiled, but is not installed in system and support that CUDA's is aobvious
Card, still there is no the GPU for supporting CUDA, call getCudaEnabledDeviceCount function, obtained support at this time
The quantity of the GPU of CUDA is still zero.
Wherein, OpenCL is first open, free standard towards the general purpose multiple programming of heterogeneous system, and
One unified programmed environment is high performance computing service device, desktop computing system, handheld device volume convenient for software developer
The code of high-efficient light is write, and is widely used in multi-core processor (CPU), graphics processor (GPU), Cell type architecture
And other parallel processors such as digital signal processor (DSP).
In general, above-mentioned executing subject can be enabled when target image handles function library compiling before executing step 201
Target computing architecture is supported.Specifically, when using Cmake (crossplatform make, cross-platform compilation tool) again
When compiling the source code of target image processing function library, above-mentioned executing subject can add in command line parameter supports target to calculate
The compiling option of framework.
In some optional implementations of the present embodiment, when target image processing function library is OpenCV, compile
Translating option may include:
"-D WITH_CUDA=ON
- D CUDA_ARCH_PTX=" "
- D CUDA_FAST_MATH=ON
- D WITH_CUBLAS=ON
- D WITH_NVCUVID=ON ".
Wherein, WITH_CUDA option can be used for designating whether enabling CUDA and support, value is that ON indicates to enable,
Value is that OFF expression does not enable.Also, when its value is OFF, the generation of CUDA parallel processing image data is used in OpenCV
Code will not be compiled.
CUDA_ARCH_PTX option can be used for specified PTX, and (Parallel ThreadeXecution, parallel thread are held
Row) code building correspondence library file, it is corresponding with video card computing capability.PTX code is in one kind of the GPU code after compiling
Between form, it can be compiled as primary GPU microcode again.CUDA compiler generates different according to different video card computing capabilitys
Code, do not specify its value herein, indicate the computing capability for allowing CUDA compiler to detect current video card automatically.
CUDA_FAST_MATH option can be used for designating whether using the quick number in CUDA Toolkit (kit)
Library is calculated in student movement, indicates to use when value is ON.The function that can be provided in fast math operation library exclusively for speed-optimization connects
Mouthful, generally realized using assembler language.
WITH_CUBLAS option can be used for linear algebra relevant calculation involved in specified OpenCV code code whether
The interface provided using the library cuBLAS indicates to use when value is ON.CuBLAS, which can be, to be realized when being run using CUDA
A set of BLAS (BasicLinear Algebra Subprograms, basic linear algebra subprogram) library is come by using GPU
Accelerate to calculate.At present the library BLAS of mainstream can include but is not limited to ATLAS BLAS, OpenBLAS, cuBLAS, clBLAS,
BLIS etc..
WITH_NVCUVID option can be used for whether the decoded code of video involved in specified OpenCV code uses
The interface that the library NVCUVID provides indicates to use when value is ON.NVCUVID is a set of use GPU hardware accelerating decoding of video
Function library.
Step 202, indexed variable is updated based on definitive result.
In the present embodiment, above-mentioned executing subject can update indexed variable based on definitive result.Wherein, indexed variable can
To be that the image processing function of acceleration or the information of unaccelerated image processing function are called in instruction.For example, the value of indexed variable
It can be updated to 0 or 1.The GPU of target computing architecture is supported if it exists, and above-mentioned executing subject can be by the value of indexed variable more
New is 1, and the image processing function accelerated is called in instruction at this time.The GPU of target computing architecture, above-mentioned execution master are supported if it does not exist
The value of indexed variable can be updated to 0 by body, and unaccelerated image processing function is called in instruction at this time.
Step 203, in response to receiving image sequence, based on the figure in indexed variable invocation target image processing function library
As processing function handles image sequence.
In the present embodiment, it supports the terminal device of image collecting function that can acquire image sequence, and sends supreme state
Executing subject.In the case where receiving image sequence, above-mentioned executing subject can first determine whether the value of indexed variable, then base
Image processing function in the value invocation target image processing function library of indexed variable handles image sequence.Wherein,
Image processing function in target image processing function library may include the image processing function and not that target computing architecture accelerates
The image processing function of acceleration.For example, the image processing function accelerated is called in instruction if the value of indexed variable is 1, then mesh is called
Logo image handles the image processing function that the target computing architecture in function library accelerates.If the value of indexed variable is 0, instruction is called
Unaccelerated image processing function, the then unaccelerated image processing function in invocation target image processing function library.
In general, image sequence may include the one group of image shot under any scene.For example, in automatic Pilot scene
Under, since autonomous driving vehicle needs to combine artificial intelligence, view by sensor (radar, camera, laser ranging, GPS etc.)
Feel calculating, monitoring device etc., allows computer system that can operate motor vehicles by automatic safe in the case where no human intervention.
Therefore, image sequence can be one group of image of the camera shooting of autonomous driving vehicle.
In practice, processing image mainly goes to realize some rudimentary algorithms in image procossing with the function in OpenCV,
It is gray scale, morphological operation, threshold binarization, edge extracting etc. including color conversion.If enabling CUDA in OpenCV compiling
It supports, then these image processing functions can be accelerated by CUDA.
By taking the image scaling during image converts as an example, wherein the primary function used is resize (), function prototype are as follows:
Void cv::resize (InputArray src, OutputArray dst, Size dsize, double fx=
0, double fy=0, int interpolation=INTER_LINEAR).
Wherein, cv can indicate the NameSpace that OpenCV is defined.InputArray belongs to input parameter, and src indicates defeated
The image entered, that is, image to be scaled.OutputArray belongs to output parameter, and dst indicates the image of output, that is, after scaling
Image.Size indicates the size of output parameter, and dsize indicates the size of the image of output.The pantograph ratio of fx expression x-axis direction
Example.The scaling in fy expression y-axis direction.For Interpolation for specifying interpolation algorithm, default is INTER_LINEAR
(linear interpolation), there are commonly INTER_NEAREST (closest to interpolation algorithm), INTER_CUBIC (bi-cubic interpolation algorithm),
INTER_AREA (REGION INTERPOLATION algorithm), INTER_LANCZOS4 (Lanczos interpolation).Under normal circumstances, if to reduce figure
As being realized with cv::INTER_AREA algorithm, and enlarged drawing cv::INTER_CUBIC or cv::INTER_LINEAR.Its
In, INTER_CUBIC effect is good but speed is slow, and INTER_LINEAR is relatively fast and effect is also to receive.
In general, indicate to zoom to original image into the specified size of this parameter if dsize is not 0, if dsize is 0, table
Show through following formula the size of the image after calculating scaling:
Dsize=Size (round (fx*src.cols), round (fy*src.rows))
Wherein, round () expression rounds up a decimal, returns to the function of integer.Cols and rows indicate row and
The size and number of column.If the fx in resize () is 0, need to count according to (double) dsize.width/src.cols
Calculate its value.Width indicates the width of the image after scaling.If the fy in resize () is 0, need according to (double)
Dsize.height/src.rows calculates its value.Height indicates the height of the image after scaling.
Method provided by the embodiments of the present application for handling image, it is first determined with the presence or absence of support target computing architecture
GPU, to obtain definitive result;It is then based on definitive result and updates indexed variable;Finally the case where receiving image sequence
Under, image sequence is handled based on the image processing function in indexed variable invocation target image processing function library.It utilizes
Target computing architecture accelerates the image processing function in target image processing function library, to improve the efficiency of image procossing.
Also, image processing function executes on GPU, greatly reduces the occupancy of CPU.
With further reference to Fig. 3, it illustrates it illustrates according to the method for handling image of the application another
The process 300 of embodiment.The method for being used to handle image, comprising the following steps:
Step 301, it is determined whether there is the GPU for supporting target computing architecture.
It in the present embodiment, can be with for handling the executing subject (such as server 103 shown in FIG. 1) of the method for image
Determine whether there is the GPU for supporting target computing architecture.The GPU for supporting target computing architecture if it exists, executes step 302, if
There is no the GPU for supporting target computing architecture, execute step 305.
Step 302, the image processing function for calling the target computing architecture in a target image processing function library to accelerate.
In the present embodiment, the GPU of target computing architecture is supported if it exists, and above-mentioned executing subject can call a target
The image processing function that target computing architecture in image processing function library accelerates, and continue to execute step 303.
In general, the execution time for the image processing function processing image that first time invocation target computing architecture accelerates can compare
It is long.In order to avoid after receiving image sequence, the image processing function that ability first time invocation target computing architecture accelerates, and
Directly the first frame image in image sequence is handled, leads to the situation that the appearance processing time is relatively long, this is in still
Before not receiving image sequence, the image processing function for just a target computing architecture being called to accelerate can be with initialized target
Computing architecture context.In this way when receiving image sequence, it is not necessary to initialized target computing architecture context again, thus
Save the processing time of image sequence.It should be noted that the image procossing letter that the target computing architecture called accelerates herein
Number processing is program image built in memory.The pixel of the image is usually all black.
Step 303, indexed variable is updated to the information that the image processing function accelerated is called in instruction.
In the present embodiment, the GPU of target computing architecture is supported if it exists, and above-mentioned executing subject can be by indexed variable more
The new information that the image processing function accelerated is called for instruction, and continue to execute step 304.For example, more by the value of indexed variable
New is 1.
Step 304, in response to receiving image sequence, the target computing architecture in invocation target image processing function library adds
The image processing function of speed handles image sequence.
In the present embodiment, in the case where receiving image sequence, above-mentioned electronic equipment can first determine whether that mark becomes
The value of amount, if the value of indexed variable is 1, the image processing function accelerated is called in instruction, then invocation target image processing function library
In target computing architecture accelerate image processing function image sequence is handled.
Step 305, indexed variable is updated to the information that unaccelerated image processing function is called in instruction.
In the present embodiment, the GPU of target computing architecture is supported if it does not exist, and above-mentioned executing subject can be by indexed variable
It is updated to instruction and calls the information of unaccelerated image processing function, and continue to execute step 306.
Step 306, in response to receiving image sequence, at the unaccelerated image in invocation target image processing function library
Reason function handles image sequence.
In the present embodiment, in the case where receiving image sequence, above-mentioned electronic equipment can first determine whether that mark becomes
The value of amount, if the value of indexed variable is 0, unaccelerated image processing function is called in instruction, then invocation target image processing function
Unaccelerated image processing function in library handles image sequence.
From figure 3, it can be seen that the method for handling image compared with the corresponding embodiment of Fig. 2, in the present embodiment
Process 300 highlight call image processing function the step of.As a result, there is support target meter in the scheme of the present embodiment description
In the case where the GPU for calculating framework, before receiving image sequence, the target in a target image processing function library is first called
The image processing function that computing architecture accelerates.In this way, allowing target image processing function library to be completed simultaneously in application initialization
Target computing architecture context initialization, so as to shorten when receiving image sequence, to first frame image processing time, into
One step improves the efficiency of image procossing.
With further reference to Fig. 4, as the realization to method shown in above-mentioned each figure, this application provides one kind for handling figure
One embodiment of the device of picture, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, which can specifically answer
For in various electronic equipments.
As shown in figure 4, the device 400 for handling image of the present embodiment may include: determination unit 401, update list
Member 402 and processing unit 403.Wherein it is determined that unit 401, is configured to determine with the presence or absence of the figure for supporting target computing architecture
Shape processor GPU;Updating unit 402 is configured to update indexed variable based on definitive result;Processing unit 403, is configured to
In response to receiving image sequence, based on the image processing function in indexed variable invocation target image processing function library to image
Sequence is handled.
In the present embodiment, in the device 400 for handling image: determination unit 401, updating unit 402 and processing are single
The specific processing of member 403 and its brought technical effect can be respectively with reference to step 201, the steps in Fig. 2 corresponding embodiment
202, the related description of step 202 and step 203, details are not described herein.
In some optional implementations of the present embodiment, updating unit 402 is further configured to: being supported if it exists
Indexed variable is updated to the information that the image processing function accelerated is called in instruction by the GPU of target computing architecture;And processing is single
Member 403 is further configured to: the image processing function that the target computing architecture in invocation target image processing function library accelerates
Image sequence is handled.
In some optional implementations of the present embodiment, for handling the device 400 of image further include: call unit
(not shown) is configured to support the GPU of target computing architecture if it exists, calls in a target image processing function library
Target computing architecture accelerate image processing function.
In some optional implementations of the present embodiment, updating unit 402 is further configured to: being propped up if it does not exist
Indexed variable is updated to the information that unaccelerated image processing function is called in instruction by the GPU for holding target computing architecture;And place
Reason unit 403 is further configured to: the unaccelerated image processing function in invocation target image processing function library is to image
Sequence is handled.
In some optional implementations of the present embodiment, determination unit 401 is further configured to: invocation target figure
As the acquisition target computing architecture enabling unit count function in processing function library, obtain the GPU's for supporting target computing architecture
Quantity.
In some optional implementations of the present embodiment, if not enabling mesh when target image processing function library compiling
Computing architecture is marked to support or there is no the GPU for supporting target computing architecture, then support that the quantity of the GPU of target computing architecture is
Zero.
In some optional implementations of the present embodiment, wherein for handling the device 400 of image further include: add
Add unit (not shown), is configured to work as and recompilates target image processing letter using cross-platform compilation tool Cmake
When the source code in number library, the compiling option of target computing architecture is supported in addition in command line parameter.
In some optional implementations of the present embodiment, target computing architecture includes unified calculation equipment framework
CUDA, it includes open source computer vision library OpenCV or open computational language OpenCL that target image, which handles function library,.
Below with reference to Fig. 5, it illustrates the server for being suitable for being used to realize the embodiment of the present application (such as clothes shown in FIG. 1
Be engaged in device 103) computer system 500 structural schematic diagram.Server shown in Fig. 5 is only an example, should not be to this Shen
Please embodiment function and use scope bring any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in
Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and
Execute various movements appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data.
CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always
Line 504.
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 508 including hard disk etc.;
And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because
The network of spy's net executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to read from thereon
Computer program be mounted into storage section 508 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communications portion 509, and/or from detachable media
511 are mounted.When the computer program is executed by central processing unit (CPU) 501, limited in execution the present processes
Above-mentioned function.It should be noted that computer-readable medium described herein can be computer-readable signal media or
Computer-readable medium either the two any combination.Computer-readable medium for example can be --- but it is unlimited
In system, device or the device of --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or any above combination.It calculates
The more specific example of machine readable medium can include but is not limited to: electrical connection, portable meter with one or more conducting wires
Calculation machine disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable programmable read only memory
(EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device or
The above-mentioned any appropriate combination of person.In this application, computer-readable medium, which can be, any includes or storage program has
Shape medium, the program can be commanded execution system, device or device use or in connection.And in the application
In, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, wherein
Carry computer-readable program code.The data-signal of this propagation can take various forms, including but not limited to electric
Magnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computer-readable Jie
Any computer-readable medium other than matter, the computer-readable medium can be sent, propagated or transmitted for being held by instruction
Row system, device or device use or program in connection.The program code for including on computer-readable medium
It can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. or above-mentioned any conjunction
Suitable combination.
The calculating of the operation for executing the application can be write with one or more programming languages or combinations thereof
Machine program code, described program design language include object-oriented programming language-such as Java, Smalltalk, C+
+, further include conventional procedural programming language-such as " C " language or similar programming language.Program code can
Fully to execute, partly execute on the user computer on the user computer, be executed as an independent software package,
Part executes on the remote computer or executes on a remote computer or server completely on the user computer for part.
In situations involving remote computers, remote computer can pass through the network of any kind --- including local area network (LAN)
Or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as utilize Internet service
Provider is connected by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard
The mode of part is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor packet
Include determination unit, updating unit and processing unit.Wherein, the title of these units is not constituted under certain conditions to the unit
The restriction of itself, for example, determination unit is also described as " determining whether there is the graphics process for supporting target computing architecture
The unit of device GPU ".
As on the other hand, present invention also provides a kind of computer-readable medium, which be can be
Included in server described in above-described embodiment;It is also possible to individualism, and without in the supplying server.It is above-mentioned
Computer-readable medium carries one or more program, when said one or multiple programs are executed by the server,
So that the server: determining whether there is the graphics processor GPU for supporting target computing architecture;It is updated and is indicated based on definitive result
Variable;In response to receiving image sequence, based on the image processing function in indexed variable invocation target image processing function library
Image sequence is handled.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art
Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature
Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed herein
Can technical characteristic replaced mutually and the technical solution that is formed.
Claims (18)
1. a kind of method for handling image, comprising:
Determine whether there is the graphics processor GPU for supporting target computing architecture;
Indexed variable is updated based on definitive result;
In response to receiving image sequence, based on the image procossing letter in the indexed variable invocation target image processing function library
Several pairs of described image sequences are handled.
2. according to the method described in claim 1, wherein, the definitive result that is based on updates indexed variable, comprising:
The indexed variable is updated to instruction and called at the image accelerated by the GPU for supporting the target computing architecture if it exists
Manage the information of function;And
The image processing function based in the indexed variable invocation target image processing function library is to described image sequence
It is handled, comprising:
The image processing function for calling the target computing architecture in the target image processing function library to accelerate is to the figure
As sequence is handled.
3. according to the method described in claim 2, wherein, it is described indexed variable is updated based on definitive result before, further includes:
The GPU of the target computing architecture is supported if it exists, calls the mesh in the primary target image processing function library
Mark the image processing function that computing architecture accelerates.
4. according to the method described in claim 2, wherein, the definitive result that is based on updates indexed variable, comprising:
The indexed variable is updated to instruction and calls unaccelerated figure by the GPU for supporting the target computing architecture if it does not exist
As the information of processing function;And
The image processing function based in the indexed variable invocation target image processing function library is to described image sequence
It is handled, comprising:
The unaccelerated image processing function in the target image processing function library is called to handle described image sequence.
5. described to determine whether there is the graphics process for supporting target computing architecture according to the method described in claim 1, wherein
Device GPU, comprising:
It calls the acquisition target computing architecture in the target image processing function library to enable unit count function, obtains supporting institute
State the quantity of the GPU of target computing architecture.
6. according to the method described in claim 5, wherein, if not enabling target when target image processing function library compiling
Computing architecture supports or there is no the GPU for supporting the target computing architecture, then the GPU for supporting the target computing architecture
Quantity be zero.
7. according to the method described in claim 6, wherein, the method also includes:
When recompilating the source code of the target image processing function library using cross-platform compilation tool Cmake, ordering
The compiling option of the target computing architecture is supported in addition in row parameter.
8. method described in one of -7 according to claim 1, wherein the target computing architecture includes unified calculation equipment framework
CUDA, the target image processing function library include open source computer vision library OpenCV or open computational language OpenCL.
9. a kind of for handling the device of image, comprising:
Determination unit is configured to determine with the presence or absence of the graphics processor GPU for supporting target computing architecture;
Updating unit is configured to update indexed variable based on definitive result;
Processing unit is configured in response to receive image sequence, is based on the indexed variable invocation target image procossing letter
Image processing function in number library handles described image sequence.
10. device according to claim 9, wherein the updating unit is further configured to:
The indexed variable is updated to instruction and called at the image accelerated by the GPU for supporting the target computing architecture if it exists
Manage the information of function;And
The processing unit is further configured to:
The image processing function for calling the target computing architecture in the target image processing function library to accelerate is to the figure
As sequence is handled.
11. device according to claim 10, wherein described device further include:
Call unit is configured to support the GPU of the target computing architecture if it exists, calls the primary target image processing
The image processing function that the target computing architecture in function library accelerates.
12. device according to claim 10, wherein the updating unit is further configured to:
The indexed variable is updated to instruction and calls unaccelerated figure by the GPU for supporting the target computing architecture if it does not exist
As the information of processing function;And
The processing unit is further configured to:
The unaccelerated image processing function in the target image processing function library is called to handle described image sequence.
13. device according to claim 9, wherein the determination unit is further configured to:
It calls the acquisition target computing architecture in the target image processing function library to enable unit count function, obtains supporting institute
State the quantity of the GPU of target computing architecture.
14. device according to claim 13, wherein if not enabling mesh when target image processing function library compiling
Computing architecture is marked support or there is no the GPU for supporting the target computing architecture, then it is described to support the target computing architecture
The quantity of GPU is zero.
15. device according to claim 14, wherein described device further include:
Adding unit is configured to work as and recompilates the target image processing function using cross-platform compilation tool Cmake
When the source code in library, the compiling option of the target computing architecture is supported in addition in command line parameter.
16. the device according to one of claim 9-15, wherein the target computing architecture includes unified calculation equipment frame
Structure CUDA, the target image processing function library include open source computer vision library OpenCV or open computational language OpenCL.
17. a kind of server, comprising:
One or more processors;
Storage device is stored thereon with one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real
Now such as method described in any one of claims 1-8.
18. a kind of computer-readable medium, is stored thereon with computer program, wherein the computer program is held by processor
Such as method described in any one of claims 1-8 is realized when row.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910289762.0A CN110033406B (en) | 2019-04-11 | 2019-04-11 | Method and apparatus for processing image |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910289762.0A CN110033406B (en) | 2019-04-11 | 2019-04-11 | Method and apparatus for processing image |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110033406A true CN110033406A (en) | 2019-07-19 |
CN110033406B CN110033406B (en) | 2023-08-29 |
Family
ID=67237920
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910289762.0A Active CN110033406B (en) | 2019-04-11 | 2019-04-11 | Method and apparatus for processing image |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110033406B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111694532A (en) * | 2020-06-11 | 2020-09-22 | 翱捷科技(上海)有限公司 | Display control method of single-chip heterogeneous system and wearable device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006345026A (en) * | 2005-06-07 | 2006-12-21 | Rikogaku Shinkokai | Image processor and image processing method employing function expression |
CN103927721A (en) * | 2014-04-10 | 2014-07-16 | 哈尔滨工程大学 | Moving object edge enhancement method based on GPU |
CN106204669A (en) * | 2016-07-05 | 2016-12-07 | 电子科技大学 | A kind of parallel image compression sensing method based on GPU platform |
-
2019
- 2019-04-11 CN CN201910289762.0A patent/CN110033406B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006345026A (en) * | 2005-06-07 | 2006-12-21 | Rikogaku Shinkokai | Image processor and image processing method employing function expression |
CN103927721A (en) * | 2014-04-10 | 2014-07-16 | 哈尔滨工程大学 | Moving object edge enhancement method based on GPU |
CN106204669A (en) * | 2016-07-05 | 2016-12-07 | 电子科技大学 | A kind of parallel image compression sensing method based on GPU platform |
Non-Patent Citations (4)
Title |
---|
ZJ0789: "使用GPU提高OpenCV的图像处理运算速度", 《BLOG.CSDN.NET/ZJ0789/ARTICLE/DETAILS/43795261》 * |
ZJ0789: "使用GPU提高OpenCV的图像处理运算速度", 《BLOG.CSDN.NET/ZJ0789/ARTICLE/DETAILS/43795261》, 13 February 2015 (2015-02-13), pages 1 * |
原我归来是少年: "OpenCV+CUDA入门教程之二---GPU模块简介", 《HTTPS://BLOG.CSDN.NET/DUMPDOCTORWANG/ARTICLE/DETAILS/81052597》 * |
原我归来是少年: "OpenCV+CUDA入门教程之二---GPU模块简介", 《HTTPS://BLOG.CSDN.NET/DUMPDOCTORWANG/ARTICLE/DETAILS/81052597》, 18 July 2018 (2018-07-18), pages 1 - 2 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111694532A (en) * | 2020-06-11 | 2020-09-22 | 翱捷科技(上海)有限公司 | Display control method of single-chip heterogeneous system and wearable device |
CN111694532B (en) * | 2020-06-11 | 2021-06-04 | 翱捷科技股份有限公司 | Display control method of single-chip heterogeneous system and wearable device |
Also Published As
Publication number | Publication date |
---|---|
CN110033406B (en) | 2023-08-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108416744B (en) | Image processing method, device, equipment and computer readable storage medium | |
US10282179B2 (en) | Nested communication operator | |
CN111581555B (en) | Document loading method, device, equipment and storage medium | |
CN111158756B (en) | Method and apparatus for processing information | |
CN110825440A (en) | Instruction execution method and device | |
CN111324376B (en) | Function configuration method, device, electronic equipment and computer readable medium | |
CN107301220B (en) | Method, device and equipment for data driving view and storage medium | |
US20160371061A1 (en) | Read-only communication operator | |
CN112416303B (en) | Software development kit hot repair method and device and electronic equipment | |
CN110033406A (en) | Method and apparatus for handling image | |
CN110069195B (en) | Image dragging deformation method and device | |
CN111752644A (en) | Interface simulation method, device, equipment and storage medium | |
CN116416355A (en) | Shader script generation method and device, electronic equipment and storage medium | |
CN116775174A (en) | Processing method, device, equipment and medium based on user interface frame | |
CN111309323B (en) | Parameter initialization method and device and electronic equipment | |
CN112988194A (en) | Program optimization method and device based on equipment information, electronic equipment and storage medium | |
CN109816595A (en) | Image processing method and device | |
CN110083357A (en) | Interface construction method, device, server and storage medium | |
CN110070479A (en) | Anamorphose pulls independent positioning method and device | |
US20230376122A1 (en) | Interface displaying method, apparatus, device and medium | |
CN114428615B (en) | CSS compiling method, style updating device, medium and equipment | |
CN114051046B (en) | Cloud data issuing method, related device and computer program product | |
CN109543834B (en) | Operation method, device and related product | |
CN109543833B (en) | Operation method, device and related product | |
CN109558943B (en) | Operation method, device and related product |
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 |