CN115019023A - Image processing method and device, storage medium and electronic equipment - Google Patents

Image processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN115019023A
CN115019023A CN202210599294.9A CN202210599294A CN115019023A CN 115019023 A CN115019023 A CN 115019023A CN 202210599294 A CN202210599294 A CN 202210599294A CN 115019023 A CN115019023 A CN 115019023A
Authority
CN
China
Prior art keywords
image
channel
convolution kernel
convolution
identified
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210599294.9A
Other languages
Chinese (zh)
Inventor
潘威滔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202210599294.9A priority Critical patent/CN115019023A/en
Publication of CN115019023A publication Critical patent/CN115019023A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides an image processing method and device, a storage medium and an electronic device, wherein the method comprises the following steps: responding to a fuzzy image identification instruction, and acquiring an original image to be processed; preprocessing the original image to obtain an image to be identified; processing the image to be identified by utilizing a plurality of preset convolution cores to obtain a characteristic diagram of the image to be identified; calculating the variance of each pixel in the feature map; and determining the original image as a blur image under the condition that the variance is less than or equal to a preset blur threshold value. By applying the image processing method provided by the invention, the image to be recognized can be processed through a plurality of convolution kernels to obtain the characteristic diagram, and then the variance of each pixel of the characteristic diagram is compared with the preset fuzzy threshold value, so that whether the original image is the fuzzy diagram can be rapidly and accurately determined.

Description

Image processing method and device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to an image processing method and apparatus, a storage medium, and an electronic device.
Background
In some business scenarios, for example, in an after-sales service scenario, a technician is usually required to upload a picture related to the after-sales service, and the background manually audits the picture.
However, when a technician calls an after-market app to take a picture, a blurred picture is often generated due to camera shake, and in this case, the technician generally subjectively determines whether the picture is blurred, so that the blurred picture is easily uploaded, and the background cannot finish checking the picture content.
Disclosure of Invention
The invention aims to provide an image processing method which can accurately identify a fuzzy image.
The invention also provides an image processing device for ensuring the realization and the application of the method in practice.
An image processing method comprising:
responding to a fuzzy image identification instruction, and acquiring an original image to be processed;
preprocessing the original image to obtain an image to be identified;
processing the image to be identified by utilizing a plurality of preset convolution cores to obtain a characteristic diagram of the image to be identified;
calculating the variance of each pixel in the feature map;
and determining the original image as a blur image under the condition that the variance is less than or equal to a preset blur threshold value.
Optionally, in the method, processing the image to be recognized by using a plurality of preset convolution kernels to obtain a feature map of the image to be recognized includes:
determining a convolution kernel template corresponding to the image to be identified; the channel sequence of the image to be identified is consistent with the image channel processing sequence corresponding to the convolution kernel template; the convolution kernel template comprises a plurality of preset single-channel convolution kernels and a plurality of preset multi-channel convolution kernels;
processing the image to be identified by utilizing each single-channel convolution kernel in the convolution kernel template to obtain an initial characteristic diagram;
and processing the initial characteristic diagram by using each multi-channel convolution kernel in the convolution kernel template to obtain the characteristic diagram of the image to be identified.
Optionally, in the method, the processing the image to be recognized by using each single-channel convolution kernel in the convolution kernel template to obtain an initial feature map includes:
performing convolution operation on the N multiplied by M convolution kernel in the convolution kernel template in the first direction of each channel of the image to be recognized to obtain a first feature subgraph corresponding to each channel of the image to be recognized; n and M are positive integers;
combining the first feature subgraphs corresponding to each channel of the image to be recognized according to the sequence of the channels to obtain a first feature graph;
performing convolution operation on an M multiplied by N convolution kernel in the convolution kernel template in a second direction of each channel of the first feature map to obtain a second feature sub-map corresponding to each channel of the first feature map;
and combining the second characteristic subgraphs corresponding to each channel of the first characteristic graph according to the sequence of the channels to obtain an initial characteristic graph.
Optionally, in the method, processing the image to be identified by using each multi-channel convolution kernel in the convolution kernel template to obtain the feature map of the original image includes:
performing convolution operation on each channel of the initial feature map by using an M multiplied by N convolution kernel in the convolution kernel template to obtain a second feature map; n and M are positive integers;
and carrying out convolution operation on each channel of the second characteristic diagram by using the NxNxM convolution core in the convolution core template to obtain the characteristic diagram of the image to be identified.
Optionally, in the method, the preprocessing the original image to obtain an image to be recognized includes:
and adjusting the sequence of each channel of the original image to obtain an image to be identified.
The above method, optionally, further includes:
transmitting the original image if the variance is greater than the blur threshold.
In the foregoing method, optionally, after determining that the original image is a blur image, the method further includes:
and outputting prompt information, wherein the prompt information is used for prompting a user that the original image is a blurred image.
In the foregoing method, optionally, after determining that the original image is a blurred image, the method further includes:
transmission of the original image is prohibited.
An image processing apparatus comprising:
the acquiring unit is used for responding to the fuzzy image identification instruction and acquiring an original image to be processed;
the preprocessing unit is used for preprocessing the original image to obtain an image to be identified;
the execution unit is used for processing the image to be identified by utilizing a plurality of preset convolution cores to obtain a characteristic diagram of the image to be identified;
the calculation unit is used for calculating the variance of each pixel in the feature map;
and the determining unit is used for determining the original image as a fuzzy image under the condition that the variance is less than or equal to a preset fuzzy threshold value.
A storage medium comprising stored instructions, wherein the instructions, when executed, control a device on which the storage medium resides to perform an image processing method as described above.
An electronic device comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by the one or more processors to perform the image processing method as described above.
Compared with the prior art, the invention has the following advantages:
the invention provides an image processing method and device, a storage medium and electronic equipment, wherein an original image to be processed is acquired in response to a fuzzy image recognition instruction; preprocessing an original image to obtain an image to be identified; processing the image to be identified by utilizing a plurality of preset convolution cores to obtain a characteristic diagram of the image to be identified; calculating the variance of each pixel in the feature map; and determining the original image as a blur image under the condition that the variance is less than or equal to a preset blur threshold value. Whether the original image is a blurred image or not can be quickly and accurately identified.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flowchart of a method of image processing according to the present invention;
FIG. 2 is a flow chart of a process for obtaining a feature map of an image to be recognized according to the present invention;
FIG. 3 is an exemplary diagram of an implementation scenario provided by the present invention;
FIG. 4 is a schematic structural diagram of an image processing apparatus according to the present invention;
fig. 5 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
An embodiment of the present invention provides an image processing method, which may be applied to an electronic device, and a method flowchart of the method is shown in fig. 1, and specifically includes:
s101: and responding to the blurred image identification instruction, and acquiring an original image to be processed.
In this embodiment, the blurred image recognition instruction may be an instruction triggered by clicking a preset control when the user needs to upload an original image, or may also be an instruction triggered automatically after the user selects an original image to be uploaded.
Alternatively, the raw image may be various types of images, for example, a damaged part image, a repair order image, a face image, or the like, which may be taken by a user.
S102: and preprocessing the original image to obtain an image to be identified.
In the embodiment of the present invention, the original image is preprocessed by adjusting at least one of the size of the image, the size of the occupied space, the order of channels, and the like, and the original image may also be filtered.
S103: and processing the image to be identified by utilizing a plurality of preset convolution cores to obtain a characteristic diagram of the image to be identified.
In the embodiment of the invention, the image to be recognized is processed by a plurality of convolution kernels, so that a feature map containing the features of the image to be recognized can be obtained, and the feature map contains a plurality of pixel points.
S104: and calculating the variance of each pixel in the feature map.
In the embodiment of the present invention, the average value of each pixel may be calculated first, and the variance of each pixel may be calculated according to the average value of each pixel.
S105: and determining the original image as a blur image under the condition that the variance is less than or equal to a preset blur threshold value.
In the embodiment of the present invention, the blur threshold may be set to any value, for example, may be set to 0, and in the case that the variance of the feature map is less than or equal to 0, the original image is determined to be a blur map.
Alternatively, the blur map may be an image in which the image content cannot be recognized.
The embodiment of the invention provides an image processing method, which comprises the following steps: responding to a fuzzy image identification instruction, and acquiring an original image to be processed; preprocessing an original image to obtain an image to be identified; processing the image to be recognized by utilizing a plurality of preset convolution kernels to obtain a characteristic diagram of the image to be recognized; calculating the variance of each pixel in the feature map; and determining the original image as a fuzzy image under the condition that the variance is larger than a preset fuzzy threshold value. Whether the original image is a blurred image or not can be quickly and accurately identified.
In the embodiment of the present invention, based on the above scheme, optionally, the processing, by using a plurality of preset convolution kernels, the image to be recognized to obtain a feature map of the image to be recognized specifically includes, as shown in fig. 2:
s201: determining a convolution kernel template corresponding to the image to be identified; the channel sequence of the image to be identified is consistent with the image channel processing sequence corresponding to the convolution kernel template; the convolution kernel template comprises a plurality of preset single-channel convolution kernels and a plurality of preset multi-channel convolution kernels.
In this embodiment, the channel order of the image to be recognized coincides with the image channel processing order of the convolution kernel template, for example, the channel order of the image to be recognized may be that the image to be recognized may be a BGR (blue, green, red) format image, that is, the image to be recognized may include 3 channels: b channel, G channel, and R channel.
In some embodiments, a convolution kernel template corresponding to an image to be recognized may be determined in each of the candidate convolution kernel templates according to a channel order of the image to be recognized, each of the candidate convolution kernel templates has its own corresponding image channel processing order, and the candidate convolution kernel templates may process the image according to its image channel processing order.
S202: and processing the image to be identified by utilizing each single-channel convolution kernel in the convolution kernel template to obtain an initial characteristic diagram.
In this embodiment, the dimension of the image to be recognized may be [ W, H, 3], where "W" refers to the width of the image to be recognized, "H" refers to the height of the image to be recognized, "3" may refer to the number of channels of the image to be recognized being 3, the width of the image corresponds to the X-axis direction, and the height of the image corresponds to the Y-axis direction.
In this embodiment, the initial feature map may be processed using at least one pair of single-channel convolution kernels, each pair of single-channel convolution kernels including a first single-channel convolution kernel and a second single-channel convolution kernel; the second single-channel convolution kernel is an inverted convolution kernel of the first single-channel convolution kernel.
Optionally, the single-channel convolution kernel may include at least one of an nxm convolution kernel and an mxn convolution kernel, the multi-channel convolution kernel includes at least one of an mxmxnxn convolution kernel and an nxnxnxm convolution kernel, N and M are positive integers; n and M may be the same or different.
Specifically, the method for processing the image to be recognized by using each single-channel convolution kernel in the convolution kernel template to obtain the initial feature map can be implemented in the following manner:
performing convolution operation on each channel of the image to be recognized in a first direction by using an NxM convolution kernel in the convolution kernel template to obtain a first characteristic subgraph corresponding to each channel of the image to be recognized; combining the first feature subgraphs corresponding to each channel of the image to be recognized according to the sequence of the channels to obtain a first feature graph;
performing convolution operation on the second direction of each channel of the first feature map by using an M multiplied by N convolution kernel in the convolution kernel template to obtain a second feature sub-map corresponding to each channel of the first feature map;
and combining the second characteristic subgraphs corresponding to each channel of the first characteristic graph according to the sequence of the channels to obtain an initial characteristic graph.
In the present embodiment, the first direction may be one of an X-axis direction and a Y-axis direction; the second direction is the direction except the first direction in the X-axis direction and the Y-axis direction; for example, the first direction may be an X-axis direction, and the second direction may be a Y-axis direction; alternatively, the first direction is a Y-axis direction and the second direction is an X-axis direction.
Convolving in the X-axis direction of each channel of the image to be identified through an NxM convolution kernel to obtain a first characteristic subgraph corresponding to each channel; in some embodiments, N may be 3 and M may be 1.
In this embodiment, the first feature maps corresponding to the channels may be combined according to the channel order of the channels, so as to obtain the first feature map, where the channel order may be B-G-R, and the first feature map is an image in a BGR format. In some embodiments, the order of channels may also be R-G-B, R-B-G, B-R-G, G-B-R, G-R-B, and the like.
In this embodiment, the second feature subgraphs corresponding to the channels may be combined according to the order of the channels, for example, B-G-R, to obtain an initial feature graph, where the initial feature graph is an image in a BGR format.
S203: and processing the initial characteristic diagram by using each multi-channel convolution kernel in the convolution kernel template to obtain the characteristic diagram of the image to be identified.
In this embodiment, the initial feature map may be processed using at least one pair of multi-channel convolution kernels, each pair of multi-channel convolution kernels including a first multi-channel convolution kernel and a second multi-channel convolution kernel; the second multi-channel convolution kernel is an inverted convolution kernel of the first multi-channel convolution kernel.
Specifically, a feasible way of obtaining the feature map of the original image by processing the image to be identified by using each multi-channel convolution kernel in the convolution kernel template is as follows:
performing convolution operation on each channel of the initial feature map by using an M multiplied by N convolution kernel in the convolution kernel template to obtain a second feature map; n and M are positive integers;
and carrying out convolution operation on each channel of the second characteristic diagram by using the NxNxM convolution core in the convolution core template to obtain the characteristic diagram of the image to be identified.
By applying the method provided by the embodiment of the invention, the image to be recognized is processed through the single-channel convolution kernel, so that the calculation amount can be reduced, the calculation speed can be improved, the initial characteristic diagram can be quickly obtained, and then the initial characteristic diagram is subjected to convolution processing through the multi-channel convolution kernel, so that the obtained characteristic diagram has global characteristics, and whether the original image is a blurred image or not can be accurately judged according to the characteristic diagram.
In the embodiment of the present invention, based on the above scheme, optionally, the preprocessing the original image to obtain an image to be recognized includes:
and adjusting the sequence of each channel of the original image to obtain an image to be identified.
In this embodiment, the original image may be an image in RGB format, that is, the channel sequence of the original image is R-B-G, and the image to be recognized is obtained by adjusting the channel sequence of the original image, and the image to be recognized may be an image in BGR format, and the channel sequence is B-G-R. By converting the image in the RGB format into the image in the BGR format, the hardware dependence of the image in the convolution process can be effectively reduced.
In some embodiments, the format of the image may also be adjusted to GRB, GBR, BRG, or the like, or the order of each channel of the original image may not be adjusted, and the specific format may be set according to actual requirements.
In the embodiment of the present invention, based on the above scheme, optionally, the method further includes:
transmitting the original image if the variance is greater than the blur threshold.
In this embodiment, the blur threshold may be set to 0, and in the case where the variance is greater than the blur threshold, it is determined that the original image is not a blur map, and the original image may be transmitted.
Optionally, the original image may be sent to the server, and the server processes the original image.
By applying the method provided by the embodiment of the invention, the original image can be sent to the server under the condition that the original image is not a blurred image, so that the server can accurately acquire the image content in the original image.
In this embodiment of the present invention, based on the foregoing solution, optionally, after determining that the original image is a blurred image, the method further includes:
and outputting prompt information, wherein the prompt information is used for prompting a user that the original image is a blurred image.
In this embodiment, the prompt information may be output in a message popup mode to prompt the user that the original image is a blurred image, so that the user can shoot a new blurred image.
In the embodiment of the present invention, based on the above scheme, optionally, after determining that the original image is a blurred image, the method further includes:
transmission of the original image is prohibited.
In this embodiment, after the original image is detected to be the blurred image, transmission of the original image is prohibited, so that resource waste of the server due to sending of the original image to the server can be avoided.
The image processing method provided by the embodiment of the invention can be applied to various image recognition scenes, for example, the image processing method can be applied to an after-sales service scene, a work order system distributes service tasks for after-sales technicians, and the technicians perform corresponding after-sales service according to time and places distributed by the system. After the technician finishes the after-sales service, the technician reports images related to the after-sales service, such as damaged part images, maintenance order images, after-sales technician face images and the like, on the work order system through the electronic equipment, uploads the images to a database, and the background manually performs work order audit. The method comprises the following specific steps:
referring to fig. 3, an exemplary diagram of an implementation scenario provided in the embodiment of the present invention is shown, where the implementation scenario provided in the embodiment of the present invention is a work order system including a terminal 301 and a server 302.
In practice, the terminal 301 shown in fig. 3 may be an electronic device such as a personal computer, a handheld device or a portable device, a tablet device, a multi-processor apparatus, a distributed computing environment including any of the above apparatuses or devices, and the apparatus where the server 302 is located may be a server or a server cluster composed of multiple servers, or may be a cloud service platform. The terminal 301 establishes a communication connection with the server 302 through the network.
Embodiments of the present invention relate to networks that are media providing communication links and may include various types of connections, such as wired or wireless communication links, and the like.
The method comprises the following steps: the terminal can acquire an original image to be uploaded, wherein the width of the original image is W, the height of the original image corresponds to the X-axis direction, and the height of the original image is H, and the width of the original image corresponds to the y-axis direction; and the original image is a 3-channel RGB image, and the feature map dimension refers to width, height and channel number, so the dimension of the original image is W, H and 3.
Step two: after the terminal acquires the original image, the original image can be converted from the RGB format to the BGR format.
Step three: on each channel of the image converted into the BGR format (corresponding to the feature map dimensions W, H, 1), a 3 × 1 convolution operation is performed in the x-axis direction.
Alternatively, the 3 × 1 convolution kernel is [ k1, k2, k3] ═ 0.25, 0.5, 0.25 ].
In one example, assuming that the pixel value of the image converted into the BGR format on the R channel is [ x1, x2, x3, x4] [1, 2, 3, 4], the convolution with 3 × 1 on the x axis refers to multiplication and addition of adjacent three pixels by a convolution kernel coefficient; the specific calculation process is as follows:
z 1 =x 1 *k 1 +x 2 *k 2 +x 3 *k 3 =1*0.25+2*0.5+3*0.25=2;
z 2 =x 2 *k 1 +x 3 *k 2 +x 4 *k 3 =2*0.25+3*0.5+4*0.25=3。
here, the output result is [ z1, z2] ═ 2, 3], and as can be seen from the example, the output feature map dimension is [ W-2, H, 1 ].
Step four: and combining the first characteristic subgraphs corresponding to each channel obtained in the step three together according to BGR in the channel dimension to obtain a first characteristic graph, wherein the characteristic degree dimension of the first characteristic graph is [ W-2, H, 3 ].
Step five: performing 1 × 3 convolution operation on each channel (corresponding to the feature map dimension [ W-2, H, 1]) of the first feature map in the y-axis direction;
optionally, the 1 × 3 convolution kernel is
Figure BDA0003669355010000101
In one example, assume that the pixel value of the image on the R channel is
Figure BDA0003669355010000102
Then the 1 × 3 convolution on the y-axis refers to the multiplication and addition of adjacent three pixels by the convolution kernel coefficients, assuming that the output results are z3 and z4, the calculation process is as follows:
z 3 =y 1 *k 1 +y 2 *k 2 +y 3 *k 3 =1*0.25+2*0.5+3*0.25=2;
z 4 =y 2 *k 1 +y 3 *k 2 +y 4 *k 3 =2*0.25+3*0.5+4*0.25=3。
wherein the output result is
Figure BDA0003669355010000103
And as can be seen by way of example, the output feature map dimensions are [ W-2, H-2, 1 [ ]]。
Step six: and combining the second feature subgraphs corresponding to each channel obtained by the step five on the channel dimension according to BGR to obtain an initial feature graph, wherein the feature degree dimension of the initial feature graph is changed into [ W-2, H-2, 3 ].
Step seven: the initial feature map is convolved 1 × 1 × 3 over the channels.
Optionally, the convolution kernel is [ k4, k5, k6] ═ 0.114, 0.587, 0.299 ].
In an exemplary diagram, assuming that the pixel value at the (x, y) coordinate point is [ B, G, R ] ═ 1, 2, 3], then the 1 × 1 × 3 convolution is the output pixel value P at each pixel point, specifically:
P=B*k 1 +G*k 2 +R*k 3 =1*0.114+2*0.587+3*0.299=2.185。
and performing the convolution operation at each (x, y) coordinate point of the initial feature map to obtain a second feature map, wherein the feature map dimension of the second feature map is [ W-2, H-2, 1 ].
Step eight: the third feature map is convolved by 3 × 3 × 1.
Optionally, the convolution kernel is
Figure BDA0003669355010000104
In one example, assume that the current feature map pixel value is
Figure BDA0003669355010000111
Then the 3 × 3 × 1 convolution refers to multiplication and addition of adjacent 3 × 3 × 9 pixels according to a convolution kernel coefficient, assuming that the output result is z 5 Then the calculation formula is:
Figure BDA0003669355010000112
wherein the output result is [ z 5 ]=[0]By convolution operation on the second feature map, the feature map can be obtained, and as can be seen from the example, the output feature map dimension is [ W-4, H-4, 1]]。
Step nine: calculating the mean M and the variance Var of the feature map; the variance is compared to a preset threshold. The method comprises the following specific steps:
Figure BDA0003669355010000113
where θ is a threshold value for determining whether the feature map is blurred.
If the image is judged to be the fuzzy image, after-sale technicians are prompted to shoot the image again, and unnecessary resource waste caused by uploading the fuzzy sheet to the server side is avoided.
Corresponding to the method illustrated in fig. 1, an embodiment of the present invention further provides an image processing apparatus, which is used for implementing the method illustrated in fig. 1 specifically, and the image processing apparatus provided in the embodiment of the present invention may be applied to an electronic device, and a schematic structural diagram of the image processing apparatus is illustrated in fig. 4, and specifically includes:
an obtaining unit 401, configured to respond to the blurred image recognition instruction, and obtain an original image to be processed;
a preprocessing unit 402, configured to preprocess the original image to obtain an image to be identified;
an execution unit 403, configured to process the image to be identified by using a plurality of preset convolution kernels, so as to obtain a feature map of the image to be identified;
a calculating unit 404, configured to calculate a variance of each pixel in the feature map;
a determining unit 405, configured to determine that the original image is a blur map if the variance is less than or equal to a preset blur threshold.
The embodiment of the invention provides an image processing device, wherein a fuzzy image identification instruction can be responded to obtain an original image to be processed; preprocessing an original image to obtain an image to be identified; processing the image to be recognized by utilizing a plurality of preset convolution kernels to obtain a characteristic diagram of the image to be recognized; calculating the variance of each pixel in the feature map; and determining the original image as a fuzzy image under the condition that the variance is larger than a preset fuzzy threshold value. Whether the original image is a blurred image or not can be quickly and accurately identified.
In an embodiment of the present invention, based on the above scheme, optionally, the execution unit 403 includes:
the determining subunit is used for determining a convolution kernel template corresponding to the image to be identified; the channel sequence of the image to be identified is consistent with the image channel processing sequence corresponding to the convolution kernel template; the convolution kernel template comprises a plurality of preset single-channel convolution kernels and a plurality of preset multi-channel convolution kernels;
the first execution subunit is used for processing the image to be identified by utilizing each single-channel convolution kernel in the convolution kernel template to obtain an initial characteristic diagram;
and the second execution subunit is used for processing the initial feature map by using each multi-channel convolution kernel in the convolution kernel template to obtain the feature map of the image to be identified.
In an embodiment provided by the present invention, based on the above scheme, optionally, the first execution subunit includes:
the first convolution submodule is used for performing convolution operation in the first direction of each channel of the image to be recognized by using an NxM convolution kernel in the convolution kernel template to obtain a first characteristic subgraph corresponding to each channel of the image to be recognized; n and M are positive integers;
the first execution sub-module is used for combining the first characteristic subgraph corresponding to each channel of the image to be identified according to the channel sequence to obtain a first characteristic graph;
the second convolution sub-module is used for performing convolution operation in a second direction of each channel of the first feature map by using the M multiplied by N convolution kernel in the convolution kernel template to obtain a second feature sub-map corresponding to each channel of the first feature map;
and the second execution submodule is used for combining the second feature subgraphs corresponding to each channel of the first feature graph according to the sequence of the channels to obtain an initial feature graph.
In an embodiment provided by the present invention, based on the above scheme, optionally, the second execution subunit includes:
the third convolution submodule is used for carrying out convolution operation on each channel of the initial characteristic diagram by using an M multiplied by N convolution core in the convolution core template to obtain a second characteristic diagram; n and M are positive integers;
and the fourth convolution submodule is used for performing convolution operation on each channel of the second feature map by using the NxNxM convolution kernel in the convolution kernel template to obtain the feature map of the image to be identified.
In an embodiment provided by the present invention, based on the above scheme, optionally, the preprocessing unit includes:
and the adjusting subunit is used for adjusting the sequence of each channel of the original image to obtain an image to be identified.
In an embodiment provided by the present invention, based on the above scheme, optionally, the image processing apparatus further includes:
a sending unit, configured to send the original image if the variance is greater than the blur threshold.
In an embodiment provided by the present invention, based on the above scheme, optionally, the image processing apparatus further includes:
and the output unit is used for outputting prompt information, and the prompt information is used for prompting a user that the original image is a blurred image.
In an embodiment provided by the present invention, based on the above scheme, optionally, the image processing apparatus further includes:
a processing unit for inhibiting transmission of the original image.
The specific principle and the implementation process of each unit and each module in the image processing apparatus disclosed in the embodiment of the present invention are the same as those of the image processing method disclosed in the embodiment of the present invention, and reference may be made to corresponding parts in the image processing method provided in the embodiment of the present invention, which are not described herein again.
An embodiment of the present invention further provides an electronic device, a schematic structural diagram of which is shown in fig. 5, for example, the electronic device 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 5, electronic device 500 may include one or more of the following components: processing component 502, memory 504, power component 506, multimedia component 508, audio component 510, input/output (I/O) interface 512, sensor component 514, and communication component 516.
The processing component 502 generally controls overall operation of the electronic device 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 502 may include one or more processors 520 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 502 can include one or more modules that facilitate interaction between the processing component 502 and other components. For example, the processing component 502 can include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
The memory 504 is configured to store various types of data to support operation at the device 500. Examples of such data include instructions for any application or method operating on the electronic device 500, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 504 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 506 provides power to the various components of the electronic device 500. The power components 506 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 500.
The multimedia component 508 includes a screen providing an output interface between the electronic device 500 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 500 is in an operational mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 510 is configured to output and/or input audio signals. For example, the audio component 510 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 500 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 504 or transmitted via the communication component 516. In some embodiments, audio component 510 further includes a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the electronic device 500. For example, the sensor assembly 514 may detect an open/closed state of the device 500, the relative positioning of components, such as a display and keypad of the electronic device 500, the sensor assembly 514 may detect a change in the position of the electronic device 500 or a component of the electronic device 500, the presence or absence of user contact with the electronic device 500, orientation or acceleration/deceleration of the electronic device 500, and a change in the temperature of the electronic device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 516 is configured to facilitate wired or wireless communication between the electronic device 500 and other devices. The electronic device 500 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described image processing methods.
In an exemplary embodiment, there is also provided a storage medium comprising instructions, such as the memory 504 comprising instructions, which are executable by the processor 520 of the electronic device 500 to perform the above-mentioned image processing method, the method specifically comprising:
responding to a fuzzy image identification instruction, and acquiring an original image to be processed;
preprocessing the original image to obtain an image to be identified;
processing the image to be identified by utilizing a plurality of preset convolution cores to obtain a characteristic diagram of the image to be identified;
calculating the variance of each pixel in the feature map;
and determining the original image as a blur image under the condition that the variance is less than or equal to a preset blur threshold value.
Optionally, in the method, the processing the image to be recognized by using a plurality of preset convolution kernels to obtain the feature map of the image to be recognized includes:
optionally, in the method, processing the image to be recognized by using a plurality of preset convolution kernels to obtain a feature map of the image to be recognized includes:
determining a convolution kernel template corresponding to the image to be identified; the channel sequence of the image to be recognized is consistent with the image channel processing sequence corresponding to the convolution kernel template; the convolution kernel template comprises a plurality of preset single-channel convolution kernels and a plurality of preset multi-channel convolution kernels;
processing the image to be identified by utilizing each single-channel convolution kernel in the convolution kernel template to obtain an initial characteristic diagram;
and processing the initial characteristic diagram by using each multi-channel convolution kernel in the convolution kernel template to obtain the characteristic diagram of the image to be identified.
Optionally, in the method, the processing the image to be recognized by using each single-channel convolution kernel in the convolution kernel template to obtain an initial feature map includes:
performing convolution operation on each channel of the image to be recognized in a first direction by using an NxM convolution kernel in the convolution kernel template to obtain a first characteristic subgraph corresponding to each channel of the image to be recognized; n and M are positive integers;
combining each channel of the image to be recognized corresponding to the first feature subgraph according to the channel sequence to obtain a first feature graph;
performing convolution operation on an M multiplied by N convolution kernel in the convolution kernel template in a second direction of each channel of the first feature map to obtain a second feature sub-map corresponding to each channel of the first feature map;
and combining the second characteristic subgraphs corresponding to each channel of the first characteristic graph according to the sequence of the channels to obtain an initial characteristic graph.
Optionally, in the method, processing the image to be identified by using each multi-channel convolution kernel in the convolution kernel template to obtain the feature map of the original image includes:
performing convolution operation on each channel of the initial feature map by using an M multiplied by N convolution kernel in the convolution kernel template to obtain a second feature map; n and M are positive integers;
and carrying out convolution operation on each channel of the second characteristic diagram by using the NxNxM convolution core in the convolution core template to obtain the characteristic diagram of the image to be identified.
Optionally, in the method, the preprocessing the original image to obtain an image to be recognized includes:
and adjusting the sequence of each channel of the original image to obtain an image to be identified.
The above method, optionally, further includes:
and if the variance is larger than the fuzzy threshold value, transmitting the original image.
In the foregoing method, optionally, after determining that the original image is a blur image, the method further includes:
and outputting prompt information, wherein the prompt information is used for prompting a user that the original image is a blurred image.
In the foregoing method, optionally, after determining that the original image is a blur image, the method further includes:
transmission of the original image is prohibited.
Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
It should be noted that, in this specification, each embodiment is described in a progressive manner, and each embodiment focuses on differences from other embodiments, and portions that are the same as and similar to each other in each embodiment may be referred to. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
For convenience of description, the above devices are described as being divided into various units by function, respectively. Of course, the functions of the units may be implemented in the same software and/or hardware or in a plurality of software and/or hardware when implementing the invention.
From the above description of the embodiments, it is clear to those skilled in the art that the present invention can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The image processing method provided by the present invention is described in detail above, and the principle and the implementation of the present invention are explained in this document by applying specific examples, and the description of the above examples is only used to help understanding the method of the present invention and the core idea thereof; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. An image processing method, comprising:
responding to a fuzzy image identification instruction, and acquiring an original image to be processed;
preprocessing the original image to obtain an image to be identified;
processing the image to be identified by utilizing a plurality of preset convolution cores to obtain a characteristic diagram of the image to be identified;
calculating the variance of each pixel in the feature map;
and determining the original image as a blur image under the condition that the variance is less than or equal to a preset blur threshold value.
2. The method according to claim 1, wherein processing the image to be recognized by using a plurality of preset convolution kernels to obtain a feature map of the image to be recognized comprises:
determining a convolution kernel template corresponding to the image to be identified; the channel sequence of the image to be identified is consistent with the image channel processing sequence corresponding to the convolution kernel template; the convolution kernel template comprises a plurality of preset single-channel convolution kernels and a plurality of preset multi-channel convolution kernels;
processing the image to be identified by utilizing each single-channel convolution kernel in the convolution kernel template to obtain an initial characteristic diagram;
and processing the initial characteristic diagram by using each multi-channel convolution kernel in the convolution kernel template to obtain the characteristic diagram of the image to be identified.
3. The method according to claim 2, wherein the processing the image to be recognized by using each single-channel convolution kernel in the convolution kernel template to obtain an initial feature map comprises:
performing convolution operation on each channel of the image to be recognized in a first direction by using an NxM convolution kernel in the convolution kernel template to obtain a first characteristic subgraph corresponding to each channel of the image to be recognized; n and M are positive integers;
combining the first characteristic subgraphs corresponding to each channel of the image to be recognized according to the sequence of the channels to obtain a first characteristic graph;
performing convolution operation on the second direction of each channel of the first feature map by using an M multiplied by N convolution kernel in the convolution kernel template to obtain a second feature sub-map corresponding to each channel of the first feature map;
and combining the second characteristic subgraphs corresponding to each channel of the first characteristic graph according to the sequence of the channels to obtain an initial characteristic graph.
4. The method of claim 2, wherein processing the image to be identified with each multi-channel convolution kernel in the convolution kernel template to obtain a feature map of the original image comprises:
performing convolution operation on each channel of the initial feature map by using an M multiplied by N convolution kernel in the convolution kernel template to obtain a second feature map; n and M are positive integers;
and carrying out convolution operation on each channel of the second characteristic diagram by using the NxNxM convolution core in the convolution core template to obtain the characteristic diagram of the image to be identified.
5. The method according to claim 1, wherein the preprocessing the original image to obtain an image to be recognized comprises:
and adjusting the sequence of each channel of the original image to obtain an image to be identified.
6. The method of claim 1, further comprising:
and if the variance is larger than the fuzzy threshold value, transmitting the original image.
7. The method of claim 1, wherein after determining that the original image is a blur map, further comprising:
and outputting prompt information, wherein the prompt information is used for prompting a user that the original image is a blurred image.
8. An image processing apparatus characterized by comprising:
the acquiring unit is used for responding to the fuzzy image identification instruction and acquiring an original image to be processed;
the preprocessing unit is used for preprocessing the original image to obtain an image to be identified;
the execution unit is used for processing the image to be identified by utilizing a plurality of preset convolution cores to obtain a characteristic diagram of the image to be identified;
the calculation unit is used for calculating the variance of each pixel in the feature map;
and the determining unit is used for determining the original image as a fuzzy image under the condition that the variance is less than or equal to a preset fuzzy threshold value.
9. A storage medium, characterized in that the storage medium comprises stored instructions, wherein when the instructions are executed, a device on which the storage medium is located is controlled to execute the image processing method according to any one of claims 1 to 7.
10. An electronic device comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by the one or more processors to perform the image processing method of any one of claims 1-7.
CN202210599294.9A 2022-05-30 2022-05-30 Image processing method and device, storage medium and electronic equipment Pending CN115019023A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210599294.9A CN115019023A (en) 2022-05-30 2022-05-30 Image processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210599294.9A CN115019023A (en) 2022-05-30 2022-05-30 Image processing method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN115019023A true CN115019023A (en) 2022-09-06

Family

ID=83071540

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210599294.9A Pending CN115019023A (en) 2022-05-30 2022-05-30 Image processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115019023A (en)

Similar Documents

Publication Publication Date Title
CN106651955B (en) Method and device for positioning target object in picture
CN106331504B (en) Shooting method and device
KR101831077B1 (en) Method and device for switching color gamut mode
CN111328448A (en) Method and apparatus for image processing
JP6328275B2 (en) Image type identification method, apparatus, program, and recording medium
CN108009563B (en) Image processing method and device and terminal
JP2016532947A (en) Composition changing method, composition changing apparatus, terminal, program, and recording medium
CN109784327B (en) Boundary box determining method and device, electronic equipment and storage medium
CN109003272B (en) Image processing method, device and system
CN107730443B (en) Image processing method and device and user equipment
CN110876014B (en) Image processing method and device, electronic device and storage medium
CN114500821B (en) Photographing method and device, terminal and storage medium
CN112669231B (en) Image processing method, training method, device and medium of image processing model
US20210258945A1 (en) Data transmission method and apparatus
CN115019023A (en) Image processing method and device, storage medium and electronic equipment
CN112153291B (en) Photographing method and electronic equipment
CN108108668B (en) Age prediction method and device based on image
CN111724398A (en) Image display method and device
CN111325148A (en) Method, device and equipment for processing remote sensing image and storage medium
CN110784721A (en) Picture data compression method and device, electronic equipment and storage medium
CN110933300B (en) Image processing method and electronic terminal equipment
EP4106321A1 (en) Image processing method and apparatus, model training method and apparatus, and storage medium
CN112449409B (en) Power control method of mobile terminal and power control device of mobile terminal
CN109034068B (en) Video processing method and device, electronic equipment and storage medium
CN117764895A (en) Image processing method, device and storage medium

Legal Events

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