Digital image detection method and device based on OpenCV, electronic equipment and storage medium

By applying image preprocessing and edge detection technology on the OpenCV platform, the accuracy of image digital recognition in complex environments is solved, and efficient and accurate digital recognition effect is achieved.

CN119887675APending Publication Date: 2025-04-25BEIJING XINLI MACHINERY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411949063.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The prior art is difficult to accurately identify digital information in images in complex environments.

Method used

Using OpenCV-based digital image detection method, images are collected through the camera, pre-processing algorithms (such as grayscale processing, Gaussian blur processing and image histogram equalization processing) are applied, and edge detection is used by Sobel operator to determine the position information of the digital region, and the digital region is calibrated in the original image.

Benefits of technology

It realizes efficient and accurate identification of digital information from images in complex environments, and improves the accuracy and efficiency of digital recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119887675A_ABST
    Figure CN119887675A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a digital image detection method and device based on OpenCV, electronic equipment and a storage medium, the method is applied to a computer, the method is applied to the computer, and the method comprises the steps that a first image is collected through a camera; calling a preprocessing algorithm of OpenCV to preprocess the first image to obtain a second image; the preprocessing algorithm comprises one or a combination of more of the following algorithms: gray processing, Gaussian blur processing and image histogram equalization processing; calling a Sobel operator of OpenCV to carry out edge detection on the second image to obtain position information of a digital region in the second image; and calibrating the number area in the first image according to the position information, thereby efficiently and accurately identifying the number from the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a digital image detection method, device, electronic device and storage medium based on OpenCV. Background Art

[0002] A key subfield of computer vision is digital image recognition technology, which aims to give computers human-like visual capabilities, enabling them to perceive their surroundings and extract valuable information from them. This technology plays an important role in multiple industries, including but not limited to security surveillance, intelligent transportation systems, medical diagnosis, and industrial automation.

[0003] Specifically, automatic identification of license plate numbers in traffic monitoring, verification of employee ID cards in access control systems in security monitoring, rapid retrieval of medical record numbers in medical image analysis, and tracking of product serial numbers in industrial automation all involve a common technical challenge: how to accurately identify numbers from images. The core of this technical problem lies in the development of efficient and accurate image recognition algorithms to ensure that digital information can be reliably extracted from images in various complex environments. Summary of the invention

[0004] The embodiments of the present application disclose a digital image detection method, device, electronic device and storage medium based on OpenCV, which can efficiently and accurately recognize numbers from images.

[0005] The embodiment of the present application discloses a digital image detection method based on OpenCV, which is applied to a computer and includes: acquiring a first image through a camera; calling a preprocessing algorithm of OpenCV to preprocess the first image to obtain a second image; the preprocessing algorithm includes a combination of one or more of the following algorithms: grayscale processing, Gaussian blur processing, and image histogram equalization processing; calling the Sobel operator of OpenCV to perform edge detection on the second image to obtain position information of a digital area in the second image; and calibrating the digital area in the first image according to the position information.

[0006] As an optional implementation, capturing the first image through the camera includes: using the cvCreateCameraCapture function in the OpenCV library to open the camera; using the cvNamedWindow function to create a display window; using the cvQueryFrame function to obtain an image frame as the first image; and using the cvShowImage function to display the first image in the window.

[0007] As an optional implementation, calling OpenCV's preprocessing algorithm to preprocess the first image to obtain a second image, including: calling OpenCV's grayscale processing algorithm to perform grayscale processing on the first image; calling OpenCV's Gaussian filter to perform Gaussian blur processing on the first image after grayscale processing; calling OpenCV's image histogram equalization algorithm to perform image contrast equalization processing on the first image after Gaussian blur to obtain a second image.

[0008] As an optional implementation, calling the grayscale processing algorithm of OpenCV to perform grayscale processing on the first image includes: using the cvLoadImage function to load the first image and convert it into a grayscale image to obtain the first image after grayscale processing; using the cvNamedWindow function to create a grayscale image display window; using the cvShowImage function to display the first image after grayscale processing; and using the cvReleaseImage function to release the grayscale image resources.

[0009] As an optional implementation, the Gaussian filter is a cvSmooth function.

[0010] As an optional implementation, the method of calling the image histogram equalization algorithm of OpenCV to perform image contrast equalization processing on the first image after Gaussian blur to obtain the second image includes: calling the image histogram equalization algorithm of OpenCV to perform image contrast equalization processing on the first image after Gaussian blur; judging whether the image after equalization processing is equalized according to the image grayscale value; if so, determining the image after equalization processing as the second image; and the method also includes: if not, discarding the current image and capturing a new first image through the camera.

[0011] As an optional implementation, the Sobel operator includes a horizontal Sobel operator and a vertical Sobel operator; calling the Sobel operator of OpenCV to perform edge detection on the second image to obtain the position information of the digital area in the second image includes: multiplying the second image with the horizontal Sobel operator and the vertical Sobel operator respectively to obtain a horizontal edge grayscale detection value and a vertical edge detection value; determining the position information of the digital area in the second image according to the edge grayscale detection value and the vertical edge detection value.

[0012] The present application embodiment discloses a digital image detection method and device based on OpenCV, including:

[0013] An acquisition unit, configured to acquire a first image through a camera;

[0014] A preprocessing unit, used to call an OpenCV preprocessing algorithm to preprocess the first image to obtain a second image; the preprocessing algorithm includes a combination of one or more of the following algorithms: grayscale processing, Gaussian blur processing, and image histogram equalization processing;

[0015] An edge detection unit, used for calling the Sobel operator of OpenCV to process the second image, and obtaining position information of the digital area in the second image;

[0016] A marking unit is used to mark the digital area in the first image according to the position information.

[0017] An embodiment of the present application discloses an electronic device, which includes a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor implements any one of the digital image detection methods based on OpenCV disclosed in the embodiments of the present application.

[0018] An embodiment of the present application discloses a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, any one of the digital image detection methods based on OpenCV disclosed in the embodiment of the present application is implemented.

[0019] Compared with the related art, the embodiments of the present application have the following beneficial effects:

[0020] The computer captures a first image through a camera, and calls an OpenCV preprocessing algorithm to preprocess the first image to obtain a second image; the preprocessing algorithm includes a combination of one or more of the following algorithms: grayscale processing, Gaussian blur processing, and image histogram equalization processing; the computer calls the Sobel operator of OpenCV to perform edge detection on the second image to obtain position information of a digital area in the second image; then, the digital area is calibrated in the first image according to the position information, so that numbers can be accurately and efficiently recognized from the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 This is a system architecture diagram of a digital image detection method based on OpenCV disclosed in an embodiment of the present application;

[0023] Figure 2 It is a structural schematic diagram of a transmission line freezing disaster detection device disclosed in an embodiment of the present application;

[0024] Figure 3 is an example diagram of a digital image to be identified disclosed in an embodiment of the present application;

[0025] Figure 4 yes Figure 3 The image shown is an example of the output after calibration.

[0026] Figure 5 The embodiment of the present application discloses a digital image detection method and device based on OpenCV;

[0027] Figure 6 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0029] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.

[0030] The embodiments of the present application disclose a digital image detection method, device, electronic device and storage medium based on OpenCV, which can efficiently and accurately recognize numbers from images. Detailed descriptions are given below.

[0031] OpenCV is a feature-rich open source computer vision library that provides a range of tools for image processing and analysis. This library mainly consists of C language functions and some C++ classes, which can efficiently process image and video data. OpenCV has more than 250 optimized algorithms that are suitable for real-time image processing tasks such as face detection, object recognition, and motion analysis. In addition, OpenCV also provides a variety of image processing tools and functions, such as filters, edge detection, and morphological operations, which can be used in multiple stages such as image preprocessing, feature extraction, and classifier design.

[0032] Based on OpenCV, various image analysis tasks can be efficiently processed.

[0033] See also Figure 1 , Figure 1 1 is a system architecture diagram of a digital image detection method based on OpenCV disclosed in an embodiment of the present application. Figure 1 As shown, the computer 10 can be connected to the camera 20 for communication and acquire images captured by the camera 20 .

[0034] In the embodiment of the present application, the computer 10 can call the cvCreateCameraCapture function in the OpenCV library to open the camera; and use the cvNamedWindow function to create a display window; then use the cvQueryFrame function to obtain the image frame, and use the cvShowImage function to display the captured image frame in the window; wherein the image frame obtained by the cvQueryFrame function is captured by the camera 20. The image frame captured by the camera 20 can first be transmitted to the computer 10 based on the communication connection with the computer 10, and stored in the storage hardware of the computer 10. The cvQueryFrame function can call the image in the storage hardware.

[0035] See also Figure 2 , Figure 2 It is a method flow chart of a digital image detection method based on OpenCV disclosed in an embodiment of the present application. Figure 2 The method shown can be executed by a computer with computing power, such as a personal computer, an industrial computer, etc. Figure 2 As shown, the method may include the following steps:

[0036] 210. Capture a first image through a camera.

[0037] In the embodiment of the present application, the first image may be any one of the image frames obtained through the cvQueryFrame function mentioned above, and the manner in which the computer obtains the first image will not be described in detail.

[0038] 220. Call the OpenCV preprocessing algorithm to preprocess the first image to obtain a second image.

[0039] In an embodiment of the present application, the above-mentioned preprocessing algorithm includes a combination of one or more of the following algorithms: grayscale processing, Gaussian blur processing and image histogram equalization processing.

[0040] An image in which the pixel values ​​in the image are sampled in only one color is called a grayscale image. A grayscale image is also called a black and white image. Because of the strong information transmission of grayscale images, they are often used in image processing algorithms. Optionally, in an embodiment of the present application, the implementation method of calling OpenCV's grayscale processing algorithm to process the image may include: using the cvLoadImage function to load the image to be processed and convert it into a grayscale image; using the cvNamedWindow function to create a grayscale image display window; using the cvShowImage function to display the grayscale processed image; using the cvReleaseImage function to release the grayscale image resources.

[0041] Blurring is a process of reducing noise. Since Gaussian Fourier transform is an alternative transform, applying Gaussian blur will reduce the high-frequency components of the image, so Gaussian blur filtering can be designed as a low-pass filter. When applying a low-pass filter, its mask weights adjacent values ​​in the image, thereby reducing the difference between these values. And, Gaussian blur can be achieved by convolving the image with a low-channel filter. For the above reasons, the present application uses a low-channel filter to blur the image. The optional OpenCV library contains a low-channel Gaussian filter, namely the cvSmooth function. Gaussian blur processing will smooth the sharp edges of objects and produce a blur effect. Optionally, in an embodiment of the present application, the implementation method of calling OpenCV's Gaussian blur processing to process the image may include: creating a new image for storing the image smoothed after Gaussian blur processing; using the cvSmooth function to perform Gaussian filtering on the image to be processed; using the cvNamedWindow function to create a smoothed image display window; using the cvShowImage function to display the smoothed image; using the cvReleaseImage function to release the smoothed image resource.

[0042] Image histogram equalization is an image enhancement technique that enhances the contrast of an image by changing the grayscale of each pixel in the image. In addition, an image histogram can display the number of pixels of each hue. Therefore, this application uses the image histogram equalization algorithm of OpenCV to perform contrast equalization on the image.

[0043] In the embodiment of the present application, one or more combinations of grayscale processing, Gaussian blur processing, and image histogram equalization processing may be selected to process the first image according to the characteristics of the first image collected in step 210.

[0044] In order to achieve a better preprocessing effect, reduce the noise of the first image, and increase the accuracy of subsequent edge detection, as an optional implementation, step 220 may include:

[0045] 2210. Calling the grayscale processing algorithm of OpenCV to perform grayscale processing on the first image;

[0046] 2220. Call the Gaussian filter of OpenCV to perform Gaussian blur processing on the first image after grayscale processing;

[0047] 2230. Call the image histogram equalization algorithm of OpenCV to perform image contrast equalization processing on the first image after Gaussian blur to obtain a second image.

[0048] That is to say, the three preprocessing operations mentioned above can be performed on the first image in the manner of first grayscale processing, then Gaussian blur processing, and finally image histogram equalization processing, so as to achieve a better noise reduction effect, enhance the contrast of the first image, make the edge of the digital area more prominent, and help improve the accuracy of edge detection.

[0049] As an optional implementation, the aforementioned step 2230 may also include the following steps: calling the image histogram equalization algorithm of OpenCV to perform image contrast equalization processing on the first image after Gaussian blur; judging whether the image after equalization processing is equalized according to the image grayscale value; if the image has been equalized, determining the image after equalization processing as the second image.

[0050] Optionally, if the computer determines that the image is still not equalized after being processed by the histogram equalization algorithm, the current image is discarded and a new first image is captured by the camera.

[0051] 230. Call the Sobel operator of OpenCV to perform edge detection on the second image to obtain position information of the digital area in the second image.

[0052] Edge detection is an important step in image processing. Edge maps play an important role in applications such as image classification, image registration, feature extraction, and pattern recognition. An edge detector can be defined as a mathematical operator that responds to spatial variations and discontinuities in the grayscale of pixels in an image. Edge detection can be performed using methods such as Canny edge detection, Sobel operator, or Prewitt operator.

[0053] The embodiment of the present application uses the Sobel operator to perform edge detection on the image. The Sobel operator combines Gaussian smoothing and differential derivation and increases the edge weight value of the image to make the image edge sharpening process more obvious, showing better performance in the digital recognition scenario.

[0054] The algorithm formula of the Sobel operator is as follows:

[0055]

[0056] Wherein, Lx and Ly represent the horizontal Sobel operator and the vertical Sobel operator respectively.

[0057] In the embodiment of the present application, the Sobel operator of OpenCV is called to perform edge detection on the second image to obtain the position information of the digital area in the second image, including:

[0058] The horizontal Sobel operator and the vertical Sobel operator are respectively multiplied with the second image to obtain a horizontal edge grayscale detection value and a vertical edge detection value; and the position information of the digital area in the second image is determined according to the edge grayscale detection value and the vertical edge detection value.

[0059] Exemplarily, if the image is represented by I, then the horizontal edge grayscale detection value Ix and the vertical edge grayscale detection value Iy are as follows:

[0060]

[0061] In the embodiment of the present application, when the values ​​of Ix (the gradient of the image in the x direction) and Iy (the gradient of the image in the y direction) are within a certain range, it can be considered that the edge of the Arabic numeral is detected. This range usually depends on the specific content of the image and the parameter setting of the edge detection algorithm. In general, when the sum of the absolute values ​​of Ix and Iy (or some combination) exceeds a certain threshold, it can be considered that the edge is detected. The threshold can be set based on experience and is not specifically limited.

[0062] When the edge of the digital area is detected according to the values ​​of Ix and Iy, the position information of the digital area in the second image can be determined. The position information may include a set of areas consisting of digital edges; or, the boundary value of the digital area in the second image, such as the minimum row and minimum column of the digital area, can be obtained according to the digital edge.

[0063] 240. Mark a digital area in the first image according to the position information.

[0064] In an embodiment of the present application, the calibration size of the digital area, such as the size of the calibration box, can be preset. Exemplarily, the size of the calibration area in the command window is represented by height, width and depth, which can be 60:80:210. It should be noted that for a two-dimensional image, depth refers to the depth of a certain feature dimension or color channel, not the physical depth.

[0065] In addition, since the difference between the first image and the second image is the difference between the images before and after denoising, the image position of the digital area in the first image and the second image has not changed. Therefore, the position information of the digital area in the second image after denoising can be directly used to calibrate the first image before denoising.

[0066] As an optional implementation, step 240 may include the following steps:

[0067] 2410. Set the size of the calibration area, and determine the calibration area by defining the minimum column min_col, the minimum row min_row, the maximum column max_col and the maximum row max_row; wherein the minimum column min_col and the minimum row min_row are determined from step 230.

[0068] 2420, perform calibration, use cvSetImageCap function to calibrate the original image original_image, and the calibration area is determined by the parameters defined in step 2410;

[0069] 2430. Create a calibrated image and create a new image cap according to the size, depth and number of channels of the original image through the cvCreateImage function;

[0070] 2440. Copy the image, use the cvCascade function to copy the original image original_image to the newly created image caped;

[0071] 2450. Reset image calibration. Use cvResetImageCap function to reset the calibration state of the original image.

[0072] 2460. Display the calibrated image. Display the calibrated image caped in the window through cvNamedWindow and cvShowImage functions;

[0073] 2470. Wait for user input. Use cvWaitKey function to wait for user key operation.

[0074] 2480. Release image resources. Use the cvReleaseImage function to release the resources occupied by the calibrated image cap.

[0075] For example, see Figure 3 and Figure 4 . Figure 3 is an example of a digital image to be identified disclosed in the embodiment of the present application. Figure 3 The digital image shown can be read as a first image, and the computer executes the aforementioned steps 220 to 240 to output the image as shown in FIG. Figure 4 The first image after calibration is shown in FIG. Figure 4 As shown, the calibration frame can accurately frame the digital area in the digital image. Moreover, when the digital image includes multiple numbers, the multiple digital areas can also be accurately calibrated.

[0076] It can be seen that by implementing the embodiments of the present application, numbers can be efficiently and accurately recognized from images. Furthermore, the image to be recognized can be de-noised by operating one or more of the above preprocessing algorithms, thereby further improving the accuracy of number recognition.

[0077] See also Figure 5 , Figure 5 The present application embodiment discloses a digital image detection device based on OpenCV. The device can be applied to any computer as described above. Figure 5 As shown, the device comprises:

[0078] An acquisition unit 510 is configured to acquire a first image through a camera;

[0079] The preprocessing unit 520 is used to call the preprocessing algorithm of OpenCV to preprocess the first image to obtain the second image; the preprocessing algorithm includes one or more combinations of the following algorithms: grayscale processing, Gaussian blur processing and image histogram equalization processing;

[0080] The edge detection unit 530 is used to call the Sobel operator of OpenCV to process the second image to obtain the position information of the digital area in the second image;

[0081] The calibration unit 540 is used to calibrate the digital area in the first image according to the position information.

[0082] As an optional implementation, the acquisition unit 510 is further used to open the camera using the cvCreateCameraCapture function in the OpenCV library; and, is further used to create a display window using the cvNamedWindow function; and, is further used to obtain an image frame as a first image using the cvQueryFrame function; and, is further used to display the first image in the window using the cvShowImage function.

[0083] As an optional implementation, the preprocessing unit 520 is further used to call the grayscale processing algorithm of OpenCV to perform grayscale processing on the first image; and, to call the Gaussian filter of OpenCV to perform Gaussian blur processing on the first image after grayscale processing; and, to call the image histogram equalization algorithm of OpenCV to perform image contrast equalization processing on the first image after Gaussian blur to obtain a second image. Optionally, the Gaussian filter is a cvSmooth function.

[0084] As an optional implementation, the preprocessing unit 520 is further used to load the first image using the cvLoadImage function and convert it into a grayscale image to obtain the first image after grayscale processing; and is also used to create a grayscale image display window using the cvNamedWindow function; and is also used to display the first image after grayscale processing using the cvShowImage function; and is also used to release the grayscale image resources using the cvReleaseImage function.

[0085] As an optional implementation, the preprocessing unit 520 is further used to, after calling the OpenCV image histogram equalization algorithm to perform image contrast equalization on the first image after Gaussian blur, determine whether the image after equalization is equalized according to the image grayscale value; and, after determining that the image has been equalized, determine the image after equalization as the second image. Correspondingly, the acquisition unit 510 is also used to discard the current image and capture a new first image through the camera after the preprocessing unit 520 determines that the image is still not equalized after being processed by the histogram equalization algorithm.

[0086] As an optional implementation, the aforementioned Sobel operator includes a horizontal Sobel operator and a vertical Sobel operator; the edge detection unit 530 is also used to respectively multiply the horizontal Sobel operator and the vertical Sobel operator with the second image to obtain a horizontal edge grayscale detection value and a vertical edge detection value; and, is also used to determine the position information of the digital area in the second image based on the edge grayscale detection value and the vertical edge detection value.

[0087] By implementing the OpenCV-based digital image detection method and device disclosed in the embodiment of the present application, numbers can be recognized from images efficiently and accurately.

[0088] See also Figure 6 , Figure 6 Schematic diagram of the structure of an electronic device disclosed in the embodiment of the present application. Figure 6 As shown, the test equipment may include:

[0089] A memory 610 storing a computer program;

[0090] a processor 620 coupled to the memory 610;

[0091] When the computer program stored in the memory 610 is executed by the processor 620, the processor 620 implements any one of the methods for detecting freezing of power transmission lines disclosed in the embodiments of the present application.

[0092] It should be noted that Figure 6The electronic device shown may also include components not shown, such as a power supply, input buttons, a screen, an RF circuit, a Wi-Fi module, a Bluetooth module, etc., which are not described in detail in this embodiment.

[0093] The embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements any one of the digital image detection methods based on OpenCV disclosed in the embodiment of the present application.

[0094] The embodiment of the present application discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable a computer to execute any one of the OpenCV-based digital image detection methods disclosed in the embodiment of the present application.

[0095] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required for the present application.

[0096] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0097] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0098] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0099] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several requests for a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to perform some or all of the steps of the above-mentioned methods of various embodiments of the present application.

[0100] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0101] The test method, test equipment, test system and storage medium of the telemetry equipment disclosed in the embodiments of the present application are introduced in detail above. The principles and implementation methods of the present application are explained in detail using specific examples herein. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present application.

Claims

1. A digital image detection method based on OpenCV, characterized in that: The method is applied to a computer and comprises: Acquire a first image by a camera; Calling OpenCV's preprocessing algorithm to preprocess the first image to obtain a second image; the preprocessing algorithm includes one or more combinations of the following algorithms: grayscale processing, Gaussian blur processing, and image histogram equalization processing; Calling the Sobel operator of OpenCV to perform edge detection on the second image to obtain position information of the digital area in the second image; The digital area is marked in the first image according to the position information.

2. The method according to claim 1, characterized in that The step of collecting the first image by using a camera includes: Use the cvCreateCameraCapture function in the OpenCV library to open the camera; Use cvNamedWindow function to create a display window; Use cvQueryFrame function to get the image frame as the first image; Use cvShowImage function to display the first image in the window.

3. The method according to claim 1, characterized in that Calling the OpenCV preprocessing algorithm to preprocess the first image to obtain a second image, including: Calling the grayscale processing algorithm of OpenCV to perform grayscale processing on the first image; Call the Gaussian filter of OpenCV to perform Gaussian blur processing on the first image after grayscale processing; The image histogram equalization algorithm of OpenCV is used to perform image contrast equalization processing on the first image after Gaussian blur to obtain a second image.

4. The method according to claim 3, characterized in that The calling of the grayscale processing algorithm of OpenCV to perform grayscale processing on the first image includes: Use cvLoadImage function to load the first image and convert it into a grayscale image to obtain a grayscale processed first image; Use cvNamedWindow function to create a grayscale image display window; Use cvShowImage function to display the first image after grayscale processing; Use cvReleaseImage function to release the grayscale image resources.

5. The method according to claim 3, characterized in that: The Gaussian filter is the cvSmooth function.

6. The method according to claim 3, characterized in that The method of calling the image histogram equalization algorithm of OpenCV to perform image contrast equalization processing on the first image after Gaussian blur to obtain the second image includes: Call the image histogram equalization algorithm of OpenCV to perform image contrast equalization processing on the first image after Gaussian blur; Judging whether the image after equalization processing is equalized according to the gray value of the image; If yes, the image after equalization processing is determined as the second image; and the method further includes: If not, the current image is discarded and a new first image is acquired by the camera.

7. The method according to claim 1, characterized in that The Sobel operator includes a horizontal Sobel operator and a vertical Sobel operator; calling the Sobel operator of OpenCV to perform edge detection on the second image to obtain position information of the digital area in the second image includes: Multiplying the second image by the horizontal Sobel operator and the vertical Sobel operator respectively to obtain a horizontal edge grayscale detection value and a vertical edge detection value; The position information of the digital area in the second image is determined according to the edge grayscale detection value and the longitudinal edge detection value.

8. A digital image detection method and device based on OpenCV, characterized in that: include: An acquisition unit, configured to acquire a first image through a camera; A preprocessing unit, used to call an OpenCV preprocessing algorithm to preprocess the first image to obtain a second image; the preprocessing algorithm includes a combination of one or more of the following algorithms: grayscale processing, Gaussian blur processing, and image histogram equalization processing; An edge detection unit, used for calling the Sobel operator of OpenCV to process the second image, and obtaining position information of the digital area in the second image; A marking unit is used to mark the digital area in the first image according to the position information.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor implements the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.