CN112597840A - Image identification method, device and equipment - Google Patents

Image identification method, device and equipment Download PDF

Info

Publication number
CN112597840A
CN112597840A CN202011466865.9A CN202011466865A CN112597840A CN 112597840 A CN112597840 A CN 112597840A CN 202011466865 A CN202011466865 A CN 202011466865A CN 112597840 A CN112597840 A CN 112597840A
Authority
CN
China
Prior art keywords
target
image
pixel point
channel value
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.)
Granted
Application number
CN202011466865.9A
Other languages
Chinese (zh)
Other versions
CN112597840B (en
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.)
Shenzhen Jizhi Digital Technology Co Ltd
Original Assignee
Shenzhen Jizhi Digital Technology 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 Shenzhen Jizhi Digital Technology Co Ltd filed Critical Shenzhen Jizhi Digital Technology Co Ltd
Priority to CN202011466865.9A priority Critical patent/CN112597840B/en
Publication of CN112597840A publication Critical patent/CN112597840A/en
Application granted granted Critical
Publication of CN112597840B publication Critical patent/CN112597840B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/50Context or environment of the image
    • G06V20/52Surveillance or monitoring of activities, e.g. for recognising suspicious objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Color Image Communication Systems (AREA)

Abstract

The embodiment of the application discloses an image identification method, device and equipment, wherein a target brightness channel value and a target saturation channel value of a target pixel point are obtained by obtaining an image to be identified and a reference image, the target hue type of the target pixel point is determined, and whether the target pixel point is an abnormal pixel point is determined by using the target hue type of the target pixel point and the reference image. And determining whether the image to be identified has a target object or not according to a target ratio of the number of the abnormal pixel points to the number of the target pixel points. The target object in the image to be recognized can be accurately recognized based on the color space, and the recognition efficiency for the target object is improved.

Description

Image identification method, device and equipment
Technical Field
The present application relates to the field of image processing, and in particular, to an image recognition method, apparatus, and device.
Background
In order to clean fallen leaves or sundries in time, the corresponding scene needs to be monitored, and the fallen leaves or the sundries are cleaned when being recognized.
At present, the problems of low identification accuracy and low identification efficiency exist in the identification of fallen leaves or sundries. How to realize efficient and accurate identification of a target object in an image is a technical problem to be solved urgently.
Disclosure of Invention
In view of this, embodiments of the present application provide an image recognition method, apparatus, and device, which can realize efficient and accurate recognition of fallen leaves or impurities.
In order to solve the above problem, the technical solution provided by the embodiment of the present application is as follows:
in a first aspect, the present application provides an image recognition method, including:
acquiring an image to be identified and a reference image;
acquiring a target brightness channel value and a target saturation channel value of a target pixel point; the target pixel point is each pixel point in the image to be identified;
determining the target hue type of the target pixel point according to the target brightness channel value and the target saturation channel value;
determining whether the target pixel points are abnormal pixel points according to the target tone type and the reference image;
and determining whether the image to be identified has a target object according to a target ratio of the number of the abnormal pixel points to the number of the target pixel points.
In one possible implementation, the method further includes:
dividing the image to be recognized to obtain a sub-image to be recognized;
determining whether the image to be identified has a target object according to the ratio of the number of the abnormal pixel points to the number of the target pixel points, including:
acquiring a first quantity of abnormal pixel points in a target subgraph, and acquiring a second quantity of pixel points in the target subgraph; the target subgraph is each of the subgraphs to be identified;
calculating a first ratio of the first quantity to the second quantity, and judging whether the first ratio is greater than a first threshold value;
if so, determining the target subgraph as an abnormal subgraph;
acquiring the number of the abnormal subgraphs, and judging whether the number of the abnormal subgraphs is larger than a second threshold value or not;
and if so, determining that the image to be recognized has the target object.
In a possible implementation manner, the dividing the image to be recognized to obtain a sub-image to be recognized includes:
setting a sliding window in the image to be recognized, and controlling the sliding window to move according to a preset moving mode;
and taking the image in the sliding window as a to-be-identified subgraph of the to-be-identified image.
In a possible implementation manner, the determining whether the target pixel is an abnormal pixel according to the target tone type and the reference image includes:
when the target color tone type belongs to a first color tone type, acquiring a reference pixel point corresponding to the target pixel point in the reference image; the first shade category includes black, white, and gray;
judging whether the colors of the target pixel point and the reference pixel point are the same or not;
if the target pixel point and the reference pixel point are different in color, determining the target pixel point as an abnormal pixel point;
when the target tone type belongs to the second tone type, acquiring a differential value corresponding to a target pixel point from the differential image; the differential image is obtained according to the HSV three-channel matrix of the image to be identified and the HSV three-channel matrix of the reference image;
and judging whether the difference value is greater than the hue difference value, and if so, determining the target pixel point as an abnormal pixel point.
In a possible implementation manner, the determining whether the colors of the target pixel point and the reference pixel point are the same includes:
acquiring a target hue channel value of the target pixel point;
acquiring a reference brightness channel value, a reference saturation channel value and a reference hue channel value of the reference pixel point;
and if the target hue channel value and the reference hue channel value are in a first channel value range, the target brightness channel value and the reference brightness channel value are in a second channel value range, and the target saturation channel value and the reference saturation channel value are in a third channel value range, determining that the colors of the target pixel point and the reference pixel point are the same.
In a possible implementation manner, the image to be identified includes an area of interest, and before the obtaining of the target luminance channel value and the target saturation channel value of the target pixel and determining the target hue type of the target pixel according to the target luminance channel value and the target saturation channel value, the method further includes:
judging whether a target pixel belongs to the region of interest, and if not, taking the next pixel of the target pixel as the target pixel;
and repeating the steps until the target pixel point belongs to the interested region.
In a possible implementation manner, the determining whether the image to be recognized has the target object according to the ratio of the number of the abnormal pixel points to the number of the target pixel points includes:
acquiring a third quantity of abnormal pixel points in the image to be identified and acquiring a fourth quantity of pixel points in an interested area in the image to be identified;
calculating a second ratio of the third quantity to the fourth quantity, and judging whether the second ratio is greater than a third threshold value;
and if so, determining that the image to be recognized has the target object.
In a second aspect, the present application provides an image recognition apparatus, the apparatus comprising:
the device comprises a first acquisition unit, a second acquisition unit and a processing unit, wherein the first acquisition unit is used for acquiring an image to be identified and a reference image;
the second acquisition unit is used for acquiring a target brightness channel value and a target saturation channel value of a target pixel point; the target pixel point is each pixel point in the image to be identified;
the first determining unit is used for determining the target hue type of the target pixel point according to the target brightness channel value and the target saturation channel value;
the second determining unit is used for determining whether the target pixel point is an abnormal pixel point according to the target tone type and the reference image;
and the third determining unit is used for determining whether the image to be identified has a target object according to a target ratio of the number of the abnormal pixel points to the number of the target pixel points.
In one possible implementation, the apparatus further includes:
the dividing unit is used for dividing the image to be recognized to obtain a sub-image to be recognized;
the third determining unit is specifically configured to obtain a first number of abnormal pixel points in a target sub-graph, and obtain a second number of pixel points in the target sub-graph; the target subgraph is each of the subgraphs to be identified;
calculating a first ratio of the first quantity to the second quantity, and judging whether the first ratio is greater than a first threshold value;
if so, determining the target subgraph as an abnormal subgraph;
acquiring the number of the abnormal subgraphs, and judging whether the number of the abnormal subgraphs is larger than a second threshold value or not;
and if so, determining that the image to be recognized has the target object.
In a possible implementation manner, the dividing unit is specifically configured to set a sliding window in the image to be recognized, and control the sliding window to move according to a preset moving manner;
and taking the image in the sliding window as a to-be-identified subgraph of the to-be-identified image.
In a possible implementation manner, the second determining unit includes:
a first obtaining subunit, configured to, when the target color tone type belongs to a first color tone type, obtain a reference pixel point corresponding to the target pixel point in the reference image; the first shade category includes black, white, and gray;
the first judgment subunit is used for judging whether the colors of the target pixel point and the reference pixel point are the same or not;
a determining subunit, configured to determine the target pixel point as an abnormal pixel point if the target pixel point and the reference pixel point are different in color;
the second obtaining subunit is configured to obtain, when the target tone type belongs to a second tone type, a difference value corresponding to the target pixel point from the difference map; the differential image is obtained according to the HSV three-channel matrix of the image to be identified and the HSV three-channel matrix of the reference image;
and the second judgment subunit is used for judging whether the difference value is greater than the hue difference value or not, and if so, determining the target pixel point as an abnormal pixel point.
In a possible implementation manner, the first determining subunit is specifically configured to obtain a target hue channel value of the target pixel point;
acquiring a reference brightness channel value, a reference saturation channel value and a reference hue channel value of the reference pixel point;
and if the target hue channel value and the reference hue channel value are in a first channel value range, the target brightness channel value and the reference brightness channel value are in a second channel value range, and the target saturation channel value and the reference saturation channel value are in a third channel value range, determining that the colors of the target pixel point and the reference pixel point are the same.
In a possible implementation manner, the image to be identified includes a region of interest, and the apparatus further includes:
the judging unit is used for judging whether a target pixel point belongs to the interested region or not, and if not, taking the next pixel point of the target pixel point as a target pixel point;
and the execution unit is used for repeatedly executing the steps until the target pixel point belongs to the interested region.
In a possible implementation manner, the third determining unit is specifically configured to obtain a third number of abnormal pixel points in the image to be identified, and obtain a fourth number of pixel points in an area of interest in the image to be identified;
calculating a second ratio of the third quantity to the fourth quantity, and judging whether the second ratio is greater than a third threshold value;
and if so, determining that the image to be recognized has the target object.
In a third aspect, the present application provides an image recognition apparatus comprising: a processor, a memory, a system bus;
the processor and the memory are connected through the system bus;
the memory is for storing one or more programs, the one or more programs including instructions, which when executed by the processor, cause the processor to perform the method of any of the above.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein instructions that, when run on a terminal device, cause the terminal device to perform any of the methods described above.
Therefore, the embodiment of the application has the following beneficial effects:
according to the image identification method provided by the embodiment of the application, the target brightness channel value and the target saturation channel value of the target pixel point are obtained by obtaining the image to be identified and the reference image, the target hue type of the target pixel point is determined, and whether the target pixel point is an abnormal pixel point is determined by using the target hue type of the target pixel point and the reference image. And determining whether the image to be identified has a target object or not according to a target ratio of the number of the abnormal pixel points to the number of the target pixel points. Therefore, the tone of each pixel point can be determined firstly through the brightness and the saturation of each pixel point in the image to be identified, and then whether the target pixel point is abnormal or not is determined according to the different tone to which the pixel point belongs and the reference image. And determining whether the image to be recognized has a target object or not according to the proportion of the abnormal pixel points in the image to be recognized. The target object in the image to be recognized can be accurately recognized based on the color space, and the recognition efficiency for the target object is improved.
Drawings
Fig. 1 is a flowchart of an image recognition method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an image recognition apparatus according to an embodiment of the present application.
Detailed Description
In order to facilitate understanding and explaining the technical solutions provided by the embodiments of the present application, the following description will first describe the background art of the present application.
After researching the traditional fallen leaf recognition or sundry recognition, the inventor finds that the existing recognition method based on deep learning needs to design a corresponding network structure and needs to label a large amount of training data, so that the target object recognition efficiency is low. Correspondingly, the traditional image difference algorithm can compare the input image to be recognized with the standard image, and recognize fallen leaves or impurities in the image to be recognized. However, the traditional image difference algorithm has low accuracy for identifying fallen leaves or impurities under various environmental conditions.
Based on this, the embodiment of the application provides an image identification method, which includes acquiring an image to be identified and a reference image; acquiring a target brightness channel value and a target saturation channel value of a target pixel point; the target pixel point is each pixel point in the image to be identified; determining the target hue type of the target pixel point according to the target brightness channel value and the target saturation channel value; determining whether the target pixel points are abnormal pixel points according to the target tone type and the reference image; and determining whether the image to be identified has a target object according to a target ratio of the number of the abnormal pixel points to the number of the target pixel points. Thus, the detection of the target object with higher efficiency and more accuracy can be realized.
In order to facilitate understanding of the technical solutions provided by the embodiments of the present application, an image recognition method provided by the embodiments of the present application is described below with reference to the accompanying drawings.
Referring to fig. 1, which is a flowchart illustrating an image recognition method according to an embodiment of the present application, the method includes steps S101 to S105.
S101: and acquiring an image to be identified and a reference image.
The image to be recognized is an image for which target object recognition is required. The image to be recognized can be an image shot by a camera or an image frame intercepted in a video.
The reference image is an image corresponding to the image to be recognized as a template. The reference image is consistent with the background of the image to be recognized, and has no image of the target object. The reference image and the image to be identified belong to the same scene image. In order to improve the accuracy of recognition, the reference image may be multiple. The reference image may be an image of the same scene in multiple states, e.g., different seasons, different weather conditions, different light intensities.
S102: acquiring a target brightness channel value and a target saturation channel value of a target pixel point; the target pixel point is each pixel point in the image to be identified.
And taking each pixel point in the image to be identified as a target pixel point, and acquiring a target brightness channel value and a target saturation channel value corresponding to the target pixel point. It should be noted that, in an HSV (Hue, Saturation, brightness color space) channel, a partial Hue of a target pixel point may be determined by a luminance channel Value and a Saturation channel Value, so as to determine the Hue of the target pixel point.
S103: and determining the target hue type of the target pixel point according to the target brightness channel value and the target saturation channel value.
And determining the target hue type corresponding to the target pixel point according to the obtained target brightness channel value and the target saturation channel value of the target pixel point. The target hue class may be determined according to the hue of the scene. In one possible implementation, the background color of the reference image may be used as one target color tone category, and the other color tones may be used as another target color tone category. And judging the abnormal pixel points by adopting different modes according to different target hue types.
S104: and determining whether the target pixel points are abnormal pixel points according to the target tone type and the reference image.
The difference of the color tones of the target pixel point and the corresponding pixel point in the reference image can be determined through the color tone of the corresponding pixel point in the reference image and the target color tone type to which the target pixel point belongs, and then whether the target pixel point is an abnormal pixel point is judged.
In a possible implementation manner, an embodiment of the present application provides a specific implementation manner that, when black, white, and gray are used as a target tone category, whether the target pixel is an abnormal pixel is determined according to the target tone category and the reference image, please refer to the following description.
S105: and determining whether the image to be identified has a target object according to a target ratio of the number of the abnormal pixel points to the number of the target pixel points.
The abnormal pixel points can represent pixel points in the image to be identified, which are different from the reference image. When the target ratio of the abnormal pixel points in the image to be recognized reaches a certain threshold value, the target object is shown in the image to be recognized, and the target object is recognized.
Based on the relevant content of the above-mentioned S101-S105, the target hue category of the target pixel is determined first by obtaining the target luminance channel value and the saturation channel value of each pixel in the image to be identified. And determining whether the target pixel points are abnormal pixel points or not by utilizing the reference image and the target tone types, and identifying the target object according to the target ratio occupied by the abnormal pixel points. Thus, the type of the color can be determined through the hue, and the target object can be identified by using the brightness and the saturation. The recognition efficiency of the target object can be improved by using the color space, and accurate recognition of the target object in various states can be realized.
In a possible implementation manner, the image to be recognized may be divided to obtain a plurality of sub-images, and then the target pixel point is determined in the sub-images.
The embodiment of the application further provides an image recognition method, which comprises the following five steps:
and dividing the image to be recognized to obtain a sub-image to be recognized.
In order to more accurately recognize the target object in the image to be recognized, the image to be recognized may be divided to obtain a sub-image to be recognized.
In one possible implementation, the division of the sub-graphs to be identified may be achieved by setting a sliding window.
Specifically, a sliding window is arranged in the image to be recognized, and the sliding window is controlled to move according to a preset moving mode;
and taking the image in the sliding window as a to-be-identified subgraph of the to-be-identified image.
The specification and the moving step length of the sliding window are not limited, and the sliding window can be set according to the identification result of the target object.
The preset moving mode may be that the moving mode is firstly moved along a left direction or a right direction, and when the boundary of the sliding window exceeds the boundary of the image to be recognized, the moving mode is moved downwards or upwards. And when the boundaries of the sliding windows exceed the boundaries of the images to be recognized, stopping the movement of the sliding windows, and finishing the division of the images to be recognized.
And taking the image in each sliding window as a to-be-recognized sub-image of the to-be-recognized image, and judging pixel points of each to-be-recognized sub-image.
When an image to be recognized is divided to obtain a sub-image to be recognized, determining whether a target object exists in the image to be recognized according to the ratio of the number of the abnormal pixel points to the number of the target pixel points, wherein the method comprises the following four steps:
a1: acquiring a first quantity of abnormal pixel points in a target subgraph, and acquiring a second quantity of pixel points in the target subgraph; the target subgraph is each of the subgraphs to be identified.
And taking each sub-graph to be recognized as a target sub-graph, and firstly acquiring the first quantity of abnormal pixel points in the sub-graph to be recognized and the second quantity of pixel points in the target sub-graph.
A2: and calculating a first ratio of the first quantity to the second quantity, and judging whether the first ratio is greater than a first threshold value.
According to the first quantity and the second quantity, a first ratio of the abnormal pixel points in the target subgraph can be calculated. The first threshold may be preset for determining an abnormal subgraph. The first threshold value may be adjusted according to the recognition result.
By comparing the first ratio with the first threshold, it can be determined whether the target sub-image is abnormal, i.e. has a large difference from the reference image.
A3: and if so, determining the target subgraph as an abnormal subgraph.
And if the first ratio is larger than the first threshold value, the difference between the target subgraph and the reference image is larger, and the target subgraph is determined to be an abnormal subgraph.
A4: and acquiring the number of the abnormal subgraphs, and judging whether the number of the abnormal subgraphs is larger than a second threshold value.
The image to be recognized is provided with a plurality of subgraphs to be recognized, and the number of abnormal subgraphs in the subgraphs to be recognized is obtained. And comparing the number of the abnormal subgraphs with a second threshold value, wherein the second threshold value is a preset threshold value used for determining whether the image to be identified has the target object. The second threshold may be adjusted according to the result of the recognition.
A5: and if so, determining that the image to be recognized has the target object.
And when the number of the abnormal subgraphs is larger than a second threshold value, the difference between the image to be recognized and the reference image is large, and the image to be recognized is determined as the image to be recognized with the target object.
In the embodiment of the application, the image to be recognized is divided, so that the abnormal subgraph can be judged on the subgraph to be recognized, and the target object of the image to be recognized can be recognized more accurately.
In a possible implementation manner, the determining whether the target pixel is an abnormal pixel according to the target tone type and the reference image includes the following five steps:
b1: when the target color tone type belongs to a first color tone type, acquiring a reference pixel point corresponding to the target pixel point in the reference image; the first shade category includes black, white, and gray.
Black, white and gray are the more common background hues, and the first hue class may be set to hue classes including black, white and gray. When the target tone type belongs to the first tone type, the target pixel may be determined to be a pixel belonging to the background. And acquiring a reference pixel point corresponding to the target pixel point in the reference image. It is determined whether the reference pixel and the target pixel have a difference.
B2: and judging whether the colors of the target pixel point and the reference pixel point are the same or not.
And judging whether the colors of the target pixel point and the reference pixel point are the same or not. In one possible implementation, the determination can be made through three aspects of brightness, saturation, and hue.
Specifically, the determining whether the colors of the target pixel point and the reference pixel point are the same includes:
acquiring a target hue channel value of the target pixel point;
acquiring a reference brightness channel value, a reference saturation channel value and a reference hue channel value of the reference pixel point;
and if the target hue channel value and the reference hue channel value are in a first channel value range, the target brightness channel value and the reference brightness channel value are in a second channel value range, and the target saturation channel value and the reference saturation channel value are in a third channel value range, determining that the colors of the target pixel point and the reference pixel point are the same.
When the target pixel point and the reference pixel point are in the same color, the hue, the brightness and the saturation are in the same range.
And acquiring a target hue channel value of the target pixel point, and a reference brightness channel value, a reference saturation channel value and a reference hue channel value of the reference pixel point.
When the target hue channel value and the reference hue channel value are in the first channel value range, the target brightness channel value and the reference brightness channel value are in the second channel value range, and the target saturation channel value and the reference saturation channel value are in the third channel value range, it can be determined that the target pixel point and the reference pixel point belong to the same color. The first channel range, the second channel range and the third channel range are the hue range, the brightness range and the saturation range of the same color.
B3: and if the target pixel point and the reference pixel point are different in color, determining the target pixel point as an abnormal pixel point.
And if the colors of the target pixel point and the reference pixel point are different, the target pixel point and the reference pixel point in the image to be identified are different, and the target pixel point is determined as an abnormal pixel point.
B4: when the target tone type belongs to the second tone type, acquiring a differential value corresponding to a target pixel point from the differential image; and the differential image is obtained according to the HSV three-channel matrix of the image to be identified and the HSV three-channel matrix of the reference image.
When the target tone type belongs to the second tone type, the target pixel point is not the pixel point representing the background. The second hue category may be other hues than black, white and gray.
The target tone type of the second tone type may be determined by whether the target tone type is the same color or not based on a difference value between the tones.
And the differential value of the target pixel point is determined according to the differential image. And calculating the difference value of the HSV three-channel matrix by acquiring the HSV three-channel matrix of the image to be identified and the HSV three-channel matrix of the reference image to obtain a difference image. It should be noted that, when there are a plurality of reference images, the HSV three-channel matrix of the reference image is an average value of the HSV three-channel matrices of the plurality of reference images.
And acquiring a differential value corresponding to the target pixel point in the differential image.
B5: and judging whether the difference value is greater than the hue difference value, and if so, determining the target pixel point as an abnormal pixel point.
The hue threshold is preset and is used for determining the difference between the hue of the target pixel point and the hue of the corresponding pixel point in the reference image. Note that the hue threshold may be set for the hue of the target object. For example, when the target object is a fallen leaf, the hue threshold may be set to a threshold related to yellow.
When the difference value is larger than the hue difference value, the difference between the target pixel point and the pixel point corresponding to the reference image can be determined, and the target pixel point is determined to be an abnormal pixel point.
Based on the above content, by dividing different target tone types, the corresponding abnormal pixel points can be determined for the target pixel points with different tones, so that the abnormal pixel points can be determined more accurately.
In one possible implementation, the region of interest may be selected for the image to be recognized and the reference image, the pixel point judgment range may be further reduced,
the image to be identified comprises an interesting region, and before the target brightness channel value and the target saturation channel value of the target pixel point are obtained and the target hue type of the target pixel point is determined according to the target brightness channel value and the target saturation channel value, the method further comprises the following steps:
judging whether a target pixel belongs to the region of interest, and if not, taking the next pixel of the target pixel as the target pixel;
and repeating the steps until the target pixel point belongs to the interested region.
When the image to be identified comprises the interested region, whether the pixel points in the interested region are abnormal pixel points can be directly judged.
And when the target pixel point is determined, judging whether the target pixel point belongs to the region of interest. And if the target pixel does not belong to the interested region, updating the target pixel, and taking the next pixel as a new target pixel. And judging whether the new target pixel belongs to the region of interest, if not, continuously replacing the target pixel until the target pixel belongs to the region of interest.
It should be noted that, when the image to be recognized is divided, whether the target pixel point in the sub-image to be recognized belongs to the region of interest may be determined. The determination and adjustment of the target pixel point are similar to the above method, and are not described herein again.
Further, the determining whether the image to be recognized has the target object according to the ratio of the number of the abnormal pixel points to the number of the target pixel points includes:
acquiring a third quantity of abnormal pixel points in the image to be identified and acquiring a fourth quantity of pixel points in an interested area in the image to be identified;
calculating a second ratio of the third quantity to the fourth quantity, and judging whether the second ratio is greater than a third threshold value;
and if so, determining that the image to be recognized has the target object.
And when the image to be identified has the region of interest, calculating a second ratio by using the third number of the abnormal pixel points and the fourth number of the pixel points in the region of interest, and judging the size relationship between the second ratio and a third threshold value. The third threshold is a preset threshold for determining whether the image to be recognized has the target object. And when the second ratio is larger than a third threshold value, determining that the target object exists in the image to be recognized.
In the embodiment of the application, the marking of the region of interest is carried out on the image to be recognized, so that the judgment of the pixel points in the region of interest can be realized, and the recognition efficiency of the target object in the image to be recognized is improved.
Based on the image recognition method provided by the above method embodiment, the embodiment of the present application further provides an image recognition apparatus, which will be described below with reference to the accompanying drawings.
Referring to fig. 2, the figure is a schematic structural diagram of an image recognition apparatus according to an embodiment of the present application. As shown in fig. 2, the image recognition apparatus includes:
a first acquisition unit 201 configured to acquire an image to be recognized and a reference image;
a second obtaining unit 202, configured to obtain a target luminance channel value and a target saturation channel value of a target pixel; the target pixel point is each pixel point in the image to be identified;
a first determining unit 203, configured to determine a target hue type of the target pixel according to the target luminance channel value and the target saturation channel value;
a second determining unit 204, configured to determine whether the target pixel is an abnormal pixel according to the target hue category and the reference image;
a third determining unit 205, configured to determine whether a target object exists in the image to be identified according to a target ratio of the number of the abnormal pixel points to the number of the target pixel points.
In one possible implementation, the apparatus further includes:
the dividing unit is used for dividing the image to be recognized to obtain a sub-image to be recognized;
the third determining unit 205 is specifically configured to obtain a first number of abnormal pixel points in a target sub-graph, and obtain a second number of pixel points in the target sub-graph; the target subgraph is each of the subgraphs to be identified;
calculating a first ratio of the first quantity to the second quantity, and judging whether the first ratio is greater than a first threshold value;
if so, determining the target subgraph as an abnormal subgraph;
acquiring the number of the abnormal subgraphs, and judging whether the number of the abnormal subgraphs is larger than a second threshold value or not;
and if so, determining that the image to be recognized has the target object.
In a possible implementation manner, the dividing unit is specifically configured to set a sliding window in the image to be recognized, and control the sliding window to move according to a preset moving manner;
and taking the image in the sliding window as a to-be-identified subgraph of the to-be-identified image.
In a possible implementation manner, the second determining unit 204 includes:
a first obtaining subunit, configured to, when the target color tone type belongs to a first color tone type, obtain a reference pixel point corresponding to the target pixel point in the reference image; the first shade category includes black, white, and gray;
the first judgment subunit is used for judging whether the colors of the target pixel point and the reference pixel point are the same or not;
a determining subunit, configured to determine the target pixel point as an abnormal pixel point if the target pixel point and the reference pixel point are different in color;
the second obtaining subunit is configured to obtain, when the target tone type belongs to a second tone type, a difference value corresponding to the target pixel point from the difference map; the differential image is obtained according to the HSV three-channel matrix of the image to be identified and the HSV three-channel matrix of the reference image;
and the second judgment subunit is used for judging whether the difference value is greater than the hue difference value or not, and if so, determining the target pixel point as an abnormal pixel point.
In a possible implementation manner, the first determining subunit is specifically configured to obtain a target hue channel value of the target pixel point;
acquiring a reference brightness channel value, a reference saturation channel value and a reference hue channel value of the reference pixel point;
and if the target hue channel value and the reference hue channel value are in a first channel value range, the target brightness channel value and the reference brightness channel value are in a second channel value range, and the target saturation channel value and the reference saturation channel value are in a third channel value range, determining that the colors of the target pixel point and the reference pixel point are the same.
In a possible implementation manner, the image to be identified includes a region of interest, and the apparatus further includes:
the judging unit is used for judging whether a target pixel point belongs to the interested region or not, and if not, taking the next pixel point of the target pixel point as a target pixel point;
and the execution unit is used for repeatedly executing the steps until the target pixel point belongs to the interested region.
In a possible implementation manner, the third determining unit 205 is specifically configured to obtain a third number of abnormal pixel points in the image to be identified, and obtain a fourth number of pixel points in the region of interest in the image to be identified;
calculating a second ratio of the third quantity to the fourth quantity, and judging whether the second ratio is greater than a third threshold value;
and if so, determining that the image to be recognized has the target object.
Based on the image recognition method provided by the embodiment of the method, the application provides an image recognition device, which comprises: a processor, a memory, a system bus;
the processor and the memory are connected through the system bus;
the memory is for storing one or more programs, the one or more programs including instructions, which when executed by the processor, cause the processor to perform the method of any of the above.
Based on the image recognition method provided by the above method embodiment, the present application provides a computer-readable storage medium, where instructions are stored, and when the instructions are executed on a terminal device, the terminal device is caused to execute any one of the above methods.
It should be noted that, in the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the system or the device disclosed by the embodiment, the description is simple because the system or the device corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It is further 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.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. An image recognition method, characterized in that the method comprises:
acquiring an image to be identified and a reference image;
acquiring a target brightness channel value and a target saturation channel value of a target pixel point; the target pixel point is each pixel point in the image to be identified;
determining the target hue type of the target pixel point according to the target brightness channel value and the target saturation channel value;
determining whether the target pixel points are abnormal pixel points according to the target tone type and the reference image;
and determining whether the image to be identified has a target object according to a target ratio of the number of the abnormal pixel points to the number of the target pixel points.
2. The method of claim 1, further comprising:
dividing the image to be recognized to obtain a sub-image to be recognized;
determining whether the image to be identified has a target object according to the ratio of the number of the abnormal pixel points to the number of the target pixel points, including:
acquiring a first quantity of abnormal pixel points in a target subgraph, and acquiring a second quantity of pixel points in the target subgraph; the target subgraph is each of the subgraphs to be identified;
calculating a first ratio of the first quantity to the second quantity, and judging whether the first ratio is greater than a first threshold value;
if so, determining the target subgraph as an abnormal subgraph;
acquiring the number of the abnormal subgraphs, and judging whether the number of the abnormal subgraphs is larger than a second threshold value or not;
and if so, determining that the image to be recognized has the target object.
3. The method according to claim 2, wherein the dividing the image to be recognized to obtain a sub-image to be recognized comprises:
setting a sliding window in the image to be recognized, and controlling the sliding window to move according to a preset moving mode;
and taking the image in the sliding window as a to-be-identified subgraph of the to-be-identified image.
4. The method of claim 1, wherein said determining whether the target pixel is an outlier based on the target hue class and the reference image comprises:
when the target color tone type belongs to a first color tone type, acquiring a reference pixel point corresponding to the target pixel point in the reference image; the first shade category includes black, white, and gray;
judging whether the colors of the target pixel point and the reference pixel point are the same or not;
if the target pixel point and the reference pixel point are different in color, determining the target pixel point as an abnormal pixel point;
when the target tone type belongs to the second tone type, acquiring a differential value corresponding to a target pixel point from the differential image; the differential image is obtained according to the HSV three-channel matrix of the image to be identified and the HSV three-channel matrix of the reference image;
and judging whether the difference value is greater than the hue difference value, and if so, determining the target pixel point as an abnormal pixel point.
5. The method of claim 4, wherein the determining whether the colors of the target pixel and the reference pixel are the same comprises:
acquiring a target hue channel value of the target pixel point;
acquiring a reference brightness channel value, a reference saturation channel value and a reference hue channel value of the reference pixel point;
and if the target hue channel value and the reference hue channel value are in a first channel value range, the target brightness channel value and the reference brightness channel value are in a second channel value range, and the target saturation channel value and the reference saturation channel value are in a third channel value range, determining that the colors of the target pixel point and the reference pixel point are the same.
6. The method according to claim 1 or 2, wherein the image to be identified includes a region of interest, and before the obtaining of the target luminance channel value and the target saturation channel value of the target pixel point and the determining of the target hue type of the target pixel point according to the target luminance channel value and the target saturation channel value, the method further includes:
judging whether a target pixel belongs to the region of interest, and if not, taking the next pixel of the target pixel as the target pixel;
and repeating the steps until the target pixel point belongs to the interested region.
7. The method according to claim 6, wherein the determining whether the image to be recognized has the target object according to the ratio of the number of the abnormal pixel points to the number of the target pixel points comprises:
acquiring a third quantity of abnormal pixel points in the image to be identified and acquiring a fourth quantity of pixel points in an interested area in the image to be identified;
calculating a second ratio of the third quantity to the fourth quantity, and judging whether the second ratio is greater than a third threshold value;
and if so, determining that the image to be recognized has the target object.
8. An image recognition apparatus, characterized in that the apparatus comprises:
the device comprises a first acquisition unit, a second acquisition unit and a processing unit, wherein the first acquisition unit is used for acquiring an image to be identified and a reference image;
the second acquisition unit is used for acquiring a target brightness channel value and a target saturation channel value of a target pixel point; the target pixel point is each pixel point in the image to be identified;
the first determining unit is used for determining the target hue type of the target pixel point according to the target brightness channel value and the target saturation channel value;
the second determining unit is used for determining whether the target pixel point is an abnormal pixel point according to the target tone type and the reference image;
and the third determining unit is used for determining whether the image to be identified has a target object according to a target ratio of the number of the abnormal pixel points to the number of the target pixel points.
9. An image recognition apparatus characterized by comprising: a processor, a memory, a system bus;
the processor and the memory are connected through the system bus;
the memory is to store one or more programs, the one or more programs comprising instructions, which when executed by the processor, cause the processor to perform the method of any of claims 1-7.
10. A computer-readable storage medium having stored therein instructions that, when executed on a terminal device, cause the terminal device to perform the method of any one of claims 1-7.
CN202011466865.9A 2020-12-14 2020-12-14 Image recognition method, device and equipment Active CN112597840B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011466865.9A CN112597840B (en) 2020-12-14 2020-12-14 Image recognition method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011466865.9A CN112597840B (en) 2020-12-14 2020-12-14 Image recognition method, device and equipment

Publications (2)

Publication Number Publication Date
CN112597840A true CN112597840A (en) 2021-04-02
CN112597840B CN112597840B (en) 2024-07-12

Family

ID=75195514

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011466865.9A Active CN112597840B (en) 2020-12-14 2020-12-14 Image recognition method, device and equipment

Country Status (1)

Country Link
CN (1) CN112597840B (en)

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040113917A1 (en) * 2002-12-13 2004-06-17 Kazuyoshi Matsumoto Object information processing apparatus, image processing system, game apparatus and image processing method
WO2004077351A1 (en) * 2003-02-28 2004-09-10 Sony Corporation Image processing device and method, recording medium, and program
CN104658014A (en) * 2015-02-10 2015-05-27 重庆金山科技(集团)有限公司 Method for detecting in-vivo chromaticity abnormality
CN106504264A (en) * 2016-10-27 2017-03-15 锐捷网络股份有限公司 Video foreground image extraction method and device
WO2018040756A1 (en) * 2016-09-05 2018-03-08 华为技术有限公司 Vehicle body colour identification method and device
CN108062554A (en) * 2017-12-12 2018-05-22 苏州科达科技股份有限公司 A kind of recognition methods of vehicle annual inspection label color and device
CN109299711A (en) * 2018-12-25 2019-02-01 常州纺织服装职业技术学院 Color tracking method and apparatus
WO2020082577A1 (en) * 2018-10-26 2020-04-30 平安科技(深圳)有限公司 Seal anti-counterfeiting verification method, device, and computer readable storage medium
CN111127342A (en) * 2019-12-05 2020-05-08 Oppo广东移动通信有限公司 Image processing method and device, storage medium and terminal equipment
CN111476780A (en) * 2020-04-07 2020-07-31 腾讯科技(深圳)有限公司 Image detection method and device, electronic equipment and storage medium
CN111476849A (en) * 2020-04-03 2020-07-31 腾讯科技(深圳)有限公司 Object color recognition method and device, electronic equipment and storage medium
CN111935418A (en) * 2020-08-18 2020-11-13 北京市商汤科技开发有限公司 Video processing method and device, electronic equipment and storage medium
CN111931724A (en) * 2020-09-23 2020-11-13 北京百度网讯科技有限公司 Signal lamp abnormity identification method and device, electronic equipment and road side equipment
CN111932282A (en) * 2020-09-22 2020-11-13 北京大鱼梦想科技有限公司 Anti-counterfeiting detection method and device

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040113917A1 (en) * 2002-12-13 2004-06-17 Kazuyoshi Matsumoto Object information processing apparatus, image processing system, game apparatus and image processing method
WO2004077351A1 (en) * 2003-02-28 2004-09-10 Sony Corporation Image processing device and method, recording medium, and program
CN104658014A (en) * 2015-02-10 2015-05-27 重庆金山科技(集团)有限公司 Method for detecting in-vivo chromaticity abnormality
WO2018040756A1 (en) * 2016-09-05 2018-03-08 华为技术有限公司 Vehicle body colour identification method and device
CN106504264A (en) * 2016-10-27 2017-03-15 锐捷网络股份有限公司 Video foreground image extraction method and device
CN108062554A (en) * 2017-12-12 2018-05-22 苏州科达科技股份有限公司 A kind of recognition methods of vehicle annual inspection label color and device
WO2020082577A1 (en) * 2018-10-26 2020-04-30 平安科技(深圳)有限公司 Seal anti-counterfeiting verification method, device, and computer readable storage medium
CN109299711A (en) * 2018-12-25 2019-02-01 常州纺织服装职业技术学院 Color tracking method and apparatus
CN111127342A (en) * 2019-12-05 2020-05-08 Oppo广东移动通信有限公司 Image processing method and device, storage medium and terminal equipment
CN111476849A (en) * 2020-04-03 2020-07-31 腾讯科技(深圳)有限公司 Object color recognition method and device, electronic equipment and storage medium
CN111476780A (en) * 2020-04-07 2020-07-31 腾讯科技(深圳)有限公司 Image detection method and device, electronic equipment and storage medium
CN111935418A (en) * 2020-08-18 2020-11-13 北京市商汤科技开发有限公司 Video processing method and device, electronic equipment and storage medium
CN111932282A (en) * 2020-09-22 2020-11-13 北京大鱼梦想科技有限公司 Anti-counterfeiting detection method and device
CN111931724A (en) * 2020-09-23 2020-11-13 北京百度网讯科技有限公司 Signal lamp abnormity identification method and device, electronic equipment and road side equipment

Also Published As

Publication number Publication date
CN112597840B (en) 2024-07-12

Similar Documents

Publication Publication Date Title
JP4746050B2 (en) Method and system for processing video data
CN109978890A (en) Target extraction method, device and terminal device based on image procossing
CN111325769B (en) Target object detection method and device
CN110399842B (en) Video processing method and device, electronic equipment and computer readable storage medium
CN107665327B (en) Lane line detection method and device
CN110334703B (en) Ship detection and identification method in day and night image
CN111274964B (en) Detection method for analyzing water surface pollutants based on visual saliency of unmanned aerial vehicle
CN109948504B (en) Lane line identification method and device
CN112489142A (en) Color identification method, device, equipment and storage medium
EP4276755A1 (en) Image segmentation method and apparatus, computer device, and readable storage medium
CN110070080A (en) A kind of character detecting method and device, equipment and computer readable storage medium
CN112396044A (en) Method for training lane line attribute information detection model and detecting lane line attribute information
Thomas et al. Smart car parking system using convolutional neural network
JP5338762B2 (en) White balance coefficient calculation device and program
JP2006222899A (en) Image processing apparatus and image processing method
JP2015092643A (en) Image processing device, image processing method thereof, computer program and image processing system
CN111079637A (en) Method, device and equipment for segmenting rape flowers in field image and storage medium
CN112597840B (en) Image recognition method, device and equipment
TWI498830B (en) A method and system for license plate recognition under non-uniform illumination
CN111402185B (en) Image detection method and device
CN114742741A (en) Video picture quality evaluation method, device, equipment and storage medium
CN113989774A (en) Traffic light detection method and device, vehicle and readable storage medium
CN112085703A (en) Method for detecting image definition of scanned part
Takahara et al. Making background subtraction robust to various illumination changes
JP2015219693A (en) Image detection device and program

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