Image recognition method and device, electronic equipment and readable storage medium
By binarizing the images captured by the VR camera and comparing the number of black pixels, the image layers are automatically identified, solving the layering problem when VR cameras capture complex textured scenes, improving recognition efficiency and accuracy, and ensuring the VR house viewing experience.
Patent Information
- Application Number
- CN202210984402.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-17
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-08-17
AI Technical Summary
When VR cameras capture scenes with complex textures, the asynchronous exposure timing of the sensors or the insufficient processing power of the ISP unit can cause image layering, which affects the VR house viewing effect and reduces the efficiency of human eye recognition.
By binarizing images captured in batches by VR cameras and comparing the number of black pixels in each row with a preset threshold, image layers are automatically identified, avoiding misjudging real dark textures as layers.
It enables accurate identification of layered images without the need for human visual recognition, reducing labor costs and ensuring the quality of VR house viewing.
Smart Images

Figure CN115376121B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image recognition technology, specifically relating to an image recognition method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] In related technologies, VR (Virtual Reality) cameras and other photography devices have problems such as asynchronous exposure timing of sensors or insufficient processing power of the image signal processing (ISP) unit. This can lead to image layering when shooting some scenes with complex textures, that is, the upper and lower parts of the image have different exposure effects, resulting in obvious "black lines" in the image.
[0003] For applications such as VR house viewing, a large number of photos need to be collected in batches using VR cameras. These photos inevitably contain layers. Due to the large number of photos, it would be a waste of manpower to judge whether there are layers by human eye recognition. On the other hand, failing to recognize the layers will affect the final effect of VR house viewing. Summary of the Invention
[0004] The purpose of this application is to provide an image recognition method, apparatus, electronic device, and readable storage medium that can automatically recognize layered images.
[0005] In a first aspect, embodiments of this application provide an image recognition method, including:
[0006] The image set to be identified is binarized. The image set to be identified includes N images. The content of the N images is the same and the exposure parameters of the N images are different. N is an integer greater than 2.
[0007] Determine the number of black pixels in each row of at least two binarized images, wherein the N binarized images include at least two images;
[0008] Based on the comparison between the number of black pixels and a preset threshold, N images are identified.
[0009] Secondly, embodiments of this application provide an image recognition device, comprising:
[0010] The processing module is used to perform binarization processing on the image set to be recognized. The image set to be recognized includes N images, the content of the N images is the same, and the exposure parameters of the N images are different, where N is an integer greater than 2.
[0011] A determination module is used to determine the number of black pixels in each row of pixels of at least two binarized images, wherein the N binarized images include at least two images;
[0012] The recognition module is used to recognize N images based on the comparison result of the number of black pixels and a preset number threshold.
[0013] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory, wherein the memory stores a program or instructions that can run on the processor, and when the program or instructions are executed by the processor, they implement the steps of the method as described in the first aspect.
[0014] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method as described in the first aspect.
[0015] Fifthly, embodiments of this application provide a chip including a processor and a communication interface coupled to the processor, the processor being used to run programs or instructions to implement the steps of the method as described in the first aspect.
[0016] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method as described in the first aspect.
[0017] In this embodiment, the images in the image set to be identified specifically include images captured in batches by a VR camera. To ensure optimal results, the VR camera takes multiple photos of the same content with different exposure parameters. After obtaining these images, they are binarized, resulting in images containing only black and white pixels. The number of black pixels in each row of at least two images is compared with a preset threshold. Based on the comparison result, automatic determination of whether the photos are layered can be achieved. This eliminates the need for human visual identification, reducing labor costs, and ensures accurate identification of layered photos, preventing them from affecting the final VR home viewing experience. Attached Figure Description
[0018] Figure 1 A flowchart of an image recognition method according to an embodiment of this application is shown;
[0019] Figure 2 A schematic diagram of image layering according to an embodiment of this application is shown;
[0020] Figure 3 A structural block diagram of an image recognition device according to an embodiment of this application is shown;
[0021] Figure 4 A structural block diagram of an electronic device according to an embodiment of this application is shown;
[0022] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application. Detailed Implementation
[0023] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0024] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0025] The image recognition method, apparatus, electronic device, and readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0026] In some embodiments of this application, an image recognition method is provided. Figure 1 A flowchart of an image recognition method according to an embodiment of this application is shown, such as... Figure 1 As shown, the method includes:
[0027] Step 102: Binarize the image set to be recognized;
[0028] In step 102, the set of images to be identified includes N images, all of which have the same content and different exposure parameters, where N is an integer greater than 2.
[0029] Step 104: Determine the number of black pixels in each row of pixels in at least two binarized images;
[0030] In step 104, the N images after binarization include at least two images;
[0031] Step 106: Based on the comparison result of the number of black pixels and the preset number threshold, identify N images.
[0032] In this embodiment of the application, the images in the image set to be identified specifically include images captured in batches by a VR camera. In order to ensure the best results, the VR camera will take multiple photos of the same content with different exposure parameters, wherein the different exposure parameters can be different exposure times.
[0033] Due to potential issues with VR cameras, such as asynchronous sensor exposure timing or insufficient processing power of the ISP unit, image layering may occur when shooting scenes with complex textures. Figure 2 A schematic diagram of image layering according to an embodiment of this application is shown, such as... Figure 2 As shown, image 200 is an image with layering. The upper half 202 and the lower half 204 have different exposure values. The brightness of the upper half 202 is significantly higher than that of the lower half 204, forming a black line 206 at the boundary between light and dark in image 200, which seriously affects the visual perception of image 100.
[0034] In this case, the embodiments of this application use the original images captured by the VR camera as the set to be processed, and perform binarization processing on N images in the set. The binarization processing can replace pixels with brightness values greater than a certain threshold with white pixels and pixels with brightness values lower than a certain threshold with black pixels.
[0035] Therefore, if an image has layers and there is a black line at the boundary between light and dark, the number of black pixels in the row of pixels where the black line is located will be greater than the number threshold. Therefore, it can be determined whether there is a layer in the image by obtaining the number of black pixels in each row of pixels and comparing it with the number threshold.
[0036] Meanwhile, since the N images in the image set to be identified contain the same content and have different exposure parameters, and image layering is a low-probability event, the possibility of two images with different exposure parameters exhibiting layering is extremely low. Therefore, this application determines the number of black pixels in each row of at least two images. If the number of black pixels in a certain row of the two images is large, it indicates that there may be actual dark texture in the image, rather than image layering. However, if the number of black pixels in the same row of the two images is significantly greater in one image than in the other, it indicates that the image has layering, thus avoiding misjudgment of image layering.
[0037] Using the above method, all images in the image set to be identified are identified, thereby identifying all abnormal images.
[0038] The embodiments of this application can automatically determine the layering of images. On the one hand, it eliminates the need for human eye recognition, reducing labor costs. On the other hand, it ensures that layered photos are accurately identified, preventing them from affecting the final VR house viewing effect and guaranteeing the VR house viewing experience.
[0039] In some embodiments of this application, at least two images include a first image and a second image;
[0040] Based on the comparison between the number of black pixels and a preset threshold, identification is performed on N images, specifically including:
[0041] If the first number of black pixels in the Mth row of the first image is greater than or equal to a number threshold, determine the second number of black pixels in the Mth row of the second image, where M is a positive integer.
[0042] If the second quantity is less than the product of the first quantity and the preset ratio, the first image is identified as an abnormal image, wherein the preset ratio is greater than 0 and less than 1.
[0043] In this embodiment of the application, when recognizing images in the image set to be recognized, a first image and a second image are selected from N images. Since the content of the N images is the same but the exposure parameters are different, the first image and the second image are images with the same content but different exposure times.
[0044] Specifically, the N images have the same image size; for example, the first image and the second image both have an image size of x×y pixels. When identifying whether an image is layered, firstly, the number of black pixels in each row of pixels in the first image is determined.
[0045] When it is determined that the first number of black pixels in the Mth row of the first image is greater than a preset threshold, it indicates that the Mth row of pixels may be a black line caused by image layering. At this time, the second number of black pixels in the Mth row of the second image is further determined.
[0046] It is understandable that the number threshold is related to the total number of pixels in a row of these N images. Assuming that a row of pixels includes a total of A pixels, the pixel threshold can be a×A, where a can be set according to actual needs, satisfying 0.4≤a≤1.
[0047] After determining the second number of black pixels in the Mth row of the second image, the product of the second number and a preset ratio is compared with the first number. For example, if the first number is b1, the second number is b2, and the preset ratio is c, then it is determined whether c×b2<b1 is true.
[0048] The preset ratio c satisfies: 0 ≤ c ≤ 1.
[0049] If this is true, it means that there is a black line in the first image, while there is no black line in the second image with the same content but different exposure. Therefore, it can be determined that the first image has a layered image and is an abnormal image.
[0050] This application improves the reliability of image layer recognition by comparing the number of black pixels in the same row of two images with the same content but different exposures, thus avoiding the identification of dark textures that are actually contained in the image content as black lines of image layering.
[0051] In some embodiments of this application, the identification of N images based on a comparison between the number of black pixels and a preset number threshold further includes:
[0052] If the number of black pixels in each row of the first image is less than a threshold, or if the second number is greater than or equal to the product of the first number and a preset ratio, the first image is identified as a normal image.
[0053] In this embodiment of the application, if the number of black pixels in each row of pixels in the first image is not greater than the number threshold, it means that there are no black lines in the first image caused by image layering. Therefore, it can be determined that the first image does not have image layering and is a normal image.
[0054] If the first number of black pixels in the Mth row of the first image is greater than the number threshold, but the second number of black pixels in the Mth row of the second image, which has the same content as the first image but different exposure parameters, is not less than the product of the first number and a preset ratio, that is, the above discriminant c×b2<b1 does not hold, then it is determined that the Mth row of the second image has the same dark texture as the Mth row of the first image, that is, the Mth row of pixels is not a black line, but an actual dark texture. Therefore, it can also be determined that the first image does not have image layering and is a normal image.
[0055] This application improves the reliability of image layer recognition by comparing the number of black pixels in the same row of two images with the same content but different exposures, thus avoiding the identification of dark textures that are actually contained in the image content as black lines of image layering.
[0056] In some embodiments of this application, after identifying the first image as an abnormal image, the image recognition method further includes: intercepting the abnormal image.
[0057] In this embodiment of the application, after any one of the N images is identified as an abnormal image, the abnormal images are connected, that is, the VR house viewing scene is avoided by constructing an abnormal image with image layering, thereby ensuring the VR house viewing experience.
[0058] It is understandable that intercepted abnormal images can be deleted or discarded, or they can be marked and the VR camera can be controlled to retake an image with the same shooting parameters as the abnormal image.
[0059] In this embodiment of the application, the binarization processing of the image set to be recognized includes:
[0060] Perform grayscale processing on N images to obtain N grayscale images;
[0061] Binarize N grayscale images based on a preset pixel value threshold.
[0062] In this embodiment of the application, when performing binarization processing on N images of the image to be recognized, the N images are first subjected to grayscale processing. Grayscale processing can remove the color information of each pixel in the N images, retaining only the brightness information, thereby obtaining N grayscale images. Each pixel in these grayscale images corresponds to a pixel value, and the range of the pixel value is 0 to 255, where the smaller the pixel value, the smaller the brightness, and the larger the pixel value, the larger the brightness.
[0063] Set a pixel value threshold. In the grayscale image, the pixel value of pixels with a value greater than or equal to the pixel value threshold is set to 255, which means that the pixel is set to white. The pixel value of pixels with a value less than the pixel value threshold is set to 0, which means that the pixel is set to black.
[0064] After this adjustment, the original image is transformed into a binary image containing only black and white pixels. By determining the number of black pixels in each row of pixels in the binary image, it is possible to determine whether there are black lines caused by image layering, thus achieving automatic recognition of image layering.
[0065] In some embodiments of this application, before binarizing N grayscale images according to a preset pixel value threshold, the image recognition method further includes:
[0066] Determine the average brightness value of N grayscale images;
[0067] Based on the average brightness value, sort the N grayscale images. In the sorted N grayscale images, the first image and the second image are adjacent.
[0068] In this embodiment of the application, after converting N images into N corresponding grayscale images, the average brightness value of these grayscale images is determined, and the N grayscale images are sorted according to the size of the average brightness value. In the sorted sequence, the average brightness difference between two adjacent grayscale images is the smallest.
[0069] When identifying whether an image has layering, a first image and a second image are selected. When it is determined that the first number of black pixels in the Mth row of the first image is greater than a threshold, the second number of black pixels in the Mth row of the second image adjacent to the first image is further determined in the sequence sorted by average brightness value. Based on the product of the first number and a preset ratio, and the comparison result with the first number, it is determined whether the Mth row of the first image is a dark texture or a black line caused by image layering. This can effectively determine whether the Mth row of pixels is a black line caused by image layering or an actual dark texture, thereby improving the accuracy and reliability of image recognition.
[0070] In some embodiments of this application, the second image includes a first sub-image and a second sub-image, wherein the average brightness of the first sub-image is less than the average brightness of the first image, and the average brightness of the second sub-image is greater than the average brightness of the first image.
[0071] In this embodiment of the application, the second image includes a first sub-image and a second sub-image. That is, after determining that the number of black pixels in the Mth row of the first image is greater than the number threshold, the number of black pixels in the Mth row of the first sub-image, which is adjacent to the first image but has a lower average brightness than the first image, is further determined in the sequence sorted by average brightness. The number of black pixels in the Mth row of the second sub-image, which is adjacent to the first image but has a higher average brightness than the first image, is also determined.
[0072] Here, the first image is denoted as n0, the first sub-image as n1, and the second sub-image as n2. If the first number of black pixels in the Mth row of n0 is greater than the number threshold, and the product of the number of black pixels in the Mth row of both images n1 and n2 and the preset ratio is less than the first number, then it is determined that there are black lines caused by image layering in n0, and n0 is marked as an abnormal image.
[0073] If the first number of black pixels in the Mth row of n0 is greater than the number threshold, and the product of the number of black pixels in the Mth row of images n1 and n2 and the preset ratio is not less than the first number, then the Mth row of pixels in n0 is determined to be an actual dark texture, and n0 is marked as a normal image.
[0074] This application can further improve the reliability of image layer recognition by comparing the current image with two images of the same content but with different exposures, one with higher brightness and the other with lower brightness, in the number of black pixels in the same row.
[0075] In some embodiments of this application, after binarizing N grayscale images according to a preset pixel value threshold, the image recognition method further includes:
[0076] Determine the discrete white pixel regions in the target grayscale image after binarization, wherein the N grayscale images after binarization include the target grayscale image;
[0077] The discrete white pixel regions are filled.
[0078] In this embodiment of the application, when performing binarization processing on the image, a preset threshold is used to set the pixel value exceeding the threshold to 255, i.e., white pixels, and the pixel value below the threshold to 0, i.e., black pixels.
[0079] Since the images captured by VR cameras may be relatively complex, some dark objects, such as wooden furniture, may produce discrete bright spots or light spots due to factors such as lighting. After the image is binarized, these bright spots or light spots will form discrete white pixel areas, that is, white pixel areas discretely distributed in a large area of black pixels, such as small "bright spots".
[0080] Among them, white pixel regions with an area smaller than a preset area threshold can be defined as discrete white pixel regions.
[0081] Filling these discrete white pixels can reduce the impact of discrete bright spots or glare on image recognition and improve the reliability of image recognition.
[0082] The image recognition method provided in this application can be executed by an image recognition device. This application uses an image recognition device to perform the image recognition method as an example to illustrate the image recognition device provided in this application.
[0083] In some embodiments of this application, an image recognition device is provided. Figure 3 A structural block diagram of an image recognition device according to an embodiment of this application is shown, such as... Figure 3 As shown, the image recognition device 300 includes:
[0084] The processing module 302 is used to perform binarization processing on the image set to be recognized, wherein the image set to be recognized includes N images, the image content of the N images is the same, and the exposure parameters of the N images are different, and N is an integer greater than 2;
[0085] The determining module 304 is used to determine the number of black pixels in each row of pixels of at least two binarized images, wherein the N binarized images include at least two images;
[0086] The recognition module 306 is used to recognize N images based on the comparison result of the number of black pixels and a preset number threshold.
[0087] In this embodiment of the application, the images in the image set to be identified specifically include images captured in batches by a VR camera. In order to ensure the best results, the VR camera will take multiple photos of the same content with different exposure parameters, wherein the different exposure parameters can be different exposure times.
[0088] Due to potential issues with VR cameras, such as asynchronous sensor exposure timing or insufficient processing power of the ISP unit, image layering may occur when shooting scenes with complex textures. Figure 2 A schematic diagram of image layering according to an embodiment of this application is shown, such as... Figure 2 As shown, image 200 is an image with layering. The upper half 202 and the lower half 204 have different exposure values. The brightness of the upper half 202 is significantly higher than that of the lower half 204, forming a black line 206 at the boundary between light and dark in image 200, which seriously affects the visual perception of image 100.
[0089] In this case, the embodiments of this application use the original images captured by the VR camera as the set to be processed, and perform binarization processing on N images in the set. The binarization processing can replace pixels with brightness values greater than a certain threshold with white pixels and pixels with brightness values lower than a certain threshold with black pixels.
[0090] Therefore, if an image has layers and there is a black line at the boundary between light and dark, the number of black pixels in the row of pixels where the black line is located will be greater than the number threshold. Therefore, it can be determined whether there is a layer in the image by obtaining the number of black pixels in each row of pixels and comparing it with the number threshold.
[0091] Meanwhile, since the N images in the image set to be identified contain the same content and have different exposure parameters, and image layering is a low-probability event, the possibility of two images with different exposure parameters exhibiting layering is extremely low. Therefore, this application determines the number of black pixels in each row of at least two images. If the number of black pixels in a certain row of the two images is large, it indicates that there may be actual dark texture in the image, rather than image layering. However, if the number of black pixels in the same row of the two images is significantly greater in one image than in the other, it indicates that the image has layering, thus avoiding misjudgment of image layering.
[0092] Using the above method, all images in the image set to be identified are identified, thereby identifying all abnormal images.
[0093] The embodiments of this application can automatically determine the layering of images. On the one hand, it eliminates the need for human eye recognition, reducing labor costs. On the other hand, it ensures that layered photos are accurately identified, preventing them from affecting the final VR house viewing effect and guaranteeing the VR house viewing experience.
[0094] In some embodiments of this application, at least two images include a first image and a second image;
[0095] The determining module is further configured to determine a second number of black pixels in the Mth row of the second image if the first number of black pixels in the first image is greater than or equal to a number threshold, where M is a positive integer;
[0096] The recognition module is also used to recognize the first image as an abnormal image when the second quantity is less than the product of the first quantity and the preset ratio, wherein the preset ratio is greater than 0 and the preset ratio is less than 1.
[0097] In this embodiment of the application, when recognizing images in the image set to be recognized, a first image and a second image are selected from N images. Since the content of the N images is the same but the exposure parameters are different, the first image and the second image are images with the same content but different exposure times.
[0098] Specifically, the N images have the same image size; for example, the first image and the second image both have an image size of x×y pixels. When identifying whether an image is layered, firstly, the number of black pixels in each row of pixels in the first image is determined.
[0099] When it is determined that the first number of black pixels in the Mth row of the first image is greater than a preset threshold, it indicates that the Mth row of pixels may be a black line caused by image layering. At this time, the second number of black pixels in the Mth row of the second image is further determined.
[0100] It is understandable that the number threshold is related to the total number of pixels in a row of these N images. Assuming that a row of pixels includes a total of A pixels, the pixel threshold can be a×A, where a can be set according to actual needs, satisfying 0.4≤a≤1.
[0101] After determining the second number of black pixels in the Mth row of the second image, the product of the second number and a preset ratio is compared with the first number. For example, if the first number is b1, the second number is b2, and the preset ratio is c, then it is determined whether c×b2<b1 is true.
[0102] The preset ratio c satisfies: 0 ≤ c ≤ 1.
[0103] If this is true, it means that there is a black line in the first image, while there is no black line in the second image with the same content but different exposure. Therefore, it can be determined that the first image has a layered image and is an abnormal image.
[0104] This application improves the reliability of image layer recognition by comparing the number of black pixels in the same row of two images with the same content but different exposures, thus avoiding the identification of dark textures that are actually contained in the image content as black lines of image layering.
[0105] In some embodiments of this application, the recognition module is further configured to recognize the first image as a normal image when the number of black pixels in each row of the first image is less than a number threshold, or the second number is greater than or equal to the product of the first number and a preset ratio.
[0106] In this embodiment of the application, if the number of black pixels in each row of pixels in the first image is not greater than the number threshold, it means that there are no black lines in the first image caused by image layering. Therefore, it can be determined that the first image does not have image layering and is a normal image.
[0107] If the first number of black pixels in the Mth row of the first image is greater than the number threshold, but the second number of black pixels in the Mth row of the second image, which has the same content as the first image but different exposure parameters, is not less than the product of the first number and a preset ratio, that is, the above discriminant c×b2<b1 does not hold, then it is determined that the Mth row of the second image has the same dark texture as the Mth row of the first image, that is, the Mth row of pixels is not a black line, but an actual dark texture. Therefore, it can also be determined that the first image does not have image layering and is a normal image.
[0108] This application improves the reliability of image layer recognition by comparing the number of black pixels in the same row of two images with the same content but different exposures, thus avoiding the identification of dark textures that are actually contained in the image content as black lines of image layering.
[0109] In some embodiments of this application, the image recognition device further includes an interception module for intercepting abnormal images.
[0110] In this embodiment of the application, after any one of the N images is identified as an abnormal image, the abnormal images are connected, that is, the VR house viewing scene is avoided by constructing an abnormal image with image layering, thereby ensuring the VR house viewing experience.
[0111] It is understandable that intercepted abnormal images can be deleted or discarded, or they can be marked and the VR camera can be controlled to retake an image with the same shooting parameters as the abnormal image.
[0112] In some embodiments of this application, the processing module is further configured to:
[0113] Perform grayscale processing on N images to obtain N grayscale images;
[0114] Binarize N grayscale images based on a preset pixel value threshold.
[0115] In this embodiment of the application, when performing binarization processing on N images of the image to be recognized, the N images are first subjected to grayscale processing. Grayscale processing can remove the color information of each pixel in the N images, retaining only the brightness information, thereby obtaining N grayscale images. Each pixel in these grayscale images corresponds to a pixel value, and the range of the pixel value is 0 to 255, where the smaller the pixel value, the smaller the brightness, and the larger the pixel value, the larger the brightness.
[0116] Set a pixel value threshold. In the grayscale image, the pixel value of pixels with a value greater than or equal to the pixel value threshold is set to 255, which means that the pixel is set to white. The pixel value of pixels with a value less than the pixel value threshold is set to 0, which means that the pixel is set to black.
[0117] After this adjustment, the original image is transformed into a binary image containing only black and white pixels. By determining the number of black pixels in each row of pixels in the binary image, it is possible to determine whether there are black lines caused by image layering, thus achieving automatic recognition of image layering.
[0118] In some embodiments of this application, the determining module is further configured to determine the average brightness value of N grayscale images;
[0119] The image recognition device also includes:
[0120] The sorting module is used to sort N grayscale images according to their average brightness values. In the sorted N grayscale images, the first image and the second image are adjacent.
[0121] In this embodiment of the application, after converting N images into N corresponding grayscale images, the average brightness value of these grayscale images is determined, and the N grayscale images are sorted according to the size of the average brightness value. In the sorted sequence, the average brightness difference between two adjacent grayscale images is the smallest.
[0122] When identifying whether an image has layering, a first image and a second image are selected. When it is determined that the first number of black pixels in the Mth row of the first image is greater than a threshold, the second number of black pixels in the Mth row of the second image adjacent to the first image is further determined in the sequence sorted by average brightness value. Based on the product of the first number and a preset ratio, and the comparison result with the first number, it is determined whether the Mth row of the first image is a dark texture or a black line caused by image layering. This can effectively determine whether the Mth row of pixels is a black line caused by image layering or an actual dark texture, thereby improving the accuracy and reliability of image recognition.
[0123] In some embodiments of this application, the second image includes a first sub-image and a second sub-image, wherein the average brightness of the first sub-image is less than the average brightness of the first image, and the average brightness of the second sub-image is greater than the average brightness of the first image.
[0124] In this embodiment of the application, the second image includes a first sub-image and a second sub-image. That is, after determining that the number of black pixels in the Mth row of the first image is greater than the number threshold, the number of black pixels in the Mth row of the first sub-image, which is adjacent to the first image but has a lower average brightness than the first image, is further determined in the sequence sorted by average brightness. The number of black pixels in the Mth row of the second sub-image, which is adjacent to the first image but has a higher average brightness than the first image, is also determined.
[0125] Here, the first image is denoted as n0, the first sub-image as n1, and the second sub-image as n2. If the first number of black pixels in the Mth row of n0 is greater than the number threshold, and the product of the number of black pixels in the Mth row of both images n1 and n2 and the preset ratio is less than the first number, then it is determined that there are black lines caused by image layering in n0, and n0 is marked as an abnormal image.
[0126] If the first number of black pixels in the Mth row of n0 is greater than the number threshold, and the product of the number of black pixels in the Mth row of images n1 and n2 and the preset ratio is not less than the first number, then the Mth row of pixels in n0 is determined to be an actual dark texture, and n0 is marked as a normal image.
[0127] This application can further improve the reliability of image layer recognition by comparing the current image with two images of the same content but with different exposures, one with higher brightness and the other with lower brightness, in the number of black pixels in the same row.
[0128] In some embodiments of this application, the determining module is further configured to determine discrete white pixel regions in the target grayscale image after binarization, wherein the N grayscale images after binarization include the target grayscale image.
[0129] The image recognition device also includes:
[0130] The fill module is used to fill discrete white pixel areas.
[0131] In this embodiment of the application, when performing binarization processing on the image, a preset threshold is used to set the pixel value exceeding the threshold to 255, i.e., white pixels, and the pixel value below the threshold to 0, i.e., black pixels.
[0132] Since the images captured by VR cameras may be relatively complex, some dark objects, such as wooden furniture, may produce discrete bright spots or light spots due to factors such as lighting. After the image is binarized, these bright spots or light spots will form discrete white pixel areas, that is, white pixel areas discretely distributed in a large area of black pixels, such as small "bright spots".
[0133] Filling these discrete white pixels can reduce the impact of discrete bright spots or glare on image recognition and improve the reliability of image recognition.
[0134] The image recognition device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0135] The image recognition device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0136] The image recognition device provided in this application embodiment can implement all the processes implemented in the above method embodiments, and will not be described again here to avoid repetition.
[0137] Optionally, embodiments of this application also provide an electronic device. Figure 4 A structural block diagram of an electronic device according to an embodiment of this application is shown, such as... Figure 4 As shown, the electronic device 400 includes a processor 402, a memory 404, and a program or instructions stored in the memory 404 and executable on the processor 402. When the program or instructions are executed by the processor 402, they implement the various processes of the above method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.
[0138] It should be noted that the electronic devices in the embodiments of this application include the aforementioned mobile electronic devices and non-mobile electronic devices.
[0139] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0140] The electronic device 500 includes, but is not limited to, components such as: radio frequency unit 501, network module 502, audio output unit 503, input unit 504, sensor 505, display unit 506, user input unit 507, interface unit 508, memory 509, and processor 510.
[0141] Those skilled in the art will understand that the electronic device 500 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 510 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0142] The processor 510 is used to perform binarization processing on the image set to be recognized, wherein the image set to be recognized includes N images, the N images have the same image content, and the N images have different exposure parameters, where N is an integer greater than 2; determine the number of black pixels in each row of pixels of at least two images after binarization, wherein the N images after binarization include at least two images; and recognize the N images based on the comparison result of the number of black pixels and a preset number threshold.
[0143] In this embodiment, the images in the image set to be identified specifically include images captured in batches by a VR camera. To ensure optimal results, the VR camera takes multiple photos of the same content with different exposure parameters. After obtaining these images, they are binarized, resulting in images containing only black and white pixels. The number of black pixels in each row of at least two images is compared with a preset threshold. Based on the comparison result, automatic determination of whether the photos are layered can be achieved. This eliminates the need for human visual identification, reducing labor costs, and ensures accurate identification of layered photos, preventing them from affecting the final VR home viewing experience.
[0144] Optionally, at least two images include a first image and a second image; the processor 510 is further configured to identify N images based on a comparison result of the number of black pixels and a preset quantity threshold, specifically including: if the first number of black pixels in the Mth row of the first image is greater than or equal to the quantity threshold, determining the second number of black pixels in the Mth row of the second image, where M is a positive integer; if the second number is less than the product of the first number and a preset ratio, identifying the first image as an abnormal image, wherein the preset ratio is greater than 0 and less than 1.
[0145] This application improves the reliability of image layer recognition by comparing the number of black pixels in the same row of two images with the same content but different exposures, thus avoiding the identification of dark textures that are actually contained in the image content as black lines of image layering.
[0146] Optionally, the processor 510 is further configured to identify the first image as a normal image if the number of black pixels in each row of the first image is less than a number threshold, or if the second number is greater than or equal to the product of the first number and a preset ratio.
[0147] This application improves the reliability of image layer recognition by comparing the number of black pixels in the same row of two images with the same content but different exposures, thus avoiding the identification of dark textures that are actually contained in the image content as black lines of image layering.
[0148] Optionally, the processor 510 is also used to intercept abnormal images.
[0149] In this embodiment of the application, after any one of the N images is identified as an abnormal image, the abnormal images are connected, that is, the VR house viewing scene is avoided by constructing an abnormal image with image layering, thereby ensuring the VR house viewing experience.
[0150] Optionally, the processor 510 is also used to perform grayscale processing on N images to obtain N grayscale images; and to perform binarization processing on the N grayscale images according to a preset pixel value threshold.
[0151] This application determines whether there are black lines in the image caused by image layering by judging the number of black pixels in each row of pixels in the binarized image, thus realizing automatic recognition of image layering.
[0152] Optionally, the processor 510 is further configured to determine the average brightness value of the N grayscale images; and sort the N grayscale images according to the average brightness value, wherein the first image and the second image are adjacent in the sorted N grayscale images.
[0153] When identifying whether an image has layering, this application selects an adjacent first image and a second image. When it is determined that the first number of black pixels in the Mth row of the first image is greater than a threshold, it further determines the second number of black pixels in the Mth row of the second image adjacent to the first image in the sequence sorted by average brightness value. Based on the product of the first number and a preset ratio, and the comparison result with the first number, it determines that the Mth row of the first image is a dark texture or a black line caused by image layering. This can effectively determine whether the Mth row of pixels is a black line caused by image layering or an actual dark texture, thereby improving the accuracy and reliability of image recognition.
[0154] Optionally, the second image includes a first sub-image and a second sub-image, wherein the average brightness of the first sub-image is less than the average brightness of the first image, and the average brightness of the second sub-image is greater than the average brightness of the first image.
[0155] This application can further improve the reliability of image layer recognition by comparing the current image with two images of the same content but with different exposures, one with higher brightness and the other with lower brightness, in the number of black pixels in the same row.
[0156] Optionally, the processor 510 is further configured to determine discrete white pixel regions in the binarized target grayscale image, wherein the N binarized grayscale images include the target grayscale image; and to perform filling processing on the discrete white pixel regions.
[0157] This application fills these discrete white pixels, which can reduce the impact of discrete bright spots or light spots in the image on image recognition and improve the reliability of image recognition.
[0158] It should be understood that, in this embodiment, the input unit 504 may include a graphics processing unit (GPU) 5041 and a microphone 5042. The GPU 5041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 506 may include a display panel 5061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 507 includes at least one of a touch panel 5071 and other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0159] The memory 509 can be used to store software programs and various data. The memory 509 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 509 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 509 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0160] Processor 510 may include one or more processing units; optionally, processor 510 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 510.
[0161] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0162] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0163] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0164] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0165] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above method embodiments and achieve the same technical effects. To avoid repetition, it will not be described again here.
[0166] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0167] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0168] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. An image recognition method, characterized in that, include: The image set to be identified is binarized, wherein the image set to be identified includes N images, the N images have the same content, and the exposure parameters of the N images are different, where N is an integer greater than 2; Determine the number of black pixels in each row of at least two binarized images, wherein the N binarized images include the at least two images; Based on the comparison result between the number of black pixels and a preset number threshold, the N images are identified, including: determining whether layering occurs in the image by comparing whether the number of black pixels in each row of pixels is greater than the number threshold.
2. The image recognition method according to claim 1, characterized in that, The at least two images include a first image and a second image; The step of identifying the N images based on the comparison result of the number of black pixels and a preset number threshold specifically includes: If the first number of black pixels in the Mth row of the first image is greater than or equal to the number threshold, the second number of black pixels in the Mth row of the second image is determined, where M is a positive integer. If the second quantity is less than the product of the first quantity and a preset ratio, the first image is identified as an abnormal image, wherein the preset ratio is greater than 0 and less than 1.
3. The image recognition method according to claim 2, characterized in that, The step of identifying the N images based on the comparison result of the number of black pixels and a preset number threshold further includes: If the number of black pixels in each row of the first image is less than the number threshold, or if the second number is greater than or equal to the product of the first number and the preset ratio, the first image is identified as a normal image.
4. The image recognition method according to claim 2, characterized in that, After identifying the first image as an abnormal image, the image recognition method further includes: The abnormal image was intercepted.
5. The image recognition method according to any one of claims 2 to 4, characterized in that, The binarization process of the image set to be recognized includes: The N images are processed to obtain N grayscale images; The N grayscale images are binarized according to a preset pixel value threshold.
6. The image recognition method according to claim 5, characterized in that, Before binarizing the N grayscale images according to a preset pixel value threshold, the image recognition method further includes: Determine the average brightness value of the N grayscale images; The N grayscale images are sorted according to the average brightness value. In the sorted N grayscale images, the first image and the second image are adjacent.
7. The image recognition method according to claim 6, characterized in that, The second image includes a first sub-image and a second sub-image, wherein the average brightness of the first sub-image is less than the average brightness of the first image, and the average brightness of the second sub-image is greater than the average brightness of the first image.
8. The image recognition method according to claim 5, characterized in that, After binarizing the N grayscale images according to a preset pixel value threshold, the image recognition method further includes: Determine discrete white pixel regions in the target grayscale image after binarization, wherein the N grayscale images after binarization include the target grayscale image; The discrete white pixel regions are filled.
9. An image recognition device, characterized in that, include: The processing module is used to perform binarization processing on the image set to be identified, wherein the image set to be identified includes N images, the image content of the N images is the same, and the exposure parameters of the N images are different, where N is an integer greater than 2; A determining module is used to determine the number of black pixels in each row of pixels of at least two binarized images, wherein the N binarized images include the at least two images; The recognition module is used to recognize the N images based on the comparison result of the number of black pixels and a preset number threshold, including: determining whether layering occurs in the image by comparing whether the number of black pixels in each row of pixels is greater than the number threshold.
10. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the image recognition method as described in any one of claims 1 to 8.
11. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the image recognition method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Image processing method and device, camera module and equipment
CN114283092A
Method and apparatus for automatic format decision related to the useful picture content part of a picture signal
EP1523175A1