CN115049544A - Picture processing method and device and computer readable storage medium - Google Patents
Picture processing method and device and computer readable storage medium Download PDFInfo
- Publication number
- CN115049544A CN115049544A CN202110255194.XA CN202110255194A CN115049544A CN 115049544 A CN115049544 A CN 115049544A CN 202110255194 A CN202110255194 A CN 202110255194A CN 115049544 A CN115049544 A CN 115049544A
- Authority
- CN
- China
- Prior art keywords
- processing
- picture
- target picture
- target
- critical path
- 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
- 238000003672 processing method Methods 0.000 title claims abstract description 21
- 238000000034 method Methods 0.000 claims abstract description 57
- 230000004044 response Effects 0.000 claims abstract description 17
- 238000004590 computer program Methods 0.000 claims description 13
- 230000002452 interceptive effect Effects 0.000 abstract description 7
- 238000011022 operating instruction Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 7
- 230000002093 peripheral effect Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 239000002131 composite material Substances 0.000 description 4
- 230000002194 synthesizing effect Effects 0.000 description 4
- 238000010295 mobile communication Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 229920000642 polymer Polymers 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/60—Rotation of whole images or parts thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration using two or more images, e.g. averaging or subtraction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20112—Image segmentation details
- G06T2207/20132—Image cropping
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20212—Image combination
- G06T2207/20221—Image fusion; Image merging
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Studio Circuits (AREA)
Abstract
本发明提供一种图片的处理方法,方法包括如下步骤:获取目标图片对应的处理信息,处理信息包括缩略图和预设系数;响应于对缩略图的操作指令,根据预设系数缩放与操作指令对应的第一关键路径,生成与目标图片对应的第二关键路径;根据第二关键路径对目标图片进行处理,以获得处理后的目标图片。本发明还公开了一种视频数据的处理设备和计算机可读存储介质。该图片的处理方法、设备及计算机可读存储介质能够利用对缩略图进行图片处理实现对目标图片进行图片处理,从而使得终端在图片处理过程中所占用的堆内存较少,进而节省了对堆内存的使用,提高了交互响应的速度,有效防止在图片处理过程中出现OOM异常。
The present invention provides a method for processing pictures. The method includes the following steps: acquiring processing information corresponding to a target picture, where the processing information includes a thumbnail image and a preset coefficient; in response to an operation instruction on the thumbnail image, scaling and operating instructions according to the preset coefficient A second critical path corresponding to the target image is generated corresponding to the first critical path; the target image is processed according to the second critical path to obtain a processed target image. The invention also discloses a video data processing device and a computer-readable storage medium. The picture processing method, device and computer-readable storage medium can realize picture processing of target pictures by performing picture processing on thumbnails, so that the terminal occupies less heap memory during the picture processing process, thereby saving heap memory usage. The use of memory improves the speed of interactive response and effectively prevents OOM exceptions during image processing.
Description
技术领域technical field
本发明涉及图片处理技术领域,特别是涉及一种图片的处理方法、设备及计算机可读存储介质。The present invention relates to the technical field of picture processing, and in particular, to a picture processing method, device and computer-readable storage medium.
背景技术Background technique
随着科技发展的不断进步,图片像素越来越高,从而图片大小也是日益增大,而图片的大小在对图片进行处理中是一个不可忽略的因素。With the continuous advancement of science and technology, the pixels of pictures are getting higher and higher, so the size of pictures is also increasing, and the size of pictures is a factor that cannot be ignored in the processing of pictures.
目前,终端在遇到各种需要图片处理的场景时,通常会借用一些成熟的底层技术比如ffmpeg来处理图像的裁剪、旋转、合成等。但是,在这些终端进行图片处理时,需要读入整张原图数据或需要合成的所有图片数据,使得堆内存的使用过多,且在加载图片过程中消耗了极大的时间,影响交互响应的速度。At present, when the terminal encounters various scenes that require image processing, it usually borrows some mature underlying technologies such as ffmpeg to process image cropping, rotation, and synthesis. However, when these terminals perform image processing, it is necessary to read in the entire original image data or all image data that needs to be synthesized, which makes the use of heap memory too much, and consumes a lot of time in the process of loading images, which affects the interactive response. speed.
发明内容SUMMARY OF THE INVENTION
本发明的目的在于提供一种图片的处理方法、设备及计算机可读存储介质,利用对缩略图进行图片处理实现对目标图片进行图片处理,解决了图片处理过程中堆内存占用过多的问题。The purpose of the present invention is to provide a picture processing method, device and computer-readable storage medium, which can realize picture processing of target pictures by performing picture processing on thumbnails, and solve the problem of excessive heap memory occupation during picture processing.
具体地,本发明提供一种图片的处理方法,所述方法包括如下步骤:获取目标图片对应的处理信息,所述处理信息包括缩略图和预设系数;响应于对所述缩略图的操作指令,根据所述预设系数缩放与所述第一操作指令对应的第一关键路径,生成与所述目标图片对应的第二关键路径;根据所述第二关键路径对所述目标图片进行处理,以获得处理后的目标图片。Specifically, the present invention provides a picture processing method, the method includes the following steps: acquiring processing information corresponding to a target picture, the processing information including a thumbnail image and preset coefficients; responding to an operation instruction on the thumbnail image , scaling the first critical path corresponding to the first operation instruction according to the preset coefficient to generate a second critical path corresponding to the target picture; processing the target picture according to the second critical path, to obtain the processed target image.
具体地,本发明提供一种图片的处理方法,所述方法包括如下步骤:第一终端将目标图片对应的处理信息发送到第二终端,所述处理信息包括缩略图和预设系数;所述第二终端响应于对所述缩略图的操作指令,根据所述预设系数缩放与所述第一操作指令对应的第一关键路径,生成与所述目标图片对应的第二关键路径;所述第二终端根据所述第二关键路径对所述目标图片进行处理,以获得处理后的目标图片。Specifically, the present invention provides a method for processing pictures. The method includes the following steps: a first terminal sends processing information corresponding to a target picture to a second terminal, where the processing information includes thumbnail images and preset coefficients; the In response to the operation instruction on the thumbnail, the second terminal scales the first critical path corresponding to the first operation instruction according to the preset coefficient, and generates a second critical path corresponding to the target picture; the The second terminal processes the target picture according to the second critical path to obtain a processed target picture.
具体地,本发明提供一种视频数据的处理设备,所述设备包括:存储器及处理器;所述存储器用于存储计算机程序;所述处理器用于执行所述计算机程序以实现如上述的图片的处理方法的步骤。Specifically, the present invention provides a video data processing device, the device includes: a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program to realize the above picture. The steps of the processing method.
具体地,本发明提供一种计算机可读存储介质,所述计算机存储介质上存储有计算机程序指令;所述计算机程序指令被处理器执行时实现如上述的图片的处理方法。Specifically, the present invention provides a computer-readable storage medium on which computer program instructions are stored; when the computer program instructions are executed by a processor, the above-mentioned image processing method is implemented.
本发明提供的一种图片的处理方法、设备及计算机可读存储介质能够通过获取目标图片对应的处理信息,处理信息包括缩略图和预设系数后,响应于对缩略图的操作指令,根据预设系数缩放操作指令,生成与目标图片对应的第二关键路径,且根据第二关键路径对目标图片进行处理,以获得处理后的目标图片,从而使得终端在图片处理过程中所占用的堆内存较少,进而节省了对堆内存的使用,提高了交互响应的速度,有效防止在图片处理过程中出现OOM异常。A picture processing method, device and computer-readable storage medium provided by the present invention can obtain processing information corresponding to a target picture, after the processing information includes a thumbnail image and preset coefficients, in response to an operation instruction on the thumbnail image, according to the preset Set a coefficient scaling operation instruction, generate a second critical path corresponding to the target image, and process the target image according to the second critical path to obtain the processed target image, thereby making the heap memory occupied by the terminal during the image processing process It saves the use of heap memory, improves the speed of interactive response, and effectively prevents OOM exceptions during image processing.
附图说明Description of drawings
图1为本发明一实施例提供的图片的处理方法的流程图;1 is a flowchart of a method for processing a picture provided by an embodiment of the present invention;
图2为本发明一实施例提供的图片的处理方法的部分流程图;2 is a partial flowchart of a method for processing a picture provided by an embodiment of the present invention;
图3为本发明一实施例提供的图片的处理方法中目标图片缩放为缩略图的示意图;3 is a schematic diagram of scaling a target picture into a thumbnail in a method for processing a picture provided by an embodiment of the present invention;
图4为本发明一实施例提供的图片的处理方法的部分流程图;4 is a partial flowchart of a method for processing a picture provided by an embodiment of the present invention;
图5为本发明一实施例提供的图片的处理方法中操作指令缩放为第二关键路径的示意图;5 is a schematic diagram of scaling an operation instruction to a second critical path in a method for processing a picture provided by an embodiment of the present invention;
图6为本发明一实施例提供的图片的处理方法的应用场景示意图;6 is a schematic diagram of an application scenario of a picture processing method provided by an embodiment of the present invention;
图7示出一种终端的结构框图;Fig. 7 shows a structural block diagram of a terminal;
图8为本发明一实施例提供的图片的处理方法的流程图;8 is a flowchart of a method for processing a picture provided by an embodiment of the present invention;
图9为本发明一实施例提供的图片的处理设备的结构示意图。FIG. 9 is a schematic structural diagram of a picture processing device according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments.
基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
实施例一Example 1
本发明实施例提供一种图片的处理方法,图1为本发明一实施例所提供的图片的处理方法流程图。如图1所示,该方法包括如下步骤:An embodiment of the present invention provides a method for processing a picture, and FIG. 1 is a flowchart of a method for processing a picture provided by an embodiment of the present invention. As shown in Figure 1, the method includes the following steps:
步骤110:获取目标图片对应的处理信息,处理信息包括缩略图和预设系数。Step 110: Obtain processing information corresponding to the target picture, where the processing information includes thumbnail images and preset coefficients.
具体地,处理信息可以但不限于是终端自身存储的信息,也可以是其他终端发送过来的信息。目标图片可以但不限于是需要进行图像处理的、大小正常、尺寸正常的图片。缩略图可以但不限于是基于正常图片,根据预设系数生成的图片。Specifically, the processing information may be, but is not limited to, information stored by the terminal itself, or may be information sent by other terminals. The target picture can be, but is not limited to, a picture of normal size and size that needs to be processed. Thumbnails can be, but are not limited to, pictures generated based on normal pictures and according to preset coefficients.
在一实施方式中,如图2所示,获取目标图片对应的处理信息,处理信息包括缩略图和预设系数的步骤之前包括:In one embodiment, as shown in FIG. 2 , the processing information corresponding to the target picture is obtained, and the processing information includes thumbnail images and preset coefficients before the steps include:
步骤210:获取目标图片;Step 210: obtain the target image;
步骤220:保持目标图片的高宽比例不变,根据预设系数生成与目标图片对应的缩略图。Step 220: Keep the aspect ratio of the target picture unchanged, and generate a thumbnail corresponding to the target picture according to a preset coefficient.
具体地,获取目标图片可以但不限于是向终端自身进行获取,也可以是向其他终端进行获取。在保持目标图片的高宽比不变的情况下,根据预设系数生成与该目标图片对应的缩略图。其中,预设系数可以但不限于是用户自己设定,也可以根据终端内存大小自动生成。预设系数是用于生成与目标图片对应的缩略图的参考值,该缩略图显示在操作区域相比于目标图片所占堆内存较低。缩略图的高宽尺寸等于与缩略图对应的目标图片的高宽尺寸/该预设系数。例如,如图3所示,正常图片31的高宽分别为H1、W1,根据预设系数S缩放以后,缩略图32的高宽分别为H2、W2。Specifically, the acquisition target picture may be acquired from but not limited to the terminal itself, and may also be acquired from other terminals. Under the condition that the aspect ratio of the target picture is kept unchanged, a thumbnail image corresponding to the target picture is generated according to the preset coefficient. The preset coefficient may be, but not limited to, be set by the user, and may also be automatically generated according to the size of the terminal memory. The preset coefficient is a reference value for generating a thumbnail image corresponding to the target image, and the thumbnail image displayed in the operation area occupies a lower heap memory than the target image. The height and width of the thumbnail is equal to the height and width of the target image corresponding to the thumbnail/the preset coefficient. For example, as shown in FIG. 3 , the height and width of the
在一实施方式中,如图4所示,获取目标图片对应的处理信息,处理信息包括缩略图和预设系数的步骤之前包括:In one embodiment, as shown in FIG. 4 , the processing information corresponding to the target picture is obtained, and the processing information includes thumbnail images and preset coefficients before the steps include:
步骤410:检测自身的堆内存占用是否大于预定值;Step 410: Detect whether its own heap memory usage is greater than a predetermined value;
步骤420:若堆内存占用大于预定值,则执行获取目标图片对应的处理信息,处理信息包括缩略图和预设系数的步骤。Step 420: If the heap memory occupation is greater than the predetermined value, execute the step of acquiring processing information corresponding to the target picture, where the processing information includes thumbnail images and preset coefficients.
具体地,预定值可以但不限于是零,即只要检测到自身的堆内存有被占用,则执行获取目标图片对应的处理信息,处理信息包括缩略图和预设系数的步骤。预定值可以根据终端情况进行设定。Specifically, the predetermined value may be, but is not limited to, zero, that is, as long as it is detected that its own heap memory is occupied, the step of obtaining processing information corresponding to the target picture, where the processing information includes thumbnail images and preset coefficients, is performed. The predetermined value can be set according to terminal conditions.
步骤120:响应于对缩略图的操作指令,根据预设系数缩放与操作指令对应的第一关键路径,生成与目标图片对应的第二关键路径。Step 120: In response to the operation instruction on the thumbnail, scale the first critical path corresponding to the operation instruction according to a preset coefficient, and generate a second critical path corresponding to the target image.
具体地,在缩略图显示在操作区域的过程中,用户针对该缩略图进行的图片处理操作。操作指令可以但不限于是对缩略图进行裁剪、合成及旋转等。在一实施方式中,操作指令包括:对缩略图进行裁剪操作;和/或对缩略图进行合成操作;和/或对缩略图进行旋转操作。具体地,将与操作指令对应的第一关键路径按照预设系数进行计算,生成在目标图片上进行图片处理的第二关键路径。例如,如图5所示,若第一关键路径针对缩略图确定的裁剪或合成区域51的高宽分别为H3、W3,旋转角度A,相对于缩略图左上角顶点的相对坐标为(DX,DY),则根据预设系数生成的第二关键路径对确定的裁剪或合成区域52相对于目标图片的左上角顶点坐标为(DX*S,DY*S),高宽分别为H4=H3*S、W4=W3*S,并记录旋转角度A。旋转角度A可以但不限于等于零。Specifically, in the process of displaying the thumbnail in the operation area, the user performs a picture processing operation on the thumbnail. The operation instruction may be, but not limited to, cropping, compositing, and rotating the thumbnails. In one embodiment, the operation instruction includes: performing a cropping operation on the thumbnails; and/or performing a synthesizing operation on the thumbnails; and/or performing a rotation operation on the thumbnails. Specifically, the first critical path corresponding to the operation instruction is calculated according to the preset coefficients to generate the second critical path for image processing on the target image. For example, as shown in FIG. 5 , if the height and width of the cropping or compositing
步骤130:根据第二关键路径对目标图片进行处理,以获得处理后的目标图片。Step 130: Process the target picture according to the second critical path to obtain the processed target picture.
具体地,在生成上述第二关键路径后,则调用位图或ffmpeg对应的api进行处理,生成经过图像处理后的目标图片。若是裁剪操作,则执行确定了在目标图片上的裁剪区域后生成图片处理后的目标图片,则将该目标图片旋转角度A;若是合成操作,则将需要合入的图缩放到确定合成区域大小并旋转角度A,记录此步骤生成的位图为bm2,调用draw函数,先画原图bm1,再画bm2,将函数参数传入回放后的左上角坐标。在一实施方式中,根据第二关键路径对目标图片进行处理,以获得处理后的目标图片的步骤包括:通过底层库对目标图片进行处理,以使得堆内存得到节省。Specifically, after the above-mentioned second critical path is generated, the API corresponding to the bitmap or ffmpeg is called for processing, and the target image after image processing is generated. If it is a cropping operation, the target image after image processing is generated after the cropping area on the target image is determined, and the target image is rotated by the angle A; if it is a composite operation, the image that needs to be combined is scaled to determine the size of the composite area. And rotate the angle A, record the bitmap generated in this step as bm2, call the draw function, first draw the original image bm1, then draw bm2, and pass the function parameters into the coordinates of the upper left corner after playback. In one embodiment, the step of processing the target picture according to the second critical path to obtain the processed target picture includes: processing the target picture through an underlying library, so that heap memory is saved.
本申请实施例提供的一种图片的处理方法,通过获取目标图片对应的处理信息,处理信息包括缩略图和预设系数后,响应于对缩略图的操作指令,根据预设系数缩放与所述操作指令对应的第一关键路径,生成与目标图片对应的第二关键路径,且根据第二关键路径对目标图片进行处理,以获得处理后的目标图片,从而使得终端在图片处理过程中所占用的堆内存较少,进而节省了对堆内存的使用,提高了交互响应的速度,有效防止在图片处理过程中出现OOM异常。In a picture processing method provided by an embodiment of the present application, by acquiring processing information corresponding to a target picture, the processing information includes a thumbnail image and a preset coefficient, and in response to an operation instruction on the thumbnail image, scaling the image with the preset coefficient according to the preset coefficient The first critical path corresponding to the operation instruction, the second critical path corresponding to the target picture is generated, and the target picture is processed according to the second critical path to obtain the processed target picture, so that the terminal occupies the There is less heap memory, which saves the use of heap memory, improves the speed of interactive response, and effectively prevents OOM exceptions during image processing.
实施例二Embodiment 2
如图6所示,其提供了本发明一实施例提供的一种图片的处理方法的应用场景示意图,该应用场景包括第一终端61和第二终端62,第一终端61用于将目标图片对应的处理信息发送到第二终端62,处理信息包括缩略图和预设系数。第二终端62用于响应于对缩略图的操作指令,根据预设系数缩放与操作指令对应的第一关键路径,生成与目标图片对应的第二关键路径,并根据第二关键路径对目标图片进行处理,以获得处理后的目标图片。其中,根据第二关键路径对目标图片进行处理时,可以使用ffmpeg等基于C++实现的底层库来处理,从而使得终端在图片处理过程中所占用的堆内存较少,进而节省了对堆内存的使用,提高了交互响应的速度,有效防止在图片处理过程中出现OOM异常。As shown in FIG. 6, which provides a schematic diagram of an application scenario of a picture processing method provided by an embodiment of the present invention, the application scenario includes a
在一实施例中,第一终端61可以为智能手机、平板电脑等,用于将目标图片对应的处理信息发送到第二终端62,处理信息包括缩略图和预设系数。In an embodiment, the
在一实施例中,第二终端62可以为智能手机、PC机(Personal Computer,个人计算机)、一体机、膝上型便携计算机等,用于响应于对缩略图的操作指令,根据预设系数缩放与操作指令对应的第一关键路径,生成与目标图片对应的第二关键路径,并根据第二关键路径对目标图片进行处理,以获得处理后的目标图片。In one embodiment, the
图7示出了一种终端的结构框图。图7所示的结构可适用于第一终端61和第二终端62。如图7所示,终端10包括存储器102、存储控制器104,一个或多个(图中仅示出一个)处理器106、外设接口108、射频模块110、定位模块112、摄像模块114、音频模块116、屏幕118以及按键模块120。这些组件通过一条或多条通讯总线/信号线122相互通讯。FIG. 7 shows a structural block diagram of a terminal. The structure shown in FIG. 7 is applicable to the
可以理解,图7所示的结构仅为示意,终端10还可包括比图7中所示更多或者更少的组件,或者具有与图7所示不同的配置。图7中所示的各组件可以采用硬件、软件或其组合实现。It can be understood that the structure shown in FIG. 7 is only for illustration, and the terminal 10 may further include more or less components than those shown in FIG. 7 , or have different configurations from those shown in FIG. 7 . Each component shown in FIG. 7 may be implemented in hardware, software, or a combination thereof.
存储器102可用于存储软件程序以及模块,如本发明实施例中的投屏的的连接方法对应的程序指令/模块,处理器106通过运行存储在存储控制器104内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的图片的处理方法。The
存储器102可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器102可进一步包括相对于处理器106远程设置的存储器,这些远程存储器可以通过网络连接至终端10。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。处理器106以及其他可能的组件对存储器102的访问可在存储控制器104的控制下进行。The
外设接口108将各种输入/输入装置耦合至CPU以及存储器102。处理器106运行存储器102内的各种软件、指令以执行终端10的各种功能以及进行数据处理。A
在一些实施例中,外设接口108,处理器106以及存储控制器104可以在单个芯片中实现。在其他一些实例中,他们可以分别由独立的芯片实现。In some embodiments,
射频模块110用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯。射频模块110可包括各种现有的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。射频模块110可与各种网络如互联网、企业内部网、无线网络进行通讯或者通过无线网络与其他设备进行通讯。上述的无线网络可包括蜂窝式电话网、无线局域网或者城域网。上述的无线网络可以使用各种通信标准、协议及技术,包括但并不限于全球移动通信系统(Global System for Mobile Communication,GSM)、增强型移动通信技术(Enhanced Data GSM Environment,EDGE),宽带码分多址技术(wideband code divisionmultiple access,W-CDMA),码分多址技术(Code division access,CDMA)、时分多址技术(time division multiple access,TDMA),蓝牙,无线保真技术(Wireless,Fidelity,WiFi)(如美国电气和电子工程师协会标准IEEE 802.11a,IEEE 802.11b,IEEE802.11g和/或IEEE802.11n)、网络电话(Voice over internet protocal,VoIP)、全球微波互联接入(Worldwide Interoperability for Microwave Access,Wi-Max)、其他用于邮件、即时通讯及短消息的协议,以及任何其他合适的通讯协议,甚至可包括那些当前仍未被开发出来的协议。The
定位模块112用于获取终端10的当前位置。定位模块112的实例包括但不限于全球卫星定位系统(GPS)、基于无线局域网或者移动通信网的定位技术。The
摄像模块114用于拍摄照片或者视频。拍摄的照片或者视频可以存储至存储器102内,并可通过射频模块110发送。The
音频模块116向用户提供音频接口,其可包括一个或多个麦克风、一个或者多个扬声器以及音频电路。音频电路从外设接口108处接收声音数据,将声音数据转换为电信息,将电信息传输至扬声器。扬声器将电信息转换为人耳能听到的声波。音频电路还从麦克风处接收电信息,将电信号转换为声音数据,并将声音数据传输至外设接口108中以进行进一步的处理。音频数据可以从存储器102处或者通过射频模块110获取。此外,音频数据也可以存储至存储器102中或者通过射频模块110进行发送。在一些实例中,音频模块116还可包括一个耳机播孔,用于向耳机或者其他设备提供音频接口。
屏幕118在终端10与用户之间提供一个输出界面。具体地,屏幕118向用户显示视频输出,这些视频输出的内容可包括文字、图形、视频、及其任意组合。一些输出结果是对应于一些用户界面对象。可以理解的,屏幕118还可以包括触控屏幕。触控屏幕在终端10与用户之间同时提供一个输出及输入界面。除了向用户显示视频输出,触控屏幕还接收用户的输入,例如用户的点击、滑动等手势操作,以便用户界面对象对这些用户的输入做出响应。检测用户输入的技术可以是基于电阻式、电容式或者其他任意可能的触控检测技术。触控屏幕显示单元的具体实例包括但并不限于液晶显示器或发光聚合物显示器。
按键模块120同样提供用户向终端10进行输入的接口,用户可以通过按下不同的按键以使终端10执行不同的功能。The
本发明实施例提供一种图片的处理方法,图8为本发明一实施例所提供的图片的处理方法流程图。如图8所示,该方法包括如下步骤:An embodiment of the present invention provides a method for processing a picture, and FIG. 8 is a flowchart of the method for processing a picture provided by an embodiment of the present invention. As shown in Figure 8, the method includes the following steps:
步骤810:第一终端将目标图片对应的处理信息发送到第二终端,处理信息包括缩略图和预设系数。Step 810: The first terminal sends processing information corresponding to the target picture to the second terminal, where the processing information includes thumbnail images and preset coefficients.
具体地,处理信息可以但不限于是终端自身存储的信息,也可以是其他终端发送过来的信息。目标图片可以但不限于是需要进行图像处理的、大小正常、尺寸正常的图片。缩略图可以但不限于是基于正常图片,根据预设系数生成的图片。Specifically, the processing information may be, but is not limited to, information stored by the terminal itself, or may be information sent by other terminals. The target picture can be, but is not limited to, a picture of normal size and size that needs to be processed. Thumbnails can be, but are not limited to, pictures generated based on normal pictures and according to preset coefficients.
在一实施方式中,第一终端将目标图片对应的处理信息发送到第二终端,处理信息包括缩略图和预设系数的步骤之前包括:第一终端获取目标图片,并保持目标图片的高宽比例不变,根据预设系数生成与目标图片对应的缩略图。In one embodiment, the first terminal sends processing information corresponding to the target picture to the second terminal, and before the step of processing the information including the thumbnail image and the preset coefficients includes: the first terminal obtains the target picture, and maintains the height and width of the target picture. The ratio is unchanged, and the thumbnail corresponding to the target image is generated according to the preset coefficient.
具体地,获取目标图片可以但不限于是向终端自身进行获取,也可以是向其他终端进行获取。在保持目标图片的高宽比不变的情况下,根据预设系数生成与该目标图片对应的缩略图。其中,预设系数可以但不限于是用户自己设定,也可以根据终端内存大小自动生成。预设系数是用于生成与目标图片对应的缩略图的参考值,该缩略图显示在操作区域相比于目标图片所占堆内存较低。缩略图的高宽尺寸等于与缩略图对应的目标图片的高宽尺寸/该预设系数。例如,如图3所示,正常图片31的高宽分别为H1、W1,根据预设系数S缩放以后,缩略图32的高宽分别为H2、W2。Specifically, the acquisition target picture may be acquired from but not limited to the terminal itself, and may also be acquired from other terminals. Under the condition that the aspect ratio of the target picture is kept unchanged, a thumbnail image corresponding to the target picture is generated according to the preset coefficient. The preset coefficient may be, but not limited to, be set by the user, and may also be automatically generated according to the size of the terminal memory. The preset coefficient is a reference value for generating a thumbnail image corresponding to the target image, and the thumbnail image displayed in the operation area occupies a lower heap memory than the target image. The height and width of the thumbnail is equal to the height and width of the target image corresponding to the thumbnail/the preset coefficient. For example, as shown in FIG. 3 , the height and width of the
步骤820:第二终端响应于对缩略图的操作指令,根据预设系数缩放与操作指令对应的第一关键路径,生成与目标图片对应的第二关键路径。Step 820: In response to the operation instruction on the thumbnail, the second terminal scales the first critical path corresponding to the operation instruction according to a preset coefficient, and generates a second critical path corresponding to the target picture.
具体地,在缩略图显示在操作区域的过程中,用户针对该缩略图进行的图片处理操作。操作指令可以但不限于是对缩略图进行裁剪、合成及旋转等。在一实施方式中,操作指令包括:对缩略图进行裁剪操作;和/或对缩略图进行合成操作;和/或对缩略图进行旋转操作。Specifically, in the process of displaying the thumbnail in the operation area, the user performs a picture processing operation on the thumbnail. The operation instruction may be, but not limited to, cropping, compositing, and rotating the thumbnails. In one embodiment, the operation instruction includes: performing a cropping operation on the thumbnails; and/or performing a synthesizing operation on the thumbnails; and/or performing a rotation operation on the thumbnails.
具体地,将与操作指令操作指令对应的第一关键路径按照预设系数进行计算,生成在目标图片上进行图片处理的第二关键路径。例如,如图5所示,若第一关键路径针对缩略图确定的裁剪或合成区域51的高宽分别为H3、W3,旋转角度A,相对于缩略图左上角顶点的相对坐标为(DX,DY),则根据预设系数生成的第二关键路径对确定的裁剪或合成区域52相对于目标图片的左上角顶点坐标为(DX*S,DY*S),高宽分别为H4、W4,并记录旋转角度A。旋转角度A可以但不限于等于零。Specifically, the first critical path corresponding to the operation instruction of the operation instruction is calculated according to the preset coefficient, and the second critical path for image processing on the target image is generated. For example, as shown in FIG. 5 , if the height and width of the cropping or
步骤830:第二终端根据第二关键路径对目标图片进行处理,以获得处理后的目标图片。Step 830: The second terminal processes the target picture according to the second critical path to obtain the processed target picture.
具体地,在生成上述第二关键路径后,则调用位图或ffmpeg对应的api进行处理,生成经过图像处理后的目标图片。若是裁剪操作,则执行确定了在目标图片上的裁剪区域后生成图片处理后的目标图片,则将该目标图片旋转角度A;若是合成操作,则将需要合入的图缩放到确定合成区域大小并旋转角度A,记录此步骤生成的位图为bm2,调用draw函数,先画原图bm1,再画bm2,将函数参数传入回放后的左上角坐标。在一实施方式中,第二终端根据第二关键路径对目标图片进行处理,以获得处理后的目标图片的步骤具体包括:第二终端通过底层库对目标图片进行处理,以使得堆内存得到节省。Specifically, after the above-mentioned second critical path is generated, the API corresponding to the bitmap or ffmpeg is called for processing, and the target image after image processing is generated. If it is a cropping operation, the target image after image processing is generated after the cropping area on the target image is determined, and the target image is rotated by the angle A; if it is a composite operation, the image that needs to be combined is scaled to determine the size of the composite area. And rotate the angle A, record the bitmap generated in this step as bm2, call the draw function, first draw the original image bm1, then draw bm2, and pass the function parameters into the coordinates of the upper left corner after playback. In one embodiment, the step of the second terminal processing the target picture according to the second critical path to obtain the processed target picture specifically includes: the second terminal processing the target picture through the underlying library, so that the heap memory is saved. .
本申请实施例提供的一种图片的处理方法,通过获取目标图片对应的处理信息,处理信息包括缩略图和预设系数后,响应于对缩略图的操作指令,根据预设系数缩放与所述操作指令对应的第一关键路径,生成与目标图片对应的第二关键路径,且根据第二关键路径对目标图片进行处理,以获得处理后的目标图片,从而使得终端在图片处理过程中所占用的堆内存较少,进而节省了对堆内存的使用,提高了交互响应的速度,有效防止在图片处理过程中出现OOM异常。In a picture processing method provided by an embodiment of the present application, by acquiring processing information corresponding to a target picture, the processing information includes a thumbnail image and a preset coefficient, and in response to an operation instruction on the thumbnail image, scaling the image with the preset coefficient according to the preset coefficient The first critical path corresponding to the operation instruction, the second critical path corresponding to the target picture is generated, and the target picture is processed according to the second critical path to obtain the processed target picture, so that the terminal occupies the There is less heap memory, which saves the use of heap memory, improves the speed of interactive response, and effectively prevents OOM exceptions during image processing.
上文中对于一种图片的处理方法的实施例进行了详细描述,基于上述实施例描述的图片的处理方法,本法发明实施例还提供了一种与该方法对应的设备。An embodiment of a picture processing method is described in detail above. Based on the picture processing method described in the foregoing embodiment, an embodiment of the present invention further provides a device corresponding to the method.
图9为本发明实施例所提供的一种视频数据的处理设备组成示意图,如图9所示,该设备包括存储器91和处理器92。FIG. 9 is a schematic diagram of the composition of a device for processing video data according to an embodiment of the present invention. As shown in FIG. 9 , the device includes a
存储器91用于存储计算机程序;The
处理器92用于执行计算机程序以实现上述任意一个实施例提供的图片的处理方法的步骤。由于设备部分的实施例与方法部分的实施例相互对应,因此设备部分的实施例请参考方法部分的实施例描述,这里不再赘述。The
本申请实施例提供的一种视频数据的处理设备,能够利用对缩略图进行图片处理实现对目标图片进行图片处理,从而使得终端在图片处理过程中所占用的堆内存较少,进而节省了对堆内存的使用,提高了交互响应的速度,有效防止在图片处理过程中出现OOM异常。The video data processing device provided by the embodiment of the present application can perform image processing on a target image by performing image processing on thumbnails, so that the terminal occupies less heap memory during the image processing process, thereby saving the need for The use of heap memory improves the speed of interactive response and effectively prevents OOM exceptions during image processing.
上文中对于一种图片的处理方法的实施例进行了详细描述,基于上述实施例描述的图片的处理方法,本法发明实施例还提供了一种与该方法对应的计算机可读存储介质。An embodiment of a method for processing a picture is described in detail above. Based on the method for processing a picture described in the above embodiment, an embodiment of the present invention further provides a computer-readable storage medium corresponding to the method.
一种计算机可读存储介质,其上存储有计算机程序,计算机存储介质上存储有计算机程序指令,计算机程序指令被处理器执行时实现上述任意一个实施例提供的图片的处理方法。由于计算机可读存储介质部分的实施例与方法部分的实施例相互对应,因此计算机可读存储介质部分的实施例请参考方法部分的实施例描述,这里不再赘述。A computer-readable storage medium stores a computer program thereon, and stores computer program instructions on the computer storage medium. When the computer program instructions are executed by a processor, the image processing method provided by any one of the foregoing embodiments is implemented. Since the embodiments of the computer-readable storage medium part correspond to the embodiments of the method part, the embodiments of the computer-readable storage medium part refer to the description of the embodiments of the method part, which will not be repeated here.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device comprising a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium can be read-only memory, magnetic disk or optical disk, etc.
以上,仅是本发明的较佳实施例而已,并非对本发明作任何形式上的限制,虽然本发明已以较佳实施例揭露如上,然而并非用以限定本发明,任何熟悉本专业的技术人员,在不脱离本发明技术方案范围内,当可利用上述揭示的技术内容做出些许更动或修饰为等同变化的等效实施例,但凡是未脱离本发明技术方案内容,依据本发明的技术实质对以上实施例所作的任何简单修改、等同变化与修饰,均仍属于本发明技术方案的范围内。The above are only preferred embodiments of the present invention, and are not intended to limit the present invention in any form. Although the present invention has been disclosed above with preferred embodiments, it is not intended to limit the present invention. , without departing from the scope of the technical solution of the present invention, when the technical content disclosed above can be used to make some changes or modifications to equivalent embodiments of equivalent changes, as long as it does not depart from the technical solution content of the present invention, according to the technical solution of the present invention Substantially any simple modifications, equivalent changes and modifications made to the above embodiments still fall within the scope of the technical solutions of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110255194.XA CN115049544A (en) | 2021-03-09 | 2021-03-09 | Picture processing method and device and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110255194.XA CN115049544A (en) | 2021-03-09 | 2021-03-09 | Picture processing method and device and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115049544A true CN115049544A (en) | 2022-09-13 |
Family
ID=83156393
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110255194.XA Pending CN115049544A (en) | 2021-03-09 | 2021-03-09 | Picture processing method and device and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115049544A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005275454A (en) * | 2004-03-22 | 2005-10-06 | Fuji Photo Film Co Ltd | Image processing method, image processing system, image processing device and image processing program |
WO2014178233A1 (en) * | 2013-04-30 | 2014-11-06 | ソニー株式会社 | Image processing device, image processing method and program |
CN106327429A (en) * | 2016-10-24 | 2017-01-11 | 腾讯科技(深圳)有限公司 | Picture synthesis method and device and terminal equipment |
CN111666157A (en) * | 2020-04-03 | 2020-09-15 | 中国科学院电子学研究所苏州研究院 | Rapid processing method and system for geographic space image data |
CN112291627A (en) * | 2020-10-12 | 2021-01-29 | 广州市百果园网络科技有限公司 | Video editing method and device, mobile terminal and storage medium |
-
2021
- 2021-03-09 CN CN202110255194.XA patent/CN115049544A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005275454A (en) * | 2004-03-22 | 2005-10-06 | Fuji Photo Film Co Ltd | Image processing method, image processing system, image processing device and image processing program |
WO2014178233A1 (en) * | 2013-04-30 | 2014-11-06 | ソニー株式会社 | Image processing device, image processing method and program |
CN106327429A (en) * | 2016-10-24 | 2017-01-11 | 腾讯科技(深圳)有限公司 | Picture synthesis method and device and terminal equipment |
CN111666157A (en) * | 2020-04-03 | 2020-09-15 | 中国科学院电子学研究所苏州研究院 | Rapid processing method and system for geographic space image data |
CN112291627A (en) * | 2020-10-12 | 2021-01-29 | 广州市百果园网络科技有限公司 | Video editing method and device, mobile terminal and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7549109B2 (en) | Adaptive transfer functions for video encoding and decoding. | |
US20220408020A1 (en) | Image Processing Method, Electronic Device, and Cloud Server | |
US9692959B2 (en) | Image processing apparatus and method | |
CN110100251B (en) | Apparatus, method, and computer-readable storage medium for processing document | |
US12003850B2 (en) | Method for selecting image based on burst shooting and electronic device | |
US20210158577A1 (en) | Method for Adding Special Effect to Video, Electronic Device and Storage Medium | |
CN110933334A (en) | Video noise reduction method, device, terminal and storage medium | |
CN116055857A (en) | Photographing method and electronic equipment | |
CN105653195B (en) | Screen capturing method and mobile terminal | |
WO2022262259A1 (en) | Image processing method and apparatus, and device, medium and chip | |
CN116088832B (en) | Interface processing method and device | |
CN115049544A (en) | Picture processing method and device and computer readable storage medium | |
CN108200333B (en) | Photographing composition method and terminal | |
CN110706163A (en) | Image processing method, terminal and computer storage medium | |
CN115767285A (en) | Image shading correction method, device, storage medium and electronic equipment | |
CN114968430A (en) | Interface control method and device and electronic equipment | |
CN114979729A (en) | Video data processing method and device and vehicle |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20220913 |
|
WD01 | Invention patent application deemed withdrawn after publication |