Focusing method and device and electronic equipment

文档序号:1894993 发布日期:2021-11-26 浏览:16次 中文

阅读说明:本技术 一种对焦方法、装置及电子设备 (Focusing method and device and electronic equipment ) 是由 马彦鹏 申金晟 张伟成 于 2020-03-10 设计创作,主要内容包括:本申请实施例公开了一种对焦方法、装置及电子设备,涉及图像处理领域,能够提升对拍摄目标的对焦准确度,进而实现对拍摄目标的清晰拍摄,以提高拍摄图像的图像质量以及拍摄的成片率。具体方案为:生成第一图像,所述第一图像包括拍摄目标的图像;在该第一图像中确定目标位置。根据该目标位置将该第一图像划分为P个背景区域,目标区域以及Q个未标记区域。根据该P个背景区域将该Q个未标记区域中一个或多个区域合并到该P个背景区域中的至少一个背景区域中。将该Q个未标记区域中除了该一个或多个区域之外的至少一个未标记区域合并到该目标区域,以获得包括该拍摄目标的感兴趣区域(ROI)。根据ROI确定对焦区域,该对焦区域包括该ROI的至少部分。(The embodiment of the application discloses a focusing method, a focusing device and electronic equipment, relates to the field of image processing, and can improve the focusing accuracy of a shot target so as to clearly shoot the shot target, so that the image quality of the shot image and the shooting filming rate are improved. The specific scheme is as follows: generating a first image including an image of a photographic target; a target location is determined in the first image. The first image is divided into P background areas, a target area and Q unmarked areas according to the target position. Merging one or more of the Q unmarked regions into at least one of the P background regions according to the P background regions. At least one of the Q unmarked regions other than the one or more regions is merged to the target region to obtain a region of interest (ROI) including the photographic object. A focus region is determined from the ROI, the focus region including at least a portion of the ROI.)

A focusing method, the method comprising:

generating a first image including an image of a photographic target;

determining a target location in the first image;

dividing the first image into P background areas, a target area and Q unmarked areas according to the target position; wherein the target region comprises the target position, the Q unmarked regions are Q regions of the first image except the P background regions and the target region, and P and Q are positive integers;

merging one or more of the Q unmarked regions into at least one of the P background regions according to the P background regions;

merging at least one unmarked region of the Q unmarked regions except the one or more regions into the target region to obtain a region of interest (ROI) comprising the photographing target;

determining a focus region from the ROI, the focus region comprising at least a portion of the ROI.

The method of claim 1, wherein any one of the P background regions is in contact with an edge of the first image.

The method of claim 1 or 2, wherein the determining a target location in the first image comprises:

and determining a preset position in the first image as the target position.

The method of claim 1 or 2, wherein determining a target location in the first image comprises:

and determining the position corresponding to the indication in the first image as the target position according to the indication of the user.

The method according to any one of claims 1-4, wherein said dividing said first image sum into P background regions, target regions and Q unmarked regions according to said target position comprises:

performing superpixel segmentation on the first image to obtain M regions, wherein M is an integer greater than or equal to 3;

acquiring the target areas in the M areas according to the target positions;

acquiring the P background areas from the M areas;

determining the Q regions of the M regions other than the P background regions and the target region as the Q unmarked regions.

The method according to any one of claims 1-5, wherein said merging one or more of said Q unmarked regions into at least one of said P background regions according to said P background regions comprises performing at least one of the following merging operations:

determining, for each of the P background regions, whether there is a first region that is an unmarked region and adjacent to the each background region and has the highest feature similarity to the each background region in at least one first adjacent region adjacent to the each background region;

merging the first area to the each background area when the first area exists.

The method of claim 6, wherein each time a merge operation is performed, the method further comprises:

for each unmarked region of one or more unmarked regions of the Q unmarked regions other than the first region, determining whether a second region exists, the second region being an unmarked region and adjacent to the each unmarked region, and the second region having a highest feature similarity with the each unmarked region in at least one second adjacent region adjacent to the each unmarked region;

merging the second region to the each unmarked region when the second region is present.

The method of any one of claims 1-7, wherein the focusing region is a rectangular focusing window, the rectangular focusing window comprising four sides, each of the four sides having a number of pixels coinciding with the ROI that is less than a preset threshold.

The focusing device is characterized by comprising a generating unit, a determining unit, an acquiring unit and a combining unit;

the generation unit is used for generating a first image, and the first image comprises an image of a shooting target;

the determining unit is used for determining a target position in the first image;

the acquisition unit is used for dividing the first image into P background areas, a target area and Q unmarked areas according to the target position; wherein the target region comprises the target position, the Q unmarked regions are Q regions of the first image except the P background regions and the target region, and P and Q are positive integers;

the merging unit is used for merging one or more of the Q unmarked regions into at least one of the P background regions according to the P background regions;

the merging unit is further used for merging at least one unmarked region except the one or more regions in the Q unmarked regions into the target region to obtain a region of interest (ROI) comprising the shooting target;

the determination unit is further configured to determine a focusing region according to the ROI, where the focusing region includes at least a portion of the ROI.

The apparatus of claim 9, wherein any one of the P background regions is in contact with an edge of the first image.

The apparatus of claim 9 or 10,

the determining unit is configured to determine a preset position in the first image as the target position.

The apparatus of claim 9 or 10,

the determining unit is configured to determine, according to an instruction of a user, a position in the first image corresponding to the instruction as the target position.

The apparatus according to any one of claims 9-12,

the acquisition unit is used for performing superpixel segmentation on the first image to obtain M areas, wherein M is an integer greater than or equal to 3;

the acquisition unit is further configured to acquire the target area from the M areas according to the target position;

the acquiring unit is further configured to acquire the P background areas in the M areas;

the obtaining unit is further configured to determine the Q regions of the M regions, except for the P background regions and the target region, as the Q unmarked regions.

The apparatus according to any one of claims 9-13,

the merging unit is configured to perform, for at least one background region of the P background regions, at least one merging operation as follows:

determining whether there is a first region which is an unmarked region and is adjacent to the each background region, and the feature similarity of the first region and the each background region is highest in at least one first adjacent region adjacent to the each background region;

merging the first area to the each background area when the first area exists.

The apparatus of claim 14,

the merging unit is further configured to determine, for each unmarked area of one or more unmarked areas of the Q unmarked areas except the first area, whether a second area exists, which is an unmarked area and is adjacent to the each unmarked area, and the second area has the highest feature similarity with the each unmarked area in at least one second adjacent area adjacent to the each unmarked area, every time a merging operation is performed;

merging the second region to the each unmarked region when the second region is present.

The apparatus of any one of claims 9-15, wherein the focusing region is a rectangular focusing window, the rectangular focusing window comprising four sides, each of the four sides having a number of pixels coinciding with the ROI that is less than a preset threshold.

An electronic device, comprising one or more processors and one or more memories; the memory coupled with the processor, the memory storing computer instructions;

the computer instructions, when executed by the processor, cause the electronic device to perform the focusing method of any of claims 1-8.

A computer-readable storage medium comprising computer instructions which, when executed, perform a focusing method as recited in any one of claims 1-8.

A chip system, comprising processing circuitry and an interface; the processing circuit is used for calling and running a computer program stored in a storage medium from the storage medium to execute the focusing method according to any one of claims 1 to 8.

46页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:折叠式相机和包括该折叠式相机的电子设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!