An Adaptive Display Mode Switching Method Based on Continuous Frame OCR Analysis
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2026-08-14
AI Technical Summary
传统的内容识别方法多采用边缘检测、阈值分割等图像处理手段,鲁棒性有限;而现有的基于OCR的文本识别方法普遍面临动态画面下检测不稳定、易受滑动伪影影响、文本区域分割精度不足等问题,难以满足日益多元化的智能护眼需求
实现了显示模式的自适应切换,提升系统能效:本发明通过合理控制连续帧捕获的频率,充分覆盖单位时间内的画面动态变化,既保证了切换的实时性,又有效避免了过高采样频率带来的计算资源浪费。通过对连续帧的智能分析,有效减少了无效的显示模式切换次数,显著降低了因频繁切换模式带来的额外能耗,实现了视觉舒适性与系统能效的最优平衡,延长了移动设备的续航时间,提升了整体性能。
Smart Images

Figure CN121092259B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent display control technology, and more specifically to a display mode adaptive switching method based on continuous frame OCR analysis. Background Technology
[0002] With the diversification of e-reading and information access scenarios, mobile devices are increasingly demanding higher levels of visual comfort. Users have higher adaptive needs for screen display modes such as blue light filtering, color temperature adjustment, and e-ink screen simulation in different environments. Existing mobile terminals generally have built-in display strategies such as eye protection mode and night mode, aiming to reduce the impact of blue light on eyesight. However, these display modes are mostly triggered based on parameters such as timing, light sensing, and geographical location information, lacking intelligent perception of the actual content on the interface, and unable to make optimal visual strategy adjustments based on the specific content the user is reading. This traditional mechanism, which is mainly based on global environmental perception, is prone to frequent false triggering of eye protection mode in text-intensive interfaces, causing a fragmented visual experience and additional energy consumption.
[0003] Currently, content-aware automatic eye protection mode switching solutions mostly rely on basic image processing methods, such as edge detection and global / local thresholding. These methods have some text detection capabilities in simple backgrounds or high-contrast scenes, but they have significant limitations in practical applications: on the one hand, the difficulty of accurately detecting text areas increases significantly in complex backgrounds, low-contrast interfaces, or interfaces with mixed text and images; on the other hand, traditional methods often make decisions based on single-frame images, lacking robustness to dynamic screen changes, making it difficult to cope with screen disturbances in scenarios such as webpage scrolling and e-book page turning, and easily triggering display mode switching due to transient artifacts.
[0004] With the development of deep learning technology, text detection methods based on OCR (Optical Character Recognition) engines have been widely used. OCR systems, such as Tesseract, have significantly improved the accuracy of text recognition in static images through large-scale language data training. However, existing OCR technologies still face significant challenges in real-world dynamic display scenarios: First, single-frame detection is easily affected by motion blur and content jumps when the screen is scrolling, leading to unstable detection results and causing repeated switching of eye-protection modes, affecting visual continuity. Second, OCR's robustness to small font sizes, complex backgrounds, or special fonts remains limited, and the detection accuracy in mixed text and image areas is not high. Furthermore, existing methods lack effective mechanisms to distinguish between content scrolling and changes in the actual text area, making it difficult to achieve temporal continuity and stability in eye-protection mode switching.
[0005] Currently, research and product implementation of content-aware automatic eye protection modes mainly focus on application recognition, screen brightness and color temperature adjustment. Chinese invention patent CN113821274A discloses a method for enabling an eye protection mode. This method detects the target application type when switching applications and automatically determines whether to activate the eye protection mode based on the detection result of the screen display mode. While this approach can achieve automatic switching of the eye protection mode based on application type, improving the user experience, it lacks the ability to perceive changes in the actual interface content and struggles to handle diverse display needs within the same application.
[0006] Chinese invention patent CN109634680A discloses a method for controlling a terminal's eye protection mode. By monitoring the motion state of multiple displays and combining this motion state with the determination of when to switch to the eye protection mode, it achieves eye protection control based on hardware motion perception. While this technology simplifies the user's operation process, it fails to intelligently identify the content displayed on the terminal itself, leaving the possibility of accidental triggering.
[0007] Furthermore, Chinese invention patent CN113641416A discloses an eye-protection processing method in fingerprint recognition mode. When a terminal performs fingerprint recognition, the eye-protection parameters of the constituent window are adaptively adjusted to prevent the eye-protection mode from interfering with the fingerprint recognition function, thus ensuring functional compatibility. However, this technology primarily addresses the compatibility issue of the eye-protection mode under special operating modes and does not improve the intelligent switching of display modes in ordinary reading or content switching scenarios.
[0008] Regarding dynamic adjustment of display parameters, Chinese invention patent CN117198176A proposes a method for detecting and calibrating the color temperature of a monitor. This method dynamically adjusts the color temperature by detecting the deviation between the monitor's color temperature and standard data, combined with interface switching and user status, thereby improving visual comfort. While this technology emphasizes color management, its dynamic adjustment does not fully consider text areas and content attributes.
[0009] Therefore, while existing technologies have explored automatic triggering of eye protection modes and dynamic adjustment of display parameters to varying degrees, most rely on application scenarios, hardware status, or screen parameters as triggering criteria, lacking in-depth analysis of the actual content of the interface, especially the density and dynamic changes of text regions. Traditional content recognition methods often employ image processing techniques such as edge detection and threshold segmentation, which have limited robustness; while existing OCR-based text recognition methods generally face problems such as unstable detection under dynamic scenes, susceptibility to sliding artifacts, and insufficient text region segmentation accuracy, making it difficult to meet the increasingly diverse intelligent eye protection needs. Summary of the Invention
[0010] To address the aforementioned issues, this invention proposes an adaptive display mode switching method based on continuous frame OCR analysis. By performing multi-step preprocessing, text region detection and proportion calculation, color complexity evaluation, and continuous frame confirmation on continuously acquired multi-frame images, the accuracy and robustness of text detection can be effectively improved, significantly reducing the risk of false triggering caused by dynamic disturbances such as screen scrolling and content jumps. Furthermore, by introducing a feature pyramid network, multi-scale correction, and a dual-counter anti-slip interference mechanism, accurate recognition and intelligent switching of display modes in text-dense scenes are achieved, thereby optimizing the balance between visual comfort and system energy efficiency and meeting the personalized eye protection needs of mobile terminals in diverse reading scenarios. The adaptive display mode switching method based on continuous frame OCR analysis described in this invention includes the following steps: S1: Continuous frame capture, continuously acquiring multiple frames of images on the target interface at a preset sampling period; S2: Perform step-by-step preprocessing on each frame of the acquired image. The preprocessing includes the following steps: converting the color image to grayscale using a weighted average method; applying Gaussian filtering to the grayscale image; and applying Laplacian sharpening to the Gaussian-filtered image. S3: Text region detection and proportion calculation, including the following steps: S3-1: Perform Tesseract-based OCR text detection on each preprocessed frame; S3-2: Adaptive binarization of the frame image is performed using the Sauvola local thresholding method to obtain a binary image; S3-3: Apply the 8-neighborhood connectivity algorithm to the binary image obtained in step S3-2 to mark connected regions, and merge overlapping regions when the region intersection-union ratio (IoU) is ≥ 0.3; S3-4: Use the feature pyramid network to perform multi-scale correction on the OCR detection results and output the coordinates of the top left and bottom right corners of each text region; S3-5: Calculate the pixel area of each text region based on the output coordinates in step S3-4, and sum the areas of all text regions to obtain the total text area; S3-6: Calculate the text region percentage based on the total frame pixel area; S4: Color complexity evaluation. Calculate the color variance of the detected text region. When the variance is less than or equal to the second threshold, it is recorded as a low color complexity frame. S5: Continuous Frame Confirmation: Counts the color complexity evaluation of continuous output and outputs a continuous confirmation signal; S6: Display mode switching: Automatically switches the display mode based on continuous confirmation signals.
[0011] As a preferred embodiment of the present invention, the step-by-step preprocessing in step S2 specifically includes the following steps: The weighted average method is adopted, and the ITU-R BT.601 standard is selected. The weighted calculation formula is as follows: ,in, To output the grayscale value of each pixel after calculation, , , These represent the values of the input pixel in the red, green, and blue components, respectively. Gaussian filtering uses a convolution kernel defined by a two-dimensional Gaussian function, and the filtering calculation formula is as follows: ,in, The coordinates of the convolution kernel are the kernel coordinates. The standard deviation is used to control the smoothing intensity. This convolution kernel has two characteristics: distance-weighted decay, where the center pixel has the highest weight, and the weight gradually decreases as the spatial distance increases. The formula for calculating the convolution operation between this kernel and the grayscale image is as follows: ,in, The coordinates within the Gaussian kernel are... The pixel values of the grayscale images covered by the kernel. The image is after Gaussian filtering; Laplacian sharpening uses the Laplacian operator, and the operator calculation formula is as follows: ,in, It is a second-order differential operator, defined as the divergence of the gradient. The sharpening process also uses the four-neighbor kernel formula for calculation, and the specific calculation formula is as follows: ,in, These are the original image pixel values. The result of the Laplacian operator calculation is ANDed with the original image to enhance the contrast of the edge regions. The contrast calculation formula is as follows: ,in, This is the sharpening intensity factor, specifically set to 0.8.
[0012] As a preferred embodiment of the present invention, the calculation formula for the Sauvola local threshold method in step S3-2 is as follows: ,in, , Therefore Centered The mean and standard deviation of pixel values at each point in the image within the window; , , Compare the pixel value with the calculated value; if... If the pixel value at that point in the image is set to 1, then the pixel value is set to 0.
[0013] As a preferred embodiment of the present invention, step S3-3 uses the 8-neighborhood connectivity algorithm to mark all connected regions and calculates the overlap between regions. The specific calculation formula is as follows: Where IoU is the overlap, and AB are the two spaces for overlap determination. When merging regions.
[0014] As a preferred embodiment of the present invention, steps S3-4 employ a feature pyramid network, which, from bottom to top, includes the following steps: an input image of size 224×224; a first convolutional block with a kernel size of 2×2 and a stride of 2, outputting a feature map of size 112×112; a second convolutional block with a kernel size of 2×2 and a stride of 2, outputting a feature map of size 56×56; a third convolutional block with a kernel size of 2×2 and a stride of 2, outputting a feature map of size 28×28; and a fourth convolutional layer with a kernel size of 2×2 and a stride of 2, outputting a feature map of size 14×14.
[0015] In the feature pyramid network, the 14×14 feature map is denoted as feature 1, the 28×28 feature map is denoted as feature 2, and the 56×56 feature map is denoted as feature 3. After feature 1 to feature 3 are fused at multiple scales through the feature fusion module, the text candidate box position information is output.
[0016] As a preferred embodiment of the present invention, the formula for calculating the proportion of the text region in steps S3-6 is as follows: ,in Let i be the area of the i-th text region. The total area of the screen. This represents the percentage of effective text.
[0017] As a preferred embodiment of the present invention, in step S4, the color complexity evaluation measures the complexity by using image variance, and the formula for calculating the variance is: in, Image dimensions The variance value is a grayscale value. The lower the variance value, the more concentrated the color distribution and the lower the complexity. When the variance value is greater than or equal to 500, it is judged as a text pattern.
[0018] As a preferred embodiment of the present invention, the continuous confirmation signal in step S5 further includes a continuous judgment and anti-slip interference mechanism for sliding operation interference, the mechanism including: Continuous judgment threshold setting: The preset number of continuous judgment frames K=3 is used to verify the continuity of timing; Initialize the first counter C: Set the first counter C=0; Forward counting: For each frame of image, if both conditions are met simultaneously, such as text region ≥ 55% and color complexity ≤ the second threshold, then C+1 is set; if either condition is not met, then C is reset to 0; when C ≥ K, a text scene confirmation signal is generated, and C is forcibly cleared to zero and reverse counting is started. Second counter C initialization: Set the second counter C=0 after the display mode is switched; Reverse counting: In eye protection mode, for each frame of image, if either the text area ratio or color complexity condition is not met, then C+1 is set; if both conditions are met, then C is reset to 0; when C≥K, a non-text scene confirmation signal is generated, and C is forcibly cleared to zero and re-entering the forward counting. By using the alternating operation of the first and second counters and the same continuous judgment threshold K, false triggers caused by dynamic blurring or content jumps in single-frame judgment due to sliding operations can be effectively filtered out.
[0019] As a preferred embodiment of the present invention, the rule for switching display modes is as follows: When the processor receives a text-based scene confirmation signal, it switches the display to eye protection mode. If the candidate text frame conditions are not met for N consecutive frames, the display will be switched back to normal display mode.
[0020] Compared with the relevant prior art, the beneficial effects of the present invention are: This invention achieves adaptive switching of display modes, improving system energy efficiency: By rationally controlling the frequency of continuous frame capture, it fully covers the dynamic changes of the screen within a unit of time, ensuring real-time switching while effectively avoiding the waste of computing resources caused by excessively high sampling frequencies. Through intelligent analysis of continuous frames, it effectively reduces the number of invalid display mode switches, significantly reducing the additional energy consumption caused by frequent mode switching. This achieves an optimal balance between visual comfort and system energy efficiency, extending the battery life of mobile devices and improving overall performance.
[0021] Significantly improved switching accuracy and effective prevention of false triggers: This invention combines the Tesseract algorithm with multi-dimensional judgment methods such as text region proportion, color complexity, and continuous confirmation, overcoming the limitations of traditional single-frame detection schemes that are prone to false judgments in dynamic scenes such as sliding artifacts. The state is only confirmed when the switching conditions are met in multiple consecutive frames, greatly improving the accuracy of text scene judgment and making display mode switching more precise, effectively adapting to the visual comfort needs of different reading environments.
[0022] The text detection exhibits strong robustness and adaptability to complex scenarios: Weighted averaging for grayscale conversion, Gaussian filtering for noise reduction, and Laplacian sharpening for edge enhancement effectively improve the OCR algorithm's foundation for text detection. Combining a Feature Pyramid Network (FPN) for multi-scale feature fusion significantly enhances the accuracy and robustness of text detection in complex backgrounds and low-contrast scenes, ensuring the system's good adaptability to various real-world reading scenarios.
[0023] With wide application scenarios and excellent scalability and compatibility, this invention can intelligently switch between different display modes based on real-time detection results, such as blue light filtering and e-ink screen simulation, adapting to diverse reading scenarios and user needs. The system structure is modular, and parameters can be flexibly adjusted, allowing for expansion and adaptation to different devices and application environments. It is easy to integrate into existing mobile terminals or display control systems without large-scale system modifications, demonstrating good compatibility and promising prospects for widespread adoption. Attached Figure Description
[0024] Figure 1 A flowchart of the display mode adaptive switching method based on continuous frame OCR analysis provided by the present invention; Figure 2 The overall structure diagram of the display mode adaptive switching method based on continuous frame OCR analysis provided by the present invention; Figure 3 The Tesseract text recognition effect diagram is provided as an embodiment of the present invention; Figure 4 The Feature Pyramid Network (FPN) structure diagram is provided for an embodiment of the present invention. Detailed Implementation
[0025] The present invention will be further described below with reference to the accompanying drawings. However, the present invention can be implemented in many different ways and should not be construed as limited to the embodiments shown; rather, these embodiments provide those skilled in the art with implementation methods that meet applicable legal requirements.
[0026] Example 1: As Figure 1 As shown, this invention proposes a display mode adaptive switching method based on continuous frame OCR analysis, such as... Figure 2 As shown, its overall structure includes: a continuous frame capture module, an image preprocessing module, a text region detection and proportion calculation module, a color complexity evaluation module, a continuous frame confirmation module, and a display mode switching module. The method steps are as follows: Step S1: Continuous frame capture. Multiple screen images are continuously captured at a preset sampling period on the target interface (such as an e-book reader, web browser, etc.). The sampling period can be flexibly adjusted according to the specific application scenario, ensuring timely response to dynamic changes while avoiding waste of system resources. For example, a frame sampling interval of 100~200ms can be set to cover content changes during normal user scrolling or page jumps.
[0027] Step S2: Stepwise image preprocessing, performing the following processing on each frame of the acquired image in sequence: Weighted average grayscale conversion: The RGB color image is converted to grayscale using the ITU-R BT.601 standard to improve the quality of the base image for subsequent text detection.
[0028] Gaussian filtering noise reduction: A two-dimensional Gaussian convolution kernel is used to smooth the grayscale image, suppress the interference of light and shadow fluctuations on the text edges, and improve the accuracy of subsequent edge detection and text segmentation.
[0029] Laplacian sharpening: Applying Laplacian sharpening to the Gaussian-filtered image enhances edge and high-frequency details, providing a clear image foundation for accurate text region recognition.
[0030] Step S3: Text region detection and proportion calculation: like Figure 3 As shown, the Tesseract OCR algorithm is used to perform text detection on each frame of the image to obtain candidate boxes for each text region.
[0031] Adaptive binarization of frame images is performed based on the Sauvola local thresholding method to improve the robustness of text segmentation in complex backgrounds.
[0032] The 8-neighborhood connectivity algorithm is applied to binary images to mark and merge overlapping connected regions with IoU ≥ 0.3, ensuring that the same text block is not counted repeatedly.
[0033] Employing Feature Pyramid Network (FPN), such as Figure 4 As shown, text features are extracted and fused from the multi-scale feature layer, and the OCR detection results are corrected at multiple scales to output the boundary coordinates of each text region.
[0034] Based on the detected text region coordinates, calculate the pixel area of each text block, and sum the areas of all text regions to obtain the total text area.
[0035] Based on the total pixel area of the frame, calculate the proportion of the text region in the entire frame and compare it with a preset threshold.
[0036] Step S4: Color Complexity Assessment: Extract pixel colors from the detected text region, calculate the color variance, and determine the region's color complexity. If the variance value is less than or equal to the second threshold, the frame is recorded as a low color complexity frame, suitable for switching to low-stimulation modes such as eye protection or e-ink screen.
[0037] Step S5: Continuous Frame Confirmation and Anti-Slide Interference Mechanism: A dual-counter continuous judgment mechanism is adopted to prevent false triggering caused by screen sliding or content jumps. Forward counter C: If the text area ratio and color complexity conditions are met for K consecutive frames, C is incremented; if any frame does not meet the conditions, C is reset to 0. When C≥K, a text scene confirmation signal is output, triggering the eye protection mode switch and switching to reverse counting.
[0038] Inverse counter C: In eye protection mode, if the condition of K consecutive frames is not met, C is incremented. When C≥K, a non-text scene confirmation signal is generated, and the mode is switched back to normal mode.
[0039] By using alternating dual counting, the impact of sliding artifacts and dynamic content switching on single-frame judgment is effectively filtered out, improving the accuracy and stability of switching.
[0040] Step S6: Adaptive Display Mode Switching: When a text scene confirmation signal is detected, the display screen is automatically switched to eye protection, blue light filter, or e-ink screen modes. If no text area is detected that meets the conditions for N consecutive frames, the display automatically reverts to normal display mode.
[0041] Among them, parameters such as sampling period, continuous frame judgment threshold K, and color variance threshold can be flexibly configured according to specific device and application requirements.
[0042] Through the above specific implementation methods, the present invention can achieve adaptive switching of display modes for different reading and operation scenarios, improve visual comfort while optimizing system energy efficiency, effectively extend the battery life of mobile devices, and has good adaptability and compatibility.
[0043] Example 2: This example demonstrates a deployment experiment in a real-world scenario. It was conducted on a mobile terminal equipped with a 6.7-inch AMOLED display (2400×1080 resolution), a Qualcomm Snapdragon 8 Gen 2 SoC platform, and running Android 15. The terminal has 8 GB of LPDDR5X RAM, UFS 4.0 flash storage, and an Adreno 740 GPU, enabling smooth local operation of the Tesseract 5.3.0 OCR engine and lightweight FPN detection network. The test environment was 25℃, with an ambient illuminance of 450 lx, and the initial screen brightness was set to 80 cd / m². 2Color temperature 6500K.
[0044] The adaptive display mode switching program of this invention is burned to the eMMC system partition of the terminal via the ADB interface and registered as a system-level service under / vendor / display-services. The core parameters are written to config.xml as follows: frame capture rate: 5 fps (sampling interval 200 ms); continuous judgment threshold K: 3; text proportion threshold: 55%; color variance threshold: 500; target color temperature for eye protection mode: 4200K; blue light suppression coefficient: 0.28.
[0045] 1.5 seconds after system startup, the frame capture module calls the SurfaceFlinger API to capture screen content in RGBA_8888 format. The first simulation scenario is static e-book reading: the user opens a long novel with black background and white text, and the page remains still for 12 seconds. The first captured frame is assigned the number F1. The average pixel brightness after grayscale conversion is 42.7; after Gaussian filtering, the mean square energy is reduced by 18%, and the peak signal-to-noise ratio is improved by 4.2dB after Laplacian sharpening. Each frame takes 17ms to process, with CPU usage at 18%. The GPU asynchronously executes FPN inference, with a single frame inference time of 11ms and no inter-frame blocking.
[0046] Text detection—Simulation results: Tesseract was used frame by frame for F1~F6 text detection, with an average of 24 text blocks detected and a total joint area of 1344960px. 2 The total area of the entire frame is 2592000 pixels. 2 Text accounts for 51.9%.
[0047] Because this chapter contains a few illustrations, the area of the non-text connected region after Sauvola binarization is 242000px. 2 It is excluded by the IoU merging rule.
[0048] The color variance was calculated to obtain σ. 2 =438. Less than the threshold of 500, so it is judged as low color complexity.
[0049] After FPN multi-scale correction, the false merging rate decreased to 3.1%, and the text miss rate was 2.8%.
[0050] Continuous frame detection and mode switching: The positive counter C increments from F1, reaching K=3 at F3, at which point the system generates a text scene confirmation signal. Starting at 14:32:07.600 Beijing time, the display engine smoothly lowers the color temperature curve to 4200K (transition time 180ms), while simultaneously activating the hardware-level blue-filter register, suppressing blue light peak by 28%. After the eye protection mode enters stable output, the system power consumption curve decreases by 260mW, and the screen drive current decreases by 6.4%.
[0051] Dynamic monitoring and adaptive adjustment—scene switching simulation: Scenario 1: Fast scrolling of webpage (23s): The user switches to the news webpage and scrolls down quickly.
[0052] Continuous frames F 120 ~F 126 Ghosting and misaligned text appear: the average text percentage in a single frame is 48%, with F being the most common issue. 121 The percentage dropped to 27% due to motion blur.
[0053] The positive counter is invalid in eye protection mode; the negative counter C′ detects F. 121 If both conditions are not met, reset the count to zero and start counting again. Continue until F. 124 Since the text and low variance conditions are met again, C′ does not reach K, and mode rollback is not triggered.
[0054] No mode switching was accidentally triggered during the entire scrolling process. The average CPU load was 32%, with a peak load of 42%.
[0055] Scene 2: High-definition video scene (48s): The user switched to 4K HDR video playback. (Continuous F) 240 ~F 246 In the text, the proportion dropped to 1.6%; the color variance fluctuated between 1200 and 2800.
[0056] After the inverting counter C′ accumulates to 3, a non-textual acknowledgment signal is generated at 14:32:56.340.
[0057] The display system transitions to normal mode via inverse interpolation in 180ms, disabling the blue light filter. Power consumption increases by 255mW, but the HDR drive current requirements are met as normal.
[0058] Scene 3: Dim Environment E-book Scene (75s): The system detects the e-book reader. Continuous frame text ratio ≥ 62%, color variance ≤ 392, global brightness automatically adjusted to 50 cd / m². 2 .
[0059] In this embodiment, the K-frame determination is satisfied again, and the eye protection mode is switched back in just 600ms.
[0060] During the entire 90-second simulation, the system captured 450 frames, with two actual display mode switches. Compared to the single-frame threshold method (tested under the same hardware and sampling rate): the number of mode switches was reduced by 63%, saving approximately 31 mW·s of power consumption for backlight and GPU load; the average frame processing latency remained at 28 ms, meeting the 5fps real-time requirement; the false judgment rate in text scenes decreased from 15.4% to 3.7%, and the subjective evaluation of visual flicker (MOS1~5) improved from 3.1 to 4.4. The detailed simulation data above demonstrates that this invention not only ensures an eye-protecting blue light filtering experience in static reading scenarios but also robustly avoids false triggers in complex dynamic scenarios such as webpage scrolling and video playback, significantly optimizing the battery life and user comfort of mobile devices, fully demonstrating the practicality and advancement of the technical solution of this invention.
[0061] The above embodiments merely illustrate implementation methods of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention.
Claims
1. A display mode adaptive switching method based on continuous frame OCR analysis, characterized in that: Includes the following steps: S1: Continuous frame capture, continuously acquiring multiple frames of images on the target interface at a preset sampling period; S2: Perform step-by-step preprocessing on each frame of the acquired image. The preprocessing includes the following steps: converting the color image to grayscale using a weighted average method; applying Gaussian filtering to the grayscale image; and performing Laplacian sharpening on the Gaussian-filtered image. S3: Text region detection and proportion calculation, including the following steps: S3-1: Perform Tesseract-based OCR text detection on each preprocessed frame; S3-2: Adaptive binarization of the frame image is performed using the Sauvola local thresholding method to obtain a binary image; S3-3: Apply the 8-neighborhood connectivity algorithm to the binary image obtained in step S3-2 to mark connected regions, and merge overlapping regions when the region intersection-union ratio (IoU) is ≥ 0.3; S3-4: Use the feature pyramid network to perform multi-scale correction on the OCR detection results and output the coordinates of the top left and bottom right corners of each text region; S3-5: Calculate the pixel area of each text region based on the output coordinates in step S3-4, and sum the areas of all text regions to obtain the total text area; S3-6: Calculate the text region percentage based on the total frame pixel area; S4: Color complexity evaluation. Calculate the color variance of the detected text region. When the variance is less than or equal to the second threshold, it is recorded as a low color complexity frame. S5: Continuous Frame Confirmation: Counts the color complexity evaluation of continuous output and outputs a continuous confirmation signal; The continuous confirmation signal further includes a continuous judgment and anti-slip interference mechanism for slip operation interference, the mechanism including: Continuous judgment threshold setting: Preset continuous judgment frame number K=3; Initialize the first counter C: Set the first counter C=0; Forward counting: For each frame of image, if both conditions are met simultaneously, namely, the text region ≥ 55% and the color complexity ≤ the second threshold, then let C + 1; if either condition is not met, then C is reset to 0; when C ≥ K, a text scene confirmation signal is generated, and C is forcibly cleared to zero and reverse counting is started. Second counter C initialization: Set the second counter C=0 after the display mode is switched; Reverse counting: In eye protection mode, for each frame of image, if either the text area ratio or color complexity condition is not met, then C+1 is set; if both conditions are met, then C is reset to 0; when C≥K, a non-text scene confirmation signal is generated, and C is forcibly cleared to zero and re-entering the forward counting. By using the alternating operation of the first and second counters and the same continuous judgment threshold K, false triggers caused by dynamic blurring or content jumps in single-frame judgment due to sliding operations can be effectively filtered out. S6: Display Mode Switching: Automatically switches the display mode based on continuous confirmation signals; the rules for display mode switching are as follows: When the processor receives a text-based scene confirmation signal, it switches the display to eye protection mode. If the candidate text frame conditions are not met for N consecutive frames, the display will be switched back to normal display mode.
2. The display mode adaptive switching method based on continuous frame OCR analysis according to claim 1, characterized in that: Step S2, the step-by-step preprocessing, specifically includes the following steps: The weighted average method is adopted, and the ITU-R BT.601 standard is selected. The weighted calculation formula is as follows: ; in, To output the grayscale value of each pixel after calculation, , , These represent the values of the input pixel in the red, green, and blue components, respectively. Gaussian filtering uses a convolution kernel defined by a two-dimensional Gaussian function, and the filtering calculation formula is as follows: ; in, This represents the kernel coordinates of the convolution kernel. The standard deviation is used; the formula for calculating the convolution operation between this convolution kernel and the grayscale image is: ; in, Represents the kernel coordinates of the Gaussian kernel. The pixel values of the grayscale images covered by the kernel. The image is after Gaussian filtering; Laplacian sharpening uses the Laplacian operator, and the operator calculation formula is as follows: ; in, It is a second-order differential operator, defined as the divergence of the gradient. The sharpening process also uses the four-neighbor kernel formula for calculation, and the specific calculation formula is as follows: ; in, These are the original image pixel values. The result of the Laplacian operator calculation is ANDed with the original image to enhance the contrast of the edge regions. The contrast calculation formula is as follows: ; in, This is the sharpening intensity factor, specifically set to 0.
8.
3. The display mode adaptive switching method based on continuous frame OCR analysis according to claim 1, characterized in that: The calculation formula for Sauvola's local threshold method in step S3-2 is as follows: ; in, , Therefore Centered The mean and standard deviation of pixel values at each point in the image within the window; , , Compare the pixel value with the calculated value; if... If the value is 1, then the pixel value of that point in the image is set to 1; otherwise, it is 0.
4. The display mode adaptive switching method based on continuous frame OCR analysis according to claim 1, characterized in that: Step S3-3 uses the 8-neighborhood connectivity algorithm to mark all connected regions and calculates the overlap between regions. The specific calculation formula is as follows: ; Where IoU is the overlap, and AB are the two spaces for overlap determination. When merging regions.
5. The display mode adaptive switching method based on continuous frame OCR analysis according to claim 1, characterized in that: In steps S3-4, a feature pyramid network is used. The network's bottom-up path from input to output includes: an input image of size 224×224; a first convolutional block with a kernel size of 2×2 and a stride of 2, outputting a feature map of size 112×112; a second convolutional block with a kernel size of 2×2 and a stride of 2, outputting a feature map of size 56×56; a third convolutional block with a kernel size of 2×2 and a stride of 2, outputting a feature map of size 28×28; and a fourth convolutional layer with a kernel size of 2×2 and a stride of 2, outputting a feature map of size 14×14.
6. The display mode adaptive switching method based on continuous frame OCR analysis according to claim 5, characterized in that: The 14×14 feature map is denoted as feature 1, the 28×28 feature map is denoted as feature 2, and the 56×56 feature map is denoted as feature 3. After feature 1 to feature 3 are fused at multiple scales through the feature fusion module, the position information of the text candidate box is output.
7. The display mode adaptive switching method based on continuous frame OCR analysis according to claim 1, characterized in that: The formula for calculating the proportion of the text region in step S3-6 is as follows: ; in Let i be the area of the i-th text region. The total area of the screen. This represents the percentage of effective text.
8. The display mode adaptive switching method based on continuous frame OCR analysis according to claim 1, characterized in that: In step S4, color complexity is evaluated by measuring the image variance. The formula for calculating variance is: ; in, Image dimensions The variance value is a grayscale value. The lower the variance value, the more concentrated the color distribution and the lower the complexity. When the variance value is greater than or equal to 500, it is judged as a text pattern.
Citation Information
Patent Citations
Eye-protecting mode control method for terminal, terminal and computer-readable storage medium
CN109634680A
Eye protection mode processing method and device in fingerprint identification mode, terminal and medium
CN113641416A
Eye protection mode starting method and device, equipment, and storage medium
CN113821274A
Display color temperature detection method and system and readable storage medium
CN117198176A
Intelligent self-adaptive eye protection display system
CN120872211A