CN110751668B - Image processing method, device, terminal, electronic equipment and readable storage medium - Google Patents
Image processing method, device, terminal, electronic equipment and readable storage medium Download PDFInfo
- Publication number
- CN110751668B CN110751668B CN201910944150.0A CN201910944150A CN110751668B CN 110751668 B CN110751668 B CN 110751668B CN 201910944150 A CN201910944150 A CN 201910944150A CN 110751668 B CN110751668 B CN 110751668B
- Authority
- CN
- China
- Prior art keywords
- area
- image
- subject
- subject area
- target operation
- 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.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 31
- 238000000034 method Methods 0.000 claims abstract description 29
- 230000008439 repair process Effects 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 13
- 238000000605 extraction Methods 0.000 claims description 13
- 239000000284 extract Substances 0.000 claims description 9
- 230000011218 segmentation Effects 0.000 claims description 7
- 230000008569 process Effects 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 10
- 238000005516 engineering process Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 239000003086 colorant Substances 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000003709 image segmentation Methods 0.000 description 3
- 210000000746 body region Anatomy 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 1
- 238000002372 labelling Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/194—Segmentation; Edge detection involving foreground-background segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/174—Segmentation; Edge detection involving the use of two or more images
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/80—Camera processing pipelines; Components thereof
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
本发明公开了一种图像处理方法、装置、终端、电子设备及计算机可读存储介质,所述方法包括:根据对同一目标对象进行图像采集而得到的第一图像和第二图像,生成视差图;在检测到用户对所述第一图像进行的预设操作时,确定所述第一图像上所述预设操作针对的目标操作区域;基于所述目标操作区域、所述视差图以及所述第一图像上各个像素点的颜色值,从所述第一图像中提取所述目标操作区域对应的图像。由于可以基于视差图确定该目标操作区域在所述第一图像上所对应的主体区域,进而提取主体区域的图像,从而在用户标记需要提取的主体区域的次数很少的情况下,提取出该主体区域的图像,提高了用户体验。
The invention discloses an image processing method, device, terminal, electronic equipment, and computer-readable storage medium. The method includes: generating a disparity map according to a first image and a second image obtained by collecting images of the same target object ; When a preset operation performed by the user on the first image is detected, determining a target operation area targeted by the preset operation on the first image; based on the target operation area, the disparity map, and the The color value of each pixel point on the first image is used to extract the image corresponding to the target operation area from the first image. Since the main body area corresponding to the target operation area on the first image can be determined based on the disparity map, and then the image of the main body area is extracted, and the number of times the user marks the main body area to be extracted is small, the extracted The image of the main area improves the user experience.
Description
技术领域technical field
本发明涉及数据处理技术领域,特别是涉及一种图像处理方法、装置、终端、电子设备及可读存储介质。The present invention relates to the technical field of data processing, in particular to an image processing method, device, terminal, electronic equipment and a readable storage medium.
背景技术Background technique
背景替换应用因支持用户根据自己的兴趣提取出前景主体区域并任意替换背景,深受广大爱扣图(一种图像处理方式,用于从原始图像中提取出用户想要的部分图像)用户的喜爱。但是,在相关的背景替换技术中,通常需要用户多次标记需提取的主体区域甚至需标记主体区域边缘才可完成主体区域的提取。此操作较为繁琐,用户易操作性不高,在需要对于一些色彩丰富场景的前景进行提取时,往往提取的主体与用户所指定的主体差异较大,导致用户体验度差。The background replacement application supports users to extract the foreground subject area according to their own interests and replace the background arbitrarily. It is popular among users of Aikoutu (an image processing method used to extract the part of the image that the user wants from the original image). favorite. However, in related background replacement technologies, the extraction of the subject area usually requires the user to mark the subject area to be extracted multiple times or even mark the edge of the subject area. This operation is relatively cumbersome, and the user's ease of operation is not high. When it is necessary to extract the foreground of some colorful scenes, the extracted subject is often quite different from the subject specified by the user, resulting in poor user experience.
发明内容Contents of the invention
鉴于上述问题,提出了本发明实施例以便提供一种克服上述问题或者至少部分地解决上述问题的一种图像处理方法、装置、终端、电子设备及可读存储介质。In view of the above problems, embodiments of the present invention are proposed to provide an image processing method, device, terminal, electronic device, and readable storage medium that overcome the above problems or at least partially solve the above problems.
本发明实施例的第一方面,提供了一种图像处理方法,所述方法包括:The first aspect of the embodiments of the present invention provides an image processing method, the method comprising:
根据对同一目标对象进行图像采集而得到的第一图像和第二图像,生成视差图;generating a disparity map according to the first image and the second image obtained by image acquisition of the same target object;
在检测到用户对所述第一图像进行的预设操作时,确定所述第一图像上所述预设操作针对的目标操作区域;When detecting a preset operation performed by the user on the first image, determining a target operation area targeted by the preset operation on the first image;
基于所述目标操作区域、所述视差图以及所述第一图像上各个像素点的颜色值,从所述第一图像中提取所述目标操作区域对应的图像。An image corresponding to the target operation area is extracted from the first image based on the target operation area, the disparity map, and the color value of each pixel on the first image.
可选地,基于所述目标操作区域、所述视差图以及所述第一图像上各个像素点的颜色值,从所述第一图像中提取所述目标操作区域对应的图像,包括:Optionally, extracting an image corresponding to the target operation area from the first image based on the target operation area, the disparity map, and the color values of each pixel on the first image includes:
基于所述目标操作区域及所述视差图,确定所述目标操作区域在所述视差图上对应的预设视差范围;Based on the target operation area and the disparity map, determine a preset disparity range corresponding to the target operation area on the disparity map;
基于所述预设视差范围、所述目标操作区域在所述第一图像上的位置,以及,所述第一图像上所述目标操作区域的各像素点的颜色值,对所述视差图进行分割,得到和除所述主体区域外的其他区域;Based on the preset disparity range, the position of the target operation area on the first image, and the color value of each pixel of the target operation area on the first image, perform a process on the disparity map segment, obtain and other regions other than said subject region;
对所述主体区域和除所述主体区域外的其他区域进行标记,得到标签图;Marking the main body area and other areas except the main body area to obtain a label map;
从所述第一图像中提取所述标签图上标记为主体区域的图像。An image marked as a subject area on the label map is extracted from the first image.
可选地,除所述主体区域外的其他区域包括:非主体区域,可能的非主体区域,可能的主体区域;对所述主体区域和除所述主体区域外的其他区域进行标记,得到标签图,包括:Optionally, other areas except the subject area include: a non-subject area, a possible non-subject area, and a possible subject area; mark the subject area and other areas except the subject area to obtain a label Figures, including:
对所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域进行标记,得到标签图。The non-subject area, the possible non-subject area, the possible subject area and the subject area are marked to obtain a label map.
可选地,基于所述预设视差范围、所述目标操作区域在所述第一图像上的位置,以及,所述第一图像上所述目标操作区域的各像素点的颜色值,对所述视差图进行分割,包括:Optionally, based on the preset parallax range, the position of the target operation area on the first image, and the color value of each pixel of the target operation area on the first image, the The disparity map is segmented, including:
确定所述视差图中属于所述预设视差范围的各个像素点;determining each pixel in the disparity map that belongs to the preset disparity range;
确定所述各个像素点中与所述目标操作区域的各像素点的颜色值的差值在预设颜色值范围内,且与所述目标操作区域的位置相隔预设距离的多个第一像素点,将所述多个第一像素点形成的区域确定为所述主体区域;Determining a plurality of first pixels whose color value difference between each pixel point and each pixel point of the target operation area is within a preset color value range, and is separated from the position of the target operation area by a preset distance points, determining an area formed by the plurality of first pixel points as the main body area;
在所述各个像素点中除所述多个第一像素点的各像素点中,确定与所述目标操作区域的各像素点的颜色值的差值在所述预设颜色值范围内或,与所述目标操作区域的位置相隔预设距离的多个第二像素点,将所述多个第二像素点形成的区域确定为所述可能的主体区域;In each of the pixels except the plurality of first pixels, it is determined that the difference between the color values of each pixel in the target operation area is within the preset color value range or, A plurality of second pixel points separated by a preset distance from the position of the target operation area, and an area formed by the plurality of second pixel points is determined as the possible subject area;
将所述各个像素点中除所述多个第一像素点及所述多个第二像素点外的剩余像素点形成的区域,确定为所述可能的非主体区域;Determining the area formed by the remaining pixels in the pixels except the plurality of first pixels and the plurality of second pixels as the possible non-subject area;
将所述视差图中不属于所述预设视差范围的各个像素点形成的区域,确定为所述非主体区域。An area formed by pixels in the disparity map that do not belong to the preset disparity range is determined as the non-subject area.
可选地,在对所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域进行标记,得到标签图之后,所述方法还包括:Optionally, after marking the non-subject area, the possible non-subject area, the possible subject area and the subject area to obtain a label map, the method further includes:
根据所述标签图和所述第一图像进行边缘修复,以确定属于所述主体区域的修复区域;performing edge inpainting according to the label map and the first image, to determine an inpainted area belonging to the subject area;
基于确定出的属于所述主体区域的修复区域,重新对所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域进行标记;re-marking the non-subject area, the possible non-subject area, the possible subject area, and the subject area based on the determined repair area belonging to the subject area;
从所述第一图像中提取所述标签图上标记为主体区域的图像,包括:Extracting the image marked as the main body area on the label map from the first image, including:
从所述第一图像中提取所述标签图上重新标记为主体区域的图像。An image relabeled as a subject region on the label map is extracted from the first image.
可选地,从所述第一图像中提取所述标签图上标记为主体区域的图像,包括:Optionally, extracting an image marked as a subject area on the label map from the first image includes:
确定所述标签图上标记为所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域各自的alpha值;其中,所述非主体区域的alpha值表征所述非主体区域是透明区域,所述主体区域的alpha值为表征所述主体区域是不透明区域,所述可能的非主体区域及所述可能的主体区域的alpha值表征所述可能的非主体区域及所述可能的主体区域是半透明区域;Determine the respective alpha values of the non-subject area, the possible non-subject area, the possible subject area, and the subject area marked on the label map; wherein the alpha value of the non-subject area represents the The non-subject area is a transparent area, the alpha value of the subject area indicates that the subject area is an opaque area, the possible non-subject area and the alpha value of the possible subject area represent the possible non-subject area and the possible subject area is a translucent area;
基于所述标签图上所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域各自的alpha值,得到alpha图像;Obtain an alpha image based on the respective alpha values of the non-subject area, the possible non-subject area, the possible subject area, and the subject area on the label map;
基于所述第一图像上各像素点的颜色值以及所述alpha图像,在所述第一图像中所述主体区域的图像。An image of the subject area in the first image based on the color value of each pixel on the first image and the alpha image.
本发明实施例的第二方面,提供一种图像处理装置,所述装置包括:According to a second aspect of the embodiments of the present invention, an image processing device is provided, and the device includes:
视差图生成模块,用于根据对同一目标对象进行图像采集而得到的第一图像和第二图像,生成视差图;A disparity map generating module, configured to generate a disparity map based on the first image and the second image obtained by image acquisition of the same target object;
目标操作区域确定模块,用于在检测到用户对所述第一图像进行的预设操作时,确定所述第一图像上所述预设操作针对的目标操作区域;A target operation area determination module, configured to determine a target operation area targeted by the preset operation on the first image when a preset operation performed by the user on the first image is detected;
图像提取模块,用于基于所述目标操作区域、所述视差图以及所述第一图像上各个像素点的颜色值,从所述第一图像中提取所述目标操作区域对应的图像。An image extraction module, configured to extract an image corresponding to the target operation area from the first image based on the target operation area, the disparity map, and the color value of each pixel on the first image.
可选地,所述图像提取模块包括:Optionally, the image extraction module includes:
视差范围确定单元,用于基于所述目标操作区域及所述视差图,确定所述目标操作区域在所述视差图上对应的预设视差范围;A disparity range determination unit, configured to determine a preset disparity range corresponding to the target operation area on the disparity map based on the target operation area and the disparity map;
区域分割单元,用于基于所述预设视差范围、所述目标操作区域在所述第一图像上的位置,以及,所述第一图像上所述目标操作区域的各像素点的颜色值,对所述视差图进行分割,得到主体区域和除所述主体区域外的其他区域;an area segmentation unit, configured to, based on the preset parallax range, the position of the target operation area on the first image, and the color value of each pixel of the target operation area on the first image, segmenting the disparity map to obtain a subject area and other areas except the subject area;
区域标记单元,用于对所述主体区域和除所述主体区域外的其他区域进行标记,得到标签图;an area marking unit, configured to mark the subject area and other areas except the subject area to obtain a label map;
主体区域提取单元,用于从所述第一图像中提取所述标签图上标记为主体区域的图像。A main body area extraction unit, configured to extract an image marked as a main body area on the label map from the first image.
可选地,除所述主体区域外的其他区域包括:非主体区域,可能的非主体区域,可能的主体区域;所述区域标记单元,具体用于对所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域进行标记,得到标签图。Optionally, other areas except the main body area include: a non-main body area, a possible non-main body area, and a possible main body area; The non-subject area, the possible subject area and the subject area are marked to obtain a label map.
所述区域分割单元包括:The area segmentation unit includes:
像素点确定子单元,用于确定所述视差图中属于所述预设视差范围的各个像素点;A pixel determination subunit, configured to determine each pixel in the disparity map belonging to the preset disparity range;
主体区域确定子单元,用于确定所述各个像素点中与所述目标操作区域的各像素点的颜色值的差值在预设颜色值范围内,且与所述目标操作区域的位置相隔预设距离的多个第一像素点,将所述多个第一像素点形成的区域确定为所述主体区域;The main body area determination subunit is configured to determine that the difference between the color values of each pixel point and each pixel point of the target operation area is within a preset color value range, and is separated from the position of the target operation area by a predetermined distance. Set a plurality of first pixel points at a distance, and determine an area formed by the plurality of first pixel points as the main body area;
第一未知区域确定子单元,用于在所述各个像素点中除所述多个第一像素点的各像素点中,确定与所述目标操作区域的各像素点的颜色值的差值在所述预设颜色值范围内或,与所述目标操作区域的位置相隔预设距离的多个第二像素点,将所述多个第二像素点形成的区域确定为所述可能的主体区域;The first unknown area determination subunit is configured to determine the difference between the color values of each pixel point in the target operation area and the color value of each pixel point in the target operation area in each pixel point except the plurality of first pixel points. A plurality of second pixel points within the preset color value range or a preset distance away from the position of the target operation area, determining an area formed by the plurality of second pixel points as the possible subject area ;
第二未知区域确定子单元,用于将所述各个像素点中除所述多个第一像素点及所述多个第二像素点外的剩余像素点形成的区域,确定为所述可能的非主体区域;The second unknown area determination subunit is configured to determine, as the possible area formed by the remaining pixels in the respective pixels except the plurality of first pixels and the plurality of second pixels, non-subject area;
非主体区域确定子单元,用于将所述视差图中不属于所述预设视差范围的各个像素点形成的区域,确定为所述非主体区域。The non-subject area determining subunit is configured to determine, as the non-subject area, an area formed by pixels in the disparity map that do not belong to the preset disparity range.
可选地,所述装置还包括:Optionally, the device also includes:
修复模块,用于根据所述标签图和所述第一图像进行边缘修复,以确定属于所述主体区域的修复区域;An inpainting module, configured to perform edge inpainting according to the label map and the first image, so as to determine an inpainted area belonging to the subject area;
更新模块,用于基于确定出的属于所述主体区域的修复区域,重新对所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域进行标记;An update module, configured to remark the non-subject area, the possible non-subject area, the possible subject area, and the subject area based on the determined repair area belonging to the subject area;
所述主体区域提取单元,具体用于从所述第一图像中提取所述标签图上重新标记为主体区域的图像。The subject region extracting unit is specifically configured to extract an image relabeled as a subject region on the label map from the first image.
可选地,所述主体区域提取单元包括:Optionally, the body region extraction unit includes:
alpha值确定子单元,用于确定所述标签图上标记为所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域各自的alpha值;其中,所述非主体区域的alpha值表征所述非主体区域是透明区域,所述主体区域的alpha值表征所述主体区域是不透明区域,所述可能的非主体区域及所述可能的主体区域的alpha值表征所述可能的非主体区域及所述可能的主体区域是半透明区域;an alpha value determining subunit, configured to determine the respective alpha values of the non-subject area, the possible non-subject area, the possible subject area, and the subject area marked on the label map; wherein, the The alpha value of the non-subject area indicates that the non-subject area is a transparent area, the alpha value of the subject area indicates that the subject area is an opaque area, and the alpha values of the possible non-subject area and the possible subject area represent The possible non-subject area and the possible subject area are translucent areas;
alpha图像生成子单元,用于基于所述标签图上所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域各自的alpha值,得到alpha图像;an alpha image generating subunit, configured to obtain an alpha image based on the respective alpha values of the non-subject area, the possible non-subject area, the possible subject area, and the subject area on the label map;
图像输出子单元,用于基于所述第一图像上各像素点的颜色值以及所述alpha图像,在所述第一图像中提取所述主体区域的图像。An image output subunit, configured to extract the image of the subject area in the first image based on the color value of each pixel on the first image and the alpha image.
本发明实施例的第三方面,提供一种图像处理终端,包括显示器及图像处理装置,所述显示器用于将对同一目标对象进行图像采集而得到的第一图像进行显示,所述图像处理装置用于执行所述的图像处理方法。The third aspect of the embodiments of the present invention provides an image processing terminal, including a display and an image processing device, the display is used to display a first image obtained by collecting images of the same target object, and the image processing device It is used to execute the image processing method described above.
本发明实施例的第四方面,提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行时实现所述的图像处理方法。According to a fourth aspect of the embodiments of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and operable on the processor. The processor implements the image processing method when executed.
本发明实施例的第五方面,提供一种计算机可读存储介质,其存储的计算机程序使得处理器执行所述的图像处理方法。According to a fifth aspect of the embodiments of the present invention, a computer-readable storage medium is provided, and a computer program stored in the storage medium causes a processor to execute the image processing method.
本发明实施例包括以下优点:Embodiments of the present invention include the following advantages:
在本发明实施例中,基于针对同一目标对象所拍摄的第一图像和第二图像生成视差图,基于该视差图和用户在第一图像上点击的目标操作区域,以及该第一图像上各个像素点的颜色值,将第一图像上与该目标操作区域对应的图像提取出来,该目标操作区域对应的图像即为用户需要提取的目标图像。由于可以基于视差图得到该目标操作区域在所述第一图像上所对应的目标图像,提取出目标操作区域对应的目标图像,从而可以减小用户标记需要提取的主体区域的次数,进而提取出该目标图像,也提高了提取出的图像与用户所指定的目标操作区域所属的目标图像之间的匹配度,进而提高了用户体验。In the embodiment of the present invention, the disparity map is generated based on the first image and the second image taken for the same target object, based on the disparity map and the target operation area clicked by the user on the first image, and each The color value of the pixel point extracts the image corresponding to the target operation area on the first image, and the image corresponding to the target operation area is the target image to be extracted by the user. Since the target image corresponding to the target operation area on the first image can be obtained based on the disparity map, the target image corresponding to the target operation area can be extracted, thereby reducing the number of times the user marks the subject area to be extracted, and then extracting The target image also improves the matching degree between the extracted image and the target image to which the target operation area designated by the user belongs, thereby improving user experience.
附图说明Description of drawings
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments of the present application. Obviously, the accompanying drawings in the following description are only some embodiments of the present application , for those skilled in the art, other drawings can also be obtained according to these drawings without paying creative labor.
图1是本发明实施例的一种图像处理方法的步骤流程图;Fig. 1 is a flow chart of the steps of an image processing method according to an embodiment of the present invention;
图2-A是发明实施例的一种图像处理方法示例的第一图像;Fig. 2-A is the first image of an example of an image processing method in an embodiment of the invention;
图2-B是发明实施例的一种图像处理方法示例的tirmap图;Fig. 2-B is the tirmap figure of a kind of image processing method example of the embodiment of the invention;
图2-C是发明实施例的一种图像处理方法示例的alpha图;Fig. 2-C is an alpha graph of an example of an image processing method of an embodiment of the invention;
图3是本发明实施例的一种图像处理方法中提取所述目标操作区域对应的图像的步骤流程图;FIG. 3 is a flow chart of steps for extracting an image corresponding to the target operation area in an image processing method according to an embodiment of the present invention;
图4是本发明实施例的一种图像处理方法中确定主体区域、非主体区域等区域的步骤流程图;FIG. 4 is a flow chart of steps for determining areas such as subject areas and non-subject areas in an image processing method according to an embodiment of the present invention;
图5是本发明实施例的一种图像处理方法中从第一图像中提取所述标签图上标记为主体区域的图像的步骤流程图;Fig. 5 is a flow chart of the steps of extracting the image marked as the subject area on the label map from the first image in an image processing method according to an embodiment of the present invention;
图6是本发明一种可选示例中图像处理方法的整体流程图;FIG. 6 is an overall flowchart of an image processing method in an optional example of the present invention;
图7是本发明实施例的一种图像处理装置的结构示意图;FIG. 7 is a schematic structural diagram of an image processing device according to an embodiment of the present invention;
图8是本发明实施例的一种电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.
相关技术中,从目标图像中提取用户指定的主体区域的图像时,需要用户多次点击和确定才能提取出对应的图像,且提取出的图像与用户所指定的主体区域的匹配度不高。本公开则提供以下所述的图像处理方法、图像处理装置、电子设备和计算机可读存储介质,以解决相关技术中存在的上述技术问题,下面,分别对所述的图像处理方法、图像处理装置、电子设备和计算机可读存储介质分别说明。In related technologies, when extracting an image of a user-designated subject area from a target image, the user needs to click and confirm multiple times to extract the corresponding image, and the extracted image does not have a high matching degree with the user-designated subject area. The present disclosure provides the following image processing method, image processing device, electronic equipment, and computer-readable storage medium to solve the above-mentioned technical problems in related technologies. Below, the image processing method and image processing device are described respectively , an electronic device, and a computer-readable storage medium are described respectively.
参照图1所示,示出了本发明实施例的一种图像处理方法的步骤流程图,如图1所示,具体可以包括以下步骤:Referring to FIG. 1 , it shows a flow chart of the steps of an image processing method according to an embodiment of the present invention. As shown in FIG. 1 , it may specifically include the following steps:
步骤S11,根据对同一目标对象进行图像采集而得到的第一图像和第二图像,生成视差图。Step S11 , generating a disparity map according to the first image and the second image obtained by collecting images of the same target object.
本实施例中,同一目标对象是指用户要拍摄的目标,可以是建筑物、风景、物体或者人物。对该目标对象可以采用双摄像头模组进行图像采集,该双摄像头模组可以是安装有两个摄像头的智能采集设备,例如,手机。该两个摄像头可以分别称为主摄像头和副摄像头,其中,主摄像头和副摄像头所采用的镜头互不相同,实际中,主摄像头可以采用长焦镜头,副摄像头可以采用广角镜头。其中,主摄像头所拍摄的目标对象的图像称为第一图像,副摄像头所拍摄的目标对象的图像称为第二图像。In this embodiment, the same target object refers to the target to be photographed by the user, which may be a building, a landscape, an object or a person. A dual-camera module may be used to collect images of the target object, and the dual-camera module may be an intelligent collection device equipped with two cameras, for example, a mobile phone. The two cameras may be called a main camera and a sub camera respectively, where the lenses used by the main camera and the sub camera are different from each other. In practice, the main camera may use a telephoto lens, and the sub camera may use a wide angle lens. Wherein, the image of the target object captured by the main camera is called a first image, and the image of the target object captured by the secondary camera is called a second image.
其中,基于第一图像和第二图像生成的视差图,可以理解为是以第一图像为基准,其大小为该第一图像的大小,元素值为视差值的图像。视差图中的各个像素点所具有的视差值可以反映第一、第二两幅图像上匹配像素点之间的距离和方向信息,相同主体的视差值近似,不同主体的视差值可能存在较大差别。如,以摆放在桌上的一盆植物为例,其对应的视差图中该植物所包括的像素点的视差值之间相差不大,其与桌子所包括的像素点相比,二者的视差值的差距则较大。Wherein, the disparity map generated based on the first image and the second image can be understood as an image based on the first image, whose size is the size of the first image, and whose element values are disparity values. The disparity value of each pixel in the disparity map can reflect the distance and direction information between the matching pixels on the first and second images, the disparity value of the same subject is similar, and the disparity value of different subjects may be There is a big difference. For example, taking a potted plant placed on a table as an example, the disparity values of the pixels included in the plant in the corresponding disparity map are not much different from each other. Compared with the pixels included in the table, the two The difference in disparity value is larger.
在一种可选示例中,可以采用相关技术中的三维重建算法生成该视差图,可选地,可以采用SGBM算法(semi-globalblock matching,半全局块匹配算法)生成针对第一图像和第二图像的视差图,该算法是一种轻量级的三维重建算法,具有视差效果好速度快的特点,可以提高生成视差图的流畅性。In an optional example, the disparity map can be generated using a 3D reconstruction algorithm in the related art. Optionally, an SGBM algorithm (semi-global block matching, semi-global block matching algorithm) can be used to generate the disparity map for the first image and the second The disparity map of the image, this algorithm is a lightweight 3D reconstruction algorithm, which has the characteristics of good parallax effect and fast speed, and can improve the fluency of generating the disparity map.
步骤S12,在检测到用户对所述第一图像进行的预设操作时,确定所述第一图像上所述预设操作针对的目标操作区域。In step S12, when a preset operation performed by the user on the first image is detected, a target operation area targeted by the preset operation on the first image is determined.
本实施例中,可以将第一图像进行存储并显示,将第二图像进行存储,这样,显示的第一图像可以供用户查看和进行一些操作,预设操作可以是用户持鼠标进行的点击操作、或持遥控器进行的遥控操作,也可以是手指的触摸操作。具体地,当用户需要将第一图像中的某一区域的图像(以下简称目标图像)从第一图像中抠取出来时,则可以采用上述任一的预设操作点击目标图像上的任一区域,进而可以将该被点击的区域确定为目标操作区域。其中,进行该预设操作的次数可以是一次或者多次。In this embodiment, the first image can be stored and displayed, and the second image can be stored. In this way, the displayed first image can be viewed and operated by the user. The preset operation can be a click operation performed by the user with a mouse , or a remote control operation performed by holding a remote controller, or a finger touch operation. Specifically, when the user needs to extract an image of a certain area in the first image (hereinafter referred to as the target image) from the first image, he can use any of the above-mentioned preset operations to click any area, and then the clicked area can be determined as the target operation area. Wherein, the number of times to perform the preset operation may be one or more times.
示例地,参照图2-A所示,示出了对自然环境中的目标植物所拍摄的第一图像的示例图,若用户想要从该第一图像中将其中的植物图像抠取,则可以利用鼠标在该第一图像上点击植物图像的任一区域,或者在植物图像的任一区域进行滑动触摸一次,譬如树叶或譬如树枝。其中,点击的次数可以是一次。For example, referring to FIG. 2-A , it shows an example diagram of the first image taken of the target plant in the natural environment. If the user wants to extract the plant image from the first image, then The mouse can be used to click on any area of the plant image on the first image, or perform a sliding touch once on any area of the plant image, such as leaves or branches. Wherein, the number of clicks may be one time.
步骤S13,基于所述目标操作区域、所述视差图以及所述第一图像上各个像素点的颜色值,从所述第一图像中提取所述目标操作区域对应的图像。Step S13 , based on the target operation area, the disparity map, and the color values of each pixel on the first image, extract an image corresponding to the target operation area from the first image.
目标操作区域对应的图像即是用户需要抠取的图像(即目标图像),本发明实施例中,可以基于该被点击的区域、视差图以及所述第一图像上各个像素点的颜色值,将目标图像从第一图像中提取出来。因可以基于视差图将目标操作区域对应的目标图像提取出来,使得用户在实际中可以在目标图像中选择任意一个区域进行一次点击,随即可以确定出被点击区域,因一个点击区域在第一图像上可能是一个完整主体的其中一部分,进而根据视差图的特性确定出该点击区域所属的完整主体,进而提取出该完整主体的图像。The image corresponding to the target operation area is the image that the user needs to extract (that is, the target image). In the embodiment of the present invention, based on the clicked area, the disparity map, and the color value of each pixel on the first image, Extract the target image from the first image. Because the target image corresponding to the target operation area can be extracted based on the disparity map, the user can actually select any area in the target image to click once, and then the clicked area can be determined, because a clicked area is in the first image. may be part of a complete subject, and then determine the complete subject to which the clicked area belongs according to the characteristics of the disparity map, and then extract the image of the complete subject.
示例地,以图2-A为例,假设用户点击了植物图像上的树干一次,则确定出目标操作区域是树干或树叶,树干和树叶属于第一图像中的植物图像的一部分,进而,可以根据视差图的特性确定出该树干在图2-A中对应的植物,图像,进而可以根据该图2-A中植物图像所包括的各个像素点的颜色值,将植物图像从图2-A中提取出来,也即是从图2-A中将植物图像的颜色值还原出来,进而实现了植物图像的提取。Exemplarily, taking Fig. 2-A as an example, assuming that the user clicks on the tree trunk on the plant image once, it is determined that the target operation area is the tree trunk or the leaves, and the tree trunk and the leaves belong to a part of the plant image in the first image, and then, can According to the characteristics of the disparity map, the corresponding plant image of the tree trunk in Fig. 2-A can be determined, and then the plant image can be transformed from Fig. 2-A according to the color value of each pixel included in the plant image in Fig. 2-A Extract it, that is, restore the color value of the plant image from Figure 2-A, and then realize the extraction of the plant image.
本发明实施例,由于基于视差图提取目标操作区域对应的图像,使得可以根据视差图将视差相近、颜色相似的同一主体的图像被提取出来,避免颜色相似但属于不同主体的目标(例如植物和桌子)一同作为一个目标被提取出来,从而提高了提取出的图像与用户所指定的目标图像之间的匹配度,进而提高了用户体验。由于可以通过用户点击的目标操作区域即确定出与目标操作区域所属的主体图像,进而可以减少点击的目标操作区域的个数,进一步减少用户标记需要提取的目标图像的次数,进一步优化了用户体验。In the embodiment of the present invention, since the image corresponding to the target operation area is extracted based on the disparity map, images of the same subject with similar disparity and similar color can be extracted according to the disparity map, avoiding objects with similar colors but belonging to different subjects (such as plants and Table) are extracted together as a target, thereby improving the matching degree between the extracted image and the target image specified by the user, thereby improving user experience. Since the main image belonging to the target operation area can be determined through the target operation area clicked by the user, the number of target operation areas clicked can be reduced, and the number of times the user needs to mark the target image to be extracted can be further reduced, thereby further optimizing the user experience. .
具体地,在一种实施方式中,如图3所示,示出了步骤S13中提取所述目标操作区域对应的图像的步骤流程图,具体可以包括以下步骤:Specifically, in one embodiment, as shown in FIG. 3 , it shows a flow chart of the steps of extracting the image corresponding to the target operation area in step S13, which may specifically include the following steps:
步骤S131,基于所述目标操作区域及所述视差图,确定所述目标操作区域在所述视差图上对应的预设视差范围。Step S131 , based on the target operation area and the disparity map, determine a preset disparity range corresponding to the target operation area on the disparity map.
在本发明实施例中,视差图是根据第一图像和第二图像生成的,实际中,视差图可以运行在后台,第一图像可以显示在前端以供用户操作,当在第一图像上确定出目标操作区域后,可以将该目标操作区域在第一图像上的位置转换为在视差图上的位置,进而确定出该目标操作区域在视差图上的视差值。具体地,可以确定出目标操作区域在第一图像上的位置坐标,进而根据第一图像和视差图之间的尺寸比例关系,将目标操作区域在第一图像上的位置坐标转换为在视差图中的位置坐标,进而确定出目标操作区域在视差图中的位置。In the embodiment of the present invention, the disparity map is generated based on the first image and the second image. In practice, the disparity map can run in the background, and the first image can be displayed on the front end for user operation. When the first image is determined After the target operation area is obtained, the position of the target operation area on the first image may be converted into a position on the disparity map, and then the disparity value of the target operation area on the disparity map is determined. Specifically, the position coordinates of the target operation region on the first image can be determined, and then according to the size ratio relationship between the first image and the disparity map, the position coordinates of the target operation region on the first image can be transformed into The position coordinates in , and then determine the position of the target operation area in the disparity map.
实际中,视差图中的各个像素点都具有各自的视差值,该视差值可以反映像素点的距离和方向信息。确定出该目标操作区域在视差图上的视差值后,则可以确定该视差值针对的预设视差范围,具体而言,视差图中在预设视差范围内的各个像素点各自的视差值与该目标操作区域在视差图上的视差值之间的差值小于预先设定的值。其中,该预设视差范围可以被称为可靠视差范围,在该可靠视差范围内的各个像素点与目标操作区域的像素点在距离和方向彼此具有整体上的相关性,即在可靠视差范围内的各个像素点与目标操作区域的像素点在实际中可能表征同一个目标图像。In practice, each pixel in the disparity map has its own disparity value, which can reflect the distance and direction information of the pixel. After the disparity value of the target operating area on the disparity map is determined, the preset disparity range targeted by the disparity value can be determined, specifically, the respective disparity values of each pixel in the disparity map within the preset disparity range The difference between the difference and the disparity value of the target operation region on the disparity map is smaller than a preset value. Wherein, the preset parallax range may be referred to as a reliable parallax range, and each pixel within the reliable parallax range has an overall correlation with each other in distance and direction from the pixel points of the target operation area, that is, within the reliable parallax range Each pixel of the target operation area may represent the same target image in practice.
步骤S132,基于所述预设视差范围、所述目标操作区域在所述第一图像上的位置,以及,所述第一图像上所述目标操作区域的各像素点的颜色值,对所述视差图进行分割,得到主体区域和除所述主体区域外的其他区域。Step S132, based on the preset parallax range, the position of the target operation area on the first image, and the color value of each pixel of the target operation area on the first image, the The disparity map is segmented to obtain the subject area and other areas except the subject area.
本发明实施例中,在确定出预设视差范围后,则可以在视差图中确定出在所述预设视差范围内且位置与目标操作区域相近及颜色相似的多个像素点,进而对视差图上确定出的各个像素点标记为主体区域,将确定出的多个像素点以外的像素点标记为其他区域。In the embodiment of the present invention, after the preset parallax range is determined, a plurality of pixel points within the preset parallax range and whose positions are close to the target operation area and have similar colors can be determined in the disparity map, and then the parallax Each pixel point determined on the figure is marked as the main body area, and the pixel points other than the determined multiple pixel points are marked as other areas.
示例地,若用户若点击了树干,则可以确定树干在视差图中的预设视差范围,在该预设视差范围内的各个像素点可能与该树干属于同一个主体,例如,树叶的像素点在预设视差范围内,树叶和树干同属植物,进而还可以根据树干在所述第一图像上的位置,以及,所述图2-A中树干各像素点的颜色值,确定出树枝、树叶、树根等,将确定出树枝、树叶、树根、树干等作为主体区域,除此之外的区域确定为其他区域。For example, if the user clicks on the tree trunk, the preset disparity range of the tree trunk in the disparity map can be determined, and each pixel within the preset disparity range may belong to the same subject as the tree trunk, for example, the pixel points of the leaves Within the preset parallax range, the leaves and the trunk belong to the same plant, and the branches and leaves can be determined according to the position of the trunk on the first image and the color values of each pixel of the trunk in Fig. 2-A. , tree roots, etc., determine branches, leaves, roots, trunks, etc. as the main area, and other areas are determined as other areas.
步骤S133,对所述主体区域和除所述主体区域外的其他区域进行标记,得到标签图。Step S133, labeling the main body area and other areas except the main body area to obtain a label map.
实际中,确定出的主体区域和除所述主体区域外的其他区域后,可以采用基于图论的图像分割算法得到上述标签图。In practice, after the main body area and other areas except the main body area are determined, an image segmentation algorithm based on graph theory can be used to obtain the above label map.
步骤S134,从所述第一图像中提取所述标签图上标记为主体区域的图像。Step S134, extracting images marked as subject regions on the label map from the first image.
本实施例中,在得到的标签图中已经对各个像素点进行了标记,标记出了主体区域和除所述主体区域外的其他区域,其中,主体区域中的像素点与目标操作区域的像素点属于同一个目标图像,则可以将该主体区域的图像从第一图像中提取出来,以实现用户点击目标操作区域而提取出该目标操作区域所属的整体的目标图像的目的。In this embodiment, each pixel point has been marked in the obtained label map, marking the main body area and other areas except the main body area, wherein the pixels in the main body area and the pixels of the target operation area If the points belong to the same target image, the image of the subject area can be extracted from the first image, so as to achieve the purpose of the user clicking the target operation area to extract the overall target image to which the target operation area belongs.
示例地,以图2-A为例,用户点击的树干,则经过上述步骤后,在标签图中的主体区域则为该树干所属的植物图像,进而可以将图2-A中的整个植物图像提取出来。For example, take Figure 2-A as an example, the tree trunk clicked by the user, after the above steps, the main area in the label map is the plant image to which the tree trunk belongs, and then the entire plant image in Figure 2-A can be Extract it.
在一种可选的实施方式中,除所述主体区域外的其他区域可以包括:非主体区域,可能的非主体区域,可能的主体区域;相应地,在一种可选的实施方式中,上述步骤S133具体可以是下述步骤S133’:In an optional implementation manner, other areas except the main body area may include: a non-main body area, a possible non-main body area, and a possible main body area; correspondingly, in an optional implementation manner, The above step S133 may specifically be the following step S133':
步骤S133’,对所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域进行标记,得到标签图。Step S133', mark the non-subject area, the possible non-subject area, the possible subject area and the subject area to obtain a label map.
确定出非主体区域、可能的非主体区域、可能的主体区域以及主体区域后,可以采用基于图论的图像分割算法得到上述标签图。After the non-subject area, possible non-subject area, possible subject area and subject area are determined, the above label map can be obtained by using an image segmentation algorithm based on graph theory.
可选地,可以采用相关技术中的grabcut得到标签图,具体而言,在采用grabcut时,是将第一图像和标记出非主体区域、可能的非主体区域、可能的主体区域以及主体区域的图像作为输入,GrabCut可根据第一图像中标记区域之间的关系来重新分配上述区域的标记,进而得到标签图。采用grabcut得到的标签图的图像尺寸较小,因此可以提高在低端图像处理终端上进行本申请的图像处理的流畅性,提高处理速度。Optionally, the label map can be obtained by using grabcut in the related art. Specifically, when using grabcut, the first image and the non-subject area, the possible non-subject area, the possible subject area and the subject area are marked out. Taking an image as input, GrabCut can redistribute the labels of the above-mentioned regions according to the relationship between the labeled regions in the first image, and then obtain the label map. The image size of the label map obtained by using grabcut is relatively small, so it can improve the fluency of the image processing of this application on the low-end image processing terminal, and improve the processing speed.
参照图4所示,示出了在除所述主体区域外的其他区域可以包括:非主体区域,可能的非主体区域,可能的主体区域的情况下,确定上述主体区域和上述其他区域的步骤流程图,如图4所示,具体可以包括以下步骤:Referring to Fig. 4, it is shown that other areas except the subject area may include: non-subject areas, possible non-subject areas, and possible subject areas, the steps of determining the above-mentioned subject area and the above-mentioned other areas The flow chart, as shown in Figure 4, may specifically include the following steps:
步骤S21,确定所述视差图中属于所述预设视差范围的各个像素点。Step S21 , determining each pixel in the disparity map that belongs to the preset disparity range.
实际中,在预设视差范围内的各个像素点各自的视差值与该目标操作区域在视差图上的视差值之间的差值小于预先设定的值。其中,预先设定的值可以根据实际需求进行设定。In practice, the difference between the disparity value of each pixel within the preset disparity range and the disparity value of the target operation area on the disparity map is smaller than a preset value. Wherein, the preset value may be set according to actual needs.
示例地,以图2-A为例,假设用户点击了树干,则可以在视差图中获取到位于该树干对应的预设视差范围内的各个像素点,因视差范围的各个像素点在实际中可能表征同一个目标图像,则可以初步确定出该树干所属的初始植物图像,进而可以将初始植物图像的各个像素点确定为属于预设视差范围的各个像素点。For example, taking Figure 2-A as an example, assuming that the user clicks on the tree trunk, each pixel within the preset disparity range corresponding to the tree trunk can be obtained in the disparity map, because each pixel in the disparity range is in the actual If it is possible to represent the same target image, the initial plant image to which the tree trunk belongs can be preliminarily determined, and then each pixel point of the initial plant image can be determined as each pixel point belonging to the preset parallax range.
步骤S22,确定所述各个像素点中与所述目标操作区域的各像素点的颜色值的差值在预设颜色值范围内,且与所述目标操作区域的位置相隔预设距离的多个第一像素点,将所述多个第一像素点形成的区域确定为所述主体区域。Step S22, determining that the difference between the color values of each pixel point and each pixel point of the target operation area is within a preset color value range, and a plurality of color values are separated from the position of the target operation area by a preset distance. The first pixel, determining the area formed by the plurality of first pixels as the main body area.
实际中,颜色值可以是指像素点当前颜色所对应的值,每种颜色的颜色值最低值为0,最高值为255。相近颜色的颜色值的差值较小,例如粉红和红色,而色调不同的颜色值的差值较大,例如红色和蓝色。这样,在预设颜色值范围内的各个像素点所形成的图像与目标操作区域的各像素点,其二者可以表征在第一图像上是同一个图像的像素点,譬如,都属于植物图像。In practice, the color value may refer to the value corresponding to the current color of the pixel point, and the lowest color value of each color is 0, and the highest value is 255. Similar colors have a small difference in color values, such as pink and red, and color values that differ in hue have a large difference, such as red and blue. In this way, the image formed by each pixel point within the preset color value range and each pixel point of the target operation area, both of which can represent the pixels of the same image on the first image, for example, both belong to the plant image .
其中,目标操作区域的位置可以是指目标操作区域在视差图上的位置坐标,具体地,可以根据目标操作区域在第一图像上的位置确定出该目标操作区域在视差图上的位置坐标,进而,可以在视差图中确定出与该目标操作区域的位置相隔预设距离的多个像素点。实际中,与目标操作区域的位置相隔预设距离的像素点,在实际中与目标操作区域表征了同一个目标图像,反映到第一图像中时,该与目标操作区域的位置相隔预设距离的像素点与目标操作区域的像素点都属于同一个目标图像,譬如,都属于植物图像。Wherein, the position of the target operation region may refer to the position coordinates of the target operation region on the disparity map, specifically, the position coordinates of the target operation region on the disparity map may be determined according to the position of the target operation region on the first image, Furthermore, a plurality of pixel points separated by a preset distance from the position of the target operation region may be determined in the disparity map. In practice, the pixel points separated from the position of the target operation area by a preset distance represent the same target image as the target operation area in practice, and when reflected in the first image, the pixel points separated from the position of the target operation area by a preset distance The pixels of and the pixels of the target operation area all belong to the same target image, for example, both belong to the plant image.
本实施方式中,确定出属于预设视差范围内的各个像素点后,为了提高抠取的图像的准确性,可以在属于预设视差范围内的各个像素点中,进一步确定出与目标操作区域在颜色和位置上相近的多个第一像素点,例如点击树干后确定的树枝区域的像素点。进而可以明确出该目标操作区域所对应的目标图像,该目标图像即为主体区域。In this embodiment, after each pixel point belonging to the preset parallax range is determined, in order to improve the accuracy of the extracted image, it is possible to further determine the target operation area among each pixel point belonging to the preset parallax range A plurality of first pixel points that are similar in color and position, for example, the pixel points of the branch area determined after clicking on the trunk. Furthermore, the target image corresponding to the target operation area can be identified, and the target image is the subject area.
步骤S23,在所述各个像素点中除所述多个第一像素点的各像素点中,确定与所述目标操作区域的各像素点的颜色值的差值在所述预设颜色值范围内或,与所述目标操作区域的位置相隔预设距离的多个第二像素点,将所述多个第二像素点形成的区域确定为所述可能的主体区域。Step S23, among the pixel points except the plurality of first pixel points, determine that the difference between the color values of each pixel point in the target operation area is within the preset color value range or, a plurality of second pixel points separated by a preset distance from the position of the target operation area, and an area formed by the plurality of second pixel points is determined as the possible subject area.
实际中,在预设视差范围内的各个像素点并不一定全都属于同一个主体(即属于该第一图像中的目标图像),因此,在明确出第一像素点后,可以在预设视差范围内的剩余像素点中,确定出颜色值的差值在预设颜色值范围内,或者,与所述目标操作区域的位置相隔预设距离的多个第二像素点,例如树叶区域的像素点。其中,多个第二像素点中的部分像素点的颜色值与目标操作区域在预设颜色值范围内,另一部份像素点的位置则与目标操作区域的位置相隔预设距离。该多个第二像素点所形成的区域可以确定为可能的主体区域,即表征该多个第二像素点可能与目标操作区域属于同一个目标图像。In practice, each pixel within the preset disparity range does not necessarily all belong to the same subject (that is, belongs to the target image in the first image). Therefore, after the first pixel is identified, the preset disparity can be Among the remaining pixels within the range, it is determined that the color value difference is within the preset color value range, or a plurality of second pixel points separated by a preset distance from the position of the target operation area, such as pixels in the leaf area point. Wherein, the color values of some of the plurality of second pixels and the target operation area are within a preset color value range, and the positions of another part of pixels are separated from the target operation area by a preset distance. The area formed by the plurality of second pixel points may be determined as a possible subject area, which means that the plurality of second pixel points may belong to the same target image as the target operation area.
步骤S24,将所述各个像素点中除所述多个第一像素点及所述多个第二像素点外的剩余像素点形成的区域,确定为所述可能的非主体区域。Step S24 , determining an area formed by the remaining pixels in the respective pixels except the plurality of first pixels and the plurality of second pixels as the possible non-subject area.
其中,可能的非主体区域表征该区域内的像素点可能与目标操作区域不属于同一个目标图像。Among them, the possible non-subject area indicates that the pixels in this area may not belong to the same target image as the target operation area.
需要说明的是,该可能的非主体区域和可能的主体区域在实际中可以是指主体区域与非主体区域之间的区域,表现为主题区域的轮廓。譬如,以图2-A为例,可能的非主体区域和可能的主体区域即表现为植物图像的所围成的区域。It should be noted that, in practice, the possible non-subject area and the possible subject area may refer to the area between the subject area and the non-subject area, represented as the outline of the subject area. For example, taking FIG. 2-A as an example, the possible non-subject area and the possible subject area represent the enclosed area of the plant image.
步骤S25,将所述视差图中不属于所述预设视差范围的各个像素点形成的区域,确定为所述非主体区域。Step S25, determining an area formed by pixels in the disparity map that do not belong to the preset disparity range as the non-subject area.
其中,非主体区域表征该区域内的像素点与目标操作区域不属于同一个目标图像。Wherein, the non-subject area indicates that the pixels in this area and the target operation area do not belong to the same target image.
采用上述步骤S21至S25确定出非主体区域、可能的非主体区域、可能的主体区域以及主体区域后,则可以采用下述步骤S133至S134所述的步骤提取目标操作区域对应的图像。After the non-subject area, possible non-subject area, possible subject area and subject area are determined by the above steps S21 to S25, the image corresponding to the target operation area can be extracted by following steps S133 to S134.
在一种实施方式中,参照图5所示,示出了步骤S134中从第一图像中提取所述标签图上标记为主体区域的图像的步骤流程图,具体可以包括以下步骤:In one embodiment, referring to FIG. 5 , it shows a flowchart of the steps of extracting the image marked as the subject area on the label map from the first image in step S134, which may specifically include the following steps:
步骤S31,确定所述标签图上标记为所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域各自的alpha值。Step S31 , determining the respective alpha values of the non-subject area, the possible non-subject area, the possible subject area and the subject area marked on the label map.
其中,所述非主体区域的alpha值表征所述非主体区域是透明区域,所述主体区域的alpha值表征所述主体区域是不透明区域,所述可能的非主体区域及所述可能的主体区域的alpha值表征所述可能的非主体区域及所述可能的主体区域是半透明区域。Wherein, the alpha value of the non-subject area indicates that the non-subject area is a transparent area, the alpha value of the subject area indicates that the subject area is an opaque area, and the possible non-subject area and the possible subject area The alpha value of indicates that the possible non-subject area and the possible subject area are translucent areas.
alpha值是指alpha通道的值,表征颜色的透明度,其值的范围为0~1,取值越大表征越不透明,例如,alpha值为0时,是全透明,当alpha值是1时,表示不透明,才是其真正的颜色。alpha值为0至1时之间的值时,表示半透明。The alpha value refers to the value of the alpha channel, representing the transparency of the color. The value ranges from 0 to 1. The larger the value, the more opaque it is. For example, when the alpha value is 0, it is fully transparent; when the alpha value is 1, Indicates opacity, which is its true color. When the alpha value is a value between 0 and 1, it means translucent.
在本申请实施例中,由于要提取出主体区域的图像,则需要将主体区域的图像原有的颜色全部体现,而其他区域的图像则不体现,因此,可以将非主体区域的alpha值确定为0,表征该非主体区域全透明,所述主体区域的alpha值确定为1,表征该主体区域完全不透明。而可能的非主体区域及可能的主体区域的alpha值可以采用相关技术中的imagematting算法确定为0-1之间的值,表征该可能的区域半透明。In the embodiment of this application, since the image of the subject area needs to be extracted, the original color of the image of the subject area needs to be fully reflected, while the images of other areas are not reflected. Therefore, the alpha value of the non-subject area can be determined If it is 0, it indicates that the non-subject area is fully transparent, and if the alpha value of the subject area is determined to be 1, it indicates that the subject area is completely opaque. The alpha value of the possible non-subject area and the possible subject area can be determined as a value between 0-1 by using the imagematting algorithm in the related art, which represents the semi-transparency of the possible area.
image matting算法的具体原理是根据可能的主体区域、可能的非主体区域和主体区域、非主体区域的空间距离以及颜色距离来计算的,若当前像素点和非主体更相似,则alpha的取值更接近0。例如,可能的非主体区域的某些像素点的alpha值越趋于0,则表征该像素点越趋于透明,当可能的主体区域的某些像素点的alpha值越趋于1,表征该像素点越趋于不透明。The specific principle of the image matting algorithm is calculated based on the possible subject area, the possible non-subject area and the subject area, the spatial distance and the color distance of the non-subject area. If the current pixel point is more similar to the non-subject area, the value of alpha closer to 0. For example, the more the alpha value of some pixels in the possible non-subject area tends to 0, the more transparent the pixel is; when the alpha value of some pixels in the possible subject area tends to 1, it indicates that the pixel is more transparent. Pixels tend to be more opaque.
步骤S32,基于所述标签图上所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域各自的alpha值,得到alpha图像。Step S32: Obtain an alpha image based on the respective alpha values of the non-subject area, the possible non-subject area, the possible subject area, and the subject area on the label map.
本发明实施例中,该alpha图像可以被称为alpha通道图,具体地,可以采用现有的生成alpha通道图的相关技术获得该alpha图像。In the embodiment of the present invention, the alpha image may be referred to as an alpha channel map. Specifically, the alpha image may be obtained by using an existing related technology for generating an alpha channel map.
步骤S33,基于所述第一图像上各像素点的颜色值以及所述alpha图像,在所述第一图像中提取所述主体区域的图像。Step S33, based on the color value of each pixel on the first image and the alpha image, extract the image of the subject area in the first image.
实际中,alpha通道和RGB三个通道一起构成了四通道的图像,在提取主体区域的图像时,可以将该alpha图像输入到alpha通道,将第一图像输入到RGB三个通道,因主体区域的alpha值为1,非主体区域的alpha值为0,则经该四通道的图像输出后,其主体区域的各个像素点的颜色值与其在第一图像上显示的颜色值一样,即主体区域各个像素点的颜色值被还原,而非主体区域显示的是蒙版的图像,即,非主体区域的各个像素点的颜色值都是背景颜色,如白色或绿色。而可能的主体区域和可能的非主体区域由于alpha值为0~1之间的值,则该两个区域的各个像素点的颜色进行半透明显示。如此,最终输出得到的图像显示的是主体区域的图像,因可能的主体区域和可能的非主体区域的像素点得到半透明展示,因此,使得主体区域的轮廓又得到柔化。In practice, the alpha channel and the three RGB channels together constitute a four-channel image. When extracting the image of the main body area, the alpha image can be input into the alpha channel, and the first image can be input into the three RGB channels. The alpha value of the main area is 1, and the alpha value of the non-subject area is 0. After the four-channel image is output, the color value of each pixel in the main area is the same as the color value displayed on the first image, that is, the main area The color value of each pixel is restored, and the non-subject area displays a masked image, that is, the color value of each pixel in the non-subject area is the background color, such as white or green. Since the alpha value of the possible subject area and the possible non-subject area is between 0 and 1, the color of each pixel in the two areas is displayed semi-transparently. In this way, the final output image shows the image of the subject area, because the pixels of possible subject areas and possible non-subject areas are displayed semi-transparently, so that the outline of the subject area is softened.
实际中,可以通过alpha通道和RGB三个通道的输出后,前端显示的即是用户需要从第一图像中抠取的目标图像。继而,用户可以根据自身需求对该抠取出来的图像进行背景替换或者边缘精修。In practice, after the alpha channel and RGB three channels are output, the front-end display is the target image that the user needs to extract from the first image. Then, users can perform background replacement or edge refinement on the extracted image according to their own needs.
在一种实施方式中,在步骤S133之后以及在步骤S134之前,还可以包括以下步骤:In one embodiment, after step S133 and before step S134, the following steps may also be included:
步骤S133’,根据所述标签图和所述第一图像进行边缘修复,以确定属于所述主体区域的修复区域。Step S133', perform edge inpainting according to the label map and the first image, so as to determine the inpainted area belonging to the subject area.
步骤S133”,基于确定出的属于所述主体区域的修复区域,重新对所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域进行标记。Step S133", based on the determined repair area belonging to the main body area, remark the non-body area, the possible non-body area, the possible main body area and the main body area.
本发明实施例中,可以基于该标签图构造三分图trimap,Trimap就是将图像中的像素归为3类:确定的前景、确定的背景和未知区域,未知区域中的像素既受到前景像素的影响,也受到背景像素的影响。本实施例中,构造trimap后得到的trimap中的前景区域即为主体区域,背景区域即为非主体区域,未知区域即为可能的非主体区域及所述可能的主体区域,通过构造trimap后,可以确定对标签图上可能的非主体区域及所述可能的主体区域进行边缘修复,具体地,可以基于trimap和shared-samplingbasedmatting算法进行边缘修复,以将可能的非主体区域及所述可能的主体区域中属于主体区域的区域(即本发明实施例所述的修复区域)确定为主体区域。In the embodiment of the present invention, the three-part graph trimap can be constructed based on the label map. Trimap is to classify the pixels in the image into three categories: the determined foreground, the determined background and the unknown area. The pixels in the unknown area are affected by the foreground pixels. Affected by background pixels. In this embodiment, the foreground area in the trimap obtained after the trimap is constructed is the subject area, the background area is the non-subject area, and the unknown area is the possible non-subject area and the possible subject area. After the trimap is constructed, It can be determined to perform edge repair on the possible non-subject area and the possible subject area on the label map, specifically, edge repair can be performed based on trimap and shared-samplingbasedmatting algorithm, so as to combine the possible non-subject area and the possible subject area The area belonging to the main body area in the area (that is, the repair area described in the embodiment of the present invention) is determined as the main body area.
采用上述技术方案时,由于基于标签图构造trimap,使得主体区域的边缘轮廓更为精细,最终提取出的主体区域的图像的轮廓也更为精细,进而进一步提高了提取出的图像与原第一图像上目标图像的匹配度和真实度。When the above technical solution is adopted, since the trimap is constructed based on the label map, the edge contour of the main body area is finer, and the contour of the finally extracted image of the main body area is also finer, which further improves the extracted image and the original first. The degree of matching and realism of the target image on the image.
示例地,以图2-A为例,该标签图构造trimap后的trimap图如图2-B所示,基于trimap图、彩色图和边缘修复后,最终得到的alpha图像如图2-C所示,可见,经过边缘修复后,该2-C得到的alpha图像的边缘轮廓非常精细,从而使得最终输出的植物图像与原图2-A中的植物图更为匹配,还原度更高。For example, taking Figure 2-A as an example, the trimap image constructed from the label image is shown in Figure 2-B, and the final alpha image obtained based on the trimap image, color image and edge repair is shown in Figure 2-C It can be seen that after edge restoration, the edge profile of the alpha image obtained in 2-C is very fine, so that the final output plant image matches the plant image in the original Figure 2-A more closely, and the degree of restoration is higher.
相应地,则上述步骤S134则可以采用以下步骤所描述的方法提取所述主体区域的图像:Correspondingly, the above step S134 can use the method described in the following steps to extract the image of the subject area:
步骤S134’,从所述第一图像中提取所述标签图上重新标记为主体区域的图像。Step S134', extracting from the first image the image relabeled as the subject area on the label map.
该步骤S134’的具体内容与步骤S134相似,具体可以参照步骤S134即可,在此不再赘述。The specific content of the step S134' is similar to that of the step S134, and details can be referred to the step S134, which will not be repeated here.
参考图6所示,示出了一种可选示例的图像处理方法的完整流程图,该可选以从图2-A所示的第一图像提取其中的植物图像为例进行说明,其中,针对图2-A中的目标对象所拍摄的第二图像被缓存在内存中,该具体地过程如下:Referring to FIG. 6 , it shows a complete flow chart of an optional example image processing method. This option is described by extracting a plant image from the first image shown in FIG. 2-A as an example, wherein, The second image taken for the target object in Fig. 2-A is cached in memory, and the specific process is as follows:
首先,针对该第一图像和第二图像,使用经典三维重建算法,如SGBM算法生成视差图。First, for the first image and the second image, a classic 3D reconstruction algorithm, such as the SGBM algorithm, is used to generate a disparity map.
其次,确定用户在第一图像上点击的目标操作区域,提取主体区域、非主体区域、可能为主体的区域(即为可能的主体区域)和可能为非主体的区域(可能的非主体区域)。Secondly, determine the target operation area clicked by the user on the first image, extract the subject area, non-subject area, possibly the subject area (that is, the possible subject area) and the possibly non-subject area (possible non-subject area) .
接着,采用基于图论的图像分割算法,如Grabcut算法进行粗分割,得到标签图。Then, the image segmentation algorithm based on graph theory, such as the Grabcut algorithm, is used for rough segmentation to obtain the label map.
然后,基于该标签图构造trimap,得到如图2-B所示的trimap图,其中,标签图中的主体区域为trimap图中的前景区域,非主体区域为trimap图中的背景区域,可能的主体区域和可能的非主体区域为trimap图中的未知区域,也即是图中的灰度区域。Then, construct a trimap based on the label map, and obtain a trimap map as shown in Figure 2-B, where the subject area in the label map is the foreground area in the trimap map, and the non-subject area is the background area in the trimap map. The subject area and possible non-subject area are the unknown areas in the trimap map, that is, the grayscale area in the map.
接着,基于trimap,进一步对主体区域进行边缘修复,将可能的主体区域和可能的非主体区域中属于主体区域的修复区域标记为主体区域,进而实现了对trimap图中未知区域的修复,也即是边缘修复,基于该修复后的结果,最终得到alpha图像。在该alpha图像中主体区域的alpha值为1,非主体区域的alpha值为0,未知区域(包括可能的主体区域和可能的非主体区域)的alpha值可以采用image matting计算得到为0-1之间的值。Then, based on the trimap, the edge repair of the main body area is further carried out, and the repair area belonging to the main body area among the possible main body area and the possible non-subject area is marked as the main body area, and then the repair of the unknown area in the trimap map is realized, that is, is the edge repair, and based on the repaired result, an alpha image is finally obtained. In the alpha image, the alpha value of the subject area is 1, the alpha value of the non-subject area is 0, and the alpha value of the unknown area (including possible subject areas and possible non-subject areas) can be calculated as 0-1 by using image matting value between.
最后,将alpha图像输入alpha通道(即为图6所述的将alpha图像作为彩色图的第四个通道输出)、第一图像输入RGB通道,从而在显示屏上显示出了主体区域的图像,也即是显示了图2-A中的植物图像。Finally, the alpha image is input to the alpha channel (that is, the alpha image is output as the fourth channel of the color map as described in Figure 6), and the first image is input to the RGB channel, thereby displaying the image of the main body area on the display screen. That is, the plant image in Fig. 2-A is displayed.
需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明实施例并不受所描述的动作顺序的限制,因为依据本发明实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本发明实施例所必须的。It should be noted that, for the method embodiment, for the sake of simple description, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiment of the present invention is not limited by the described action sequence, because According to the embodiment of the present invention, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
参考图7,示出了本发明实施例的一种图像处理装置,所述装置具体可以包括以下模块:Referring to FIG. 7, an image processing device according to an embodiment of the present invention is shown, and the device may specifically include the following modules:
视差图生成模块71,用于根据对同一目标对象进行图像采集而得到的第一图像和第二图像,生成视差图;A disparity
目标操作区域确定模块72,用于在检测到用户对所述第一图像进行的预设操作时,确定所述第一图像上所述预设操作针对的目标操作区域;A target operation
图像提取模块73,用于基于所述目标操作区域、所述视差图以及所述第一图像上各个像素点的颜色值,从所述第一图像中提取所述目标操作区域对应的图像。An
在一种实施方式中,所述图像提取模块可以包括:In one embodiment, the image extraction module may include:
视差范围确定单元,用于基于所述目标操作区域及所述视差图,确定所述目标操作区域在所述视差图上对应的预设视差范围;A disparity range determination unit, configured to determine a preset disparity range corresponding to the target operation area on the disparity map based on the target operation area and the disparity map;
区域分割单元,用于基于所述预设视差范围、所述目标操作区域在所述第一图像上的位置,以及,所述第一图像上所述目标操作区域的各像素点的颜色值,对所述视差图进行分割,得到主体区域和除所述主体区域外的其他区域;an area segmentation unit, configured to, based on the preset parallax range, the position of the target operation area on the first image, and the color value of each pixel of the target operation area on the first image, segmenting the disparity map to obtain a subject area and other areas except the subject area;
区域标记单元,用于对所述主体区域和除所述主体区域外的其他区域进行标记,得到标签图;an area marking unit, configured to mark the subject area and other areas except the subject area to obtain a label map;
主体区域提取单元,用于从所述第一图像中提取所述标签图上标记为主体区域的图像。A main body area extraction unit, configured to extract an image marked as a main body area on the label map from the first image.
在一种实施方式中,除所述主体区域外的其他区域可以包括:非主体区域,可能的非主体区域,可能的主体区域;所述区域标记单元,具体用于对所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域进行标记,得到标签图。In one embodiment, other areas except the main body area may include: a non-main body area, a possible non-main body area, and a possible main body area; the area marking unit is specifically used to mark the non-main body area, The possible non-subject area, the possible subject area and the subject area are marked to obtain a label map.
所述区域分割单元可以包括:The area segmentation unit may include:
像素点确定子单元,用于确定所述视差图中属于所述预设视差范围的各个像素点;A pixel determination subunit, configured to determine each pixel in the disparity map belonging to the preset disparity range;
主体区域确定子单元,用于确定所述各个像素点中与所述目标操作区域的各像素点的颜色值的差值在预设颜色值范围内,且与所述目标操作区域的位置相隔预设距离的多个第一像素点,将所述多个第一像素点形成的区域确定为所述主体区域;The main body area determination subunit is configured to determine that the difference between the color values of each pixel point and each pixel point of the target operation area is within a preset color value range, and is separated from the position of the target operation area by a predetermined distance. Set a plurality of first pixel points at a distance, and determine an area formed by the plurality of first pixel points as the main body area;
第一未知区域确定子单元,用于在所述各个像素点中除所述多个第一像素点的各像素点中,确定与所述目标操作区域的各像素点的颜色值的差值在所述预设颜色值范围内或,与所述目标操作区域的位置相隔预设距离的多个第二像素点,将所述多个第二像素点形成的区域确定为所述可能的主体区域;The first unknown area determination subunit is configured to determine the difference between the color values of each pixel point in the target operation area and the color value of each pixel point in the target operation area in each pixel point except the plurality of first pixel points. A plurality of second pixel points within the preset color value range or a preset distance away from the position of the target operation area, determining an area formed by the plurality of second pixel points as the possible subject area ;
第二未知区域确定子单元,用于将所述各个像素点中除所述多个第一像素点及所述多个第二像素点外的剩余像素点形成的区域,确定为所述可能的非主体区域;The second unknown area determination subunit is configured to determine, as the possible area formed by the remaining pixels in the respective pixels except the plurality of first pixels and the plurality of second pixels, non-subject area;
非主体区域确定子单元,用于将所述视差图中不属于所述预设视差范围的各个像素点形成的区域,确定为所述非主体区域。The non-subject area determining subunit is configured to determine, as the non-subject area, an area formed by pixels in the disparity map that do not belong to the preset disparity range.
在一种实施方式中,所述装置还可以包括以下模块:In one embodiment, the device may also include the following modules:
修复模块,用于根据所述标签图和所述第一图像进行边缘修复,以确定属于所述主体区域的修复区域;An inpainting module, configured to perform edge inpainting according to the label map and the first image, so as to determine an inpainted area belonging to the subject area;
更新模块,用于基于确定出的属于所述主体区域的修复区域,重新对所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域进行标记;An update module, configured to remark the non-subject area, the possible non-subject area, the possible subject area, and the subject area based on the determined repair area belonging to the subject area;
所述主体区域提取单元,具体用于从所述第一图像中提取所述标签图上重新标记为主体区域的图像。The subject region extracting unit is specifically configured to extract an image relabeled as a subject region on the label map from the first image.
在一种实施方式中,所述主体区域提取单元可以包括:In one embodiment, the body region extraction unit may include:
alpha值确定子单元,用于确定所述标签图上标记为所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域各自的alpha值;其中,所述非主体区域的alpha值表征所述非主体区域是透明区域,所述主体区域的alpha值表征所述主体区域是不透明区域,所述可能的非主体区域及所述可能的主体区域的alpha值表征所述可能的非主体区域及所述可能的主体区域是半透明区域;an alpha value determining subunit, configured to determine the respective alpha values of the non-subject area, the possible non-subject area, the possible subject area, and the subject area marked on the label map; wherein, the The alpha value of the non-subject area indicates that the non-subject area is a transparent area, the alpha value of the subject area indicates that the subject area is an opaque area, and the alpha values of the possible non-subject area and the possible subject area represent The possible non-subject area and the possible subject area are translucent areas;
alpha图像生成子单元,用于基于所述标签图上所述非主体区域、所述可能的非主体区域、所述可能的主体区域以及所述主体区域各自的alpha值,得到alpha图像;an alpha image generating subunit, configured to obtain an alpha image based on the respective alpha values of the non-subject area, the possible non-subject area, the possible subject area, and the subject area on the label map;
图像输出子单元,用于基于所述第一图像上各像素点的颜色值以及所述alpha图像,在所述第一图像中提取所述主体区域的图像。An image output subunit, configured to extract the image of the subject area in the first image based on the color value of each pixel on the first image and the alpha image.
对于图像处理装置实施例而言,由于其与图像处理方法实施例基本相似,所以描述的比较简单,相关之处参见图像处理方法实施例的部分说明即可。As for the embodiment of the image processing apparatus, since it is basically similar to the embodiment of the image processing method, the description is relatively simple, and for related parts, refer to the part of the description of the embodiment of the image processing method.
本发明实施例还提供了一种图像处理终端,包括显示器及图像处理装置,所述显示器用于将对同一目标对象进行图像采集而得到的第一图像进行显示,所述图像处理装置用于执行上述实施例所述的图像处理方法。An embodiment of the present invention also provides an image processing terminal, including a display and an image processing device, the display is used to display the first image obtained by collecting images of the same target object, and the image processing device is used to execute The image processing method described in the above-mentioned embodiments.
参考图8,示出了本发明实施例的一种电子设备800的结构示意图,该电子设备800可以用于进行图像处理,可以包括存储器81、处理器82及存储在存储器81上并可在处理器上运行的计算机程序,所述处理器82被配置为执行所述的图像处理方法。Referring to FIG. 8 , a schematic structural diagram of an
本发明实施例还提供了一种计算机可读存储介质,其上存储的计算机程序使得处理器执行所述的图像处理方法。An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored to enable a processor to execute the image processing method.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other.
本领域内的技术人员应明白,本发明实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本发明实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, devices, or computer program products. Accordingly, embodiments of the invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本发明实施例是参照根据本发明实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。Embodiments of the present invention are described with reference to flowcharts and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor or processor of other programmable data processing terminal equipment to produce a machine such that instructions executed by the computer or processor of other programmable data processing terminal equipment Produce means for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the The instruction means implements the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded into a computer or other programmable data processing terminal equipment, so that a series of operational steps are performed on the computer or other programmable terminal equipment to produce computer-implemented processing, thereby The instructions executed above provide steps for implementing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
尽管已描述了本发明实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明实施例范围的所有变更和修改。Having described preferred embodiments of embodiments of the present invention, additional changes and modifications to these embodiments can be made by those skilled in the art once the basic inventive concept is appreciated. Therefore, the appended claims are intended to be construed to cover the preferred embodiment and all changes and modifications which fall within the scope of the embodiments of the present invention.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or terminal equipment comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements identified, or also include elements inherent in such a process, method, article, or end-equipment. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or terminal device comprising said element.
以上对本发明所提供的一种图像处理方法、装置、终端、电子设备及可读存储介质进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The image processing method, device, terminal, electronic equipment and readable storage medium provided by the present invention have been introduced in detail above. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The above embodiments The description is only used to help understand the method of the present invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary , the contents of this specification should not be construed as limiting the present invention.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910944150.0A CN110751668B (en) | 2019-09-30 | 2019-09-30 | Image processing method, device, terminal, electronic equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910944150.0A CN110751668B (en) | 2019-09-30 | 2019-09-30 | Image processing method, device, terminal, electronic equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110751668A CN110751668A (en) | 2020-02-04 |
CN110751668B true CN110751668B (en) | 2022-12-27 |
Family
ID=69277653
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910944150.0A Active CN110751668B (en) | 2019-09-30 | 2019-09-30 | Image processing method, device, terminal, electronic equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110751668B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111640123B (en) * | 2020-05-22 | 2023-08-11 | 北京百度网讯科技有限公司 | Method, device, equipment and medium for generating background-free image |
CN111754521B (en) * | 2020-06-17 | 2024-06-25 | Oppo广东移动通信有限公司 | Image processing method and device, electronic equipment and storage medium |
CN112150464B (en) * | 2020-10-23 | 2024-01-30 | 腾讯科技(深圳)有限公司 | Image detection method and device, electronic equipment and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105046689A (en) * | 2015-06-24 | 2015-11-11 | 北京工业大学 | Method for fast segmenting interactive stereo image based on multilayer graph structure |
CN106327473A (en) * | 2016-08-10 | 2017-01-11 | 北京小米移动软件有限公司 | Method and device for acquiring foreground images |
CN106355583A (en) * | 2016-08-30 | 2017-01-25 | 成都丘钛微电子科技有限公司 | Image processing method and device |
CN107301642A (en) * | 2017-06-01 | 2017-10-27 | 中国人民解放军国防科学技术大学 | A kind of full-automatic prospect background segregation method based on binocular vision |
CN107808137A (en) * | 2017-10-31 | 2018-03-16 | 广东欧珀移动通信有限公司 | Image processing method, device, electronic equipment and computer-readable recording medium |
CN108848367A (en) * | 2018-07-26 | 2018-11-20 | 宁波视睿迪光电有限公司 | A kind of method, device and mobile terminal of image procossing |
CN109389664A (en) * | 2017-08-04 | 2019-02-26 | 腾讯科技(深圳)有限公司 | Model pinup picture rendering method, device and terminal |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103955890B (en) * | 2014-05-29 | 2017-01-11 | 浙江工商大学 | Stereoscopic image restoration method |
EP3070669A1 (en) * | 2015-03-18 | 2016-09-21 | Thomson Licensing | Method and apparatus for color smoothing in an alpha matting process |
CN107977940B (en) * | 2017-11-30 | 2020-03-17 | Oppo广东移动通信有限公司 | Background blurring processing method, device and equipment |
CN109727192B (en) * | 2018-12-28 | 2023-06-27 | 北京旷视科技有限公司 | Method and device for image processing |
CN110059212A (en) * | 2019-03-16 | 2019-07-26 | 平安科技(深圳)有限公司 | Image search method, device, equipment and computer readable storage medium |
-
2019
- 2019-09-30 CN CN201910944150.0A patent/CN110751668B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105046689A (en) * | 2015-06-24 | 2015-11-11 | 北京工业大学 | Method for fast segmenting interactive stereo image based on multilayer graph structure |
CN106327473A (en) * | 2016-08-10 | 2017-01-11 | 北京小米移动软件有限公司 | Method and device for acquiring foreground images |
CN106355583A (en) * | 2016-08-30 | 2017-01-25 | 成都丘钛微电子科技有限公司 | Image processing method and device |
CN107301642A (en) * | 2017-06-01 | 2017-10-27 | 中国人民解放军国防科学技术大学 | A kind of full-automatic prospect background segregation method based on binocular vision |
CN109389664A (en) * | 2017-08-04 | 2019-02-26 | 腾讯科技(深圳)有限公司 | Model pinup picture rendering method, device and terminal |
CN107808137A (en) * | 2017-10-31 | 2018-03-16 | 广东欧珀移动通信有限公司 | Image processing method, device, electronic equipment and computer-readable recording medium |
CN108848367A (en) * | 2018-07-26 | 2018-11-20 | 宁波视睿迪光电有限公司 | A kind of method, device and mobile terminal of image procossing |
Also Published As
Publication number | Publication date |
---|---|
CN110751668A (en) | 2020-02-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10762608B2 (en) | Sky editing based on image composition | |
CN107169487B (en) | Salient object detection method based on superpixel segmentation and depth feature positioning | |
US10824910B2 (en) | Image processing method, non-transitory computer readable storage medium and image processing system | |
CN102034247B (en) | Motion capture method for binocular vision image based on background modeling | |
CN110751668B (en) | Image processing method, device, terminal, electronic equipment and readable storage medium | |
CN107516319A (en) | A high-precision and simple interactive map-matching method, storage device and terminal | |
CN110956681B (en) | Portrait background automatic replacement method combining convolution network and neighborhood similarity | |
CN102831584B (en) | Data-driven object image restoring system and method | |
CN110738676A (en) | A GrabCut Automatic Segmentation Algorithm Combining RGBD Data | |
CN109525786B (en) | Video processing method and device, terminal equipment and storage medium | |
WO2018053952A1 (en) | Video image depth extraction method based on scene sample library | |
CN107203742B (en) | A gesture recognition method and device based on salient feature point extraction | |
CN103116754A (en) | Batch image segmentation method and batch image segmentation system based on recognition models | |
CN104616247B (en) | A kind of method for map splicing of being taken photo by plane based on super-pixel SIFT | |
CN111161219B (en) | Robust monocular vision SLAM method suitable for shadow environment | |
CN111046976A (en) | A virtual manicure try-on method based on deep learning | |
Du et al. | Double-channel guided generative adversarial network for image colorization | |
CN107886471A (en) | A kind of unnecessary object minimizing technology of photo based on super-pixel Voting Model | |
CN111738964A (en) | Image data enhancement method based on modeling | |
CN109300169B (en) | Semitransparent image color migration method based on linear transformation | |
Garcia-Garcia et al. | Multi-sensor 3D object dataset for object recognition with full pose estimation | |
Liu et al. | Stereo-based bokeh effects for photography | |
CN114782714A (en) | Image matching method and device based on context information fusion | |
CN111080748B (en) | Automatic picture synthesizing system based on Internet | |
Zou et al. | Automatic inpainting by removing fence-like structures in RGBD images |
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 | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20241209 Address after: No. 257, 2nd Floor, Building 9, No. 2 Huizhu Road, Liangjiang New District, Yubei District, Chongqing 401120 Patentee after: Force Map New (Chongqing) Technology Co.,Ltd. Country or region after: China Address before: 100086 316-318, block a, Rongke Information Center, No.2, south academy of Sciences Road, Haidian District, Beijing Patentee before: MEGVII (BEIJING) TECHNOLOGY Co.,Ltd. Country or region before: China |