Terminal device, image processing method, storage medium, and program product
Patent Information
- Application Number
- CN202610493801.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-14
- Publication Date
- 2026-08-18
AI Technical Summary
[0003]然而,预览画面中的文字(如书籍、路牌、屏幕显示内容)同样会被水平翻转,造成文字无法正常阅读
Smart Images

Figure CN122601970A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal equipment technology, and in particular to a terminal device, an image processing method, a storage medium, and a program product. Background Technology
[0002] In camera applications on terminal devices (such as mobile phones and tablets), when a mirror preview mode (such as selfie mode) is enabled, the camera preview screen will be horizontally flipped to achieve the "mirror effect" that users are accustomed to.
[0003] However, the text in the preview (such as books, road signs, and screen content) will also be horizontally flipped, making the text unreadable. Summary of the Invention
[0004] Therefore, it is necessary to provide a terminal device, image processing method, computer-readable storage medium, and computer program product that can achieve normal display of text on the screen, addressing the aforementioned technical problems.
[0005] In a first aspect, this application provides a terminal device, including:
[0006] The screen component is configured to display the shooting preview interface;
[0007] The front-facing camera component is configured to capture images from one side of the screen component;
[0008] The controller, coupled to both the screen assembly and the front-facing camera assembly, is configured as follows:
[0009] Acquire video frame images to be processed captured by the front camera component, including horizontally mirrored video frame images;
[0010] Perform text region detection on the video frame image to be processed to obtain the original text region in the video frame image;
[0011] Perform character recognition on the original text region to obtain the text content in the original text region;
[0012] The text content in the original text region is horizontally mirrored to obtain the target text region.
[0013] The original text region in the video frame image to be processed is replaced with the target text region to obtain the target video frame image;
[0014] The control screen component displays the target video frame image in the shooting preview interface.
[0015] The above technical solution has the following advantages or effects: By identifying the original text region of the video frame image to be processed and performing horizontal mirroring on the text content of the original text region, the normal display of the text content can be achieved. Since only the original text region is horizontally mirrored, the high overhead of performing global horizontal mirroring on the entire video frame image to be processed is avoided, thus improving processing efficiency and meeting the high real-time requirements of the user's preview shooting preview interface.
[0016] In one embodiment, character recognition is performed on the original text region to obtain the text content within the original text region, including:
[0017] A preset number of video frames are used at intervals to perform text recognition on the original text regions in the video frames, thereby obtaining the text content in the original text regions.
[0018] The above technical solution has the following advantages or effects: By performing text content recognition at preset intervals of a number of video frames, text recognition is avoided frame by frame, which can significantly reduce the processing time of text recognition and improve processing efficiency.
[0019] In one embodiment, character recognition is performed on the original text region to obtain the text content within the original text region, including:
[0020] For each video frame image, perform text recognition on the original text region in the current video frame image to obtain the text content in the current video frame image;
[0021] The position change detection results are obtained by comparing the original text region in the next video frame with the original text region in the current video frame.
[0022] If the position change detection result indicates that the position change of the original text region is less than the preset position change threshold, the text content of the original text region in the current video frame image is used as the text content in the next video frame image.
[0023] The above technical solution has the following advantages or effects: by detecting the positional changes of the original text region in two adjacent video frames, it is possible to avoid repeated detection of the text content in the original text region, thereby significantly reducing the processing time of text recognition and improving processing efficiency.
[0024] In one embodiment, before obtaining the target video frame image by replacing the original text region in the video frame image to be processed with the target text region, the controller is further configured to:
[0025] For each pixel in the target text region, obtain the pixel value of each pixel and the pixel value of the target pixel; the target pixel is the pixel in the background mirror image; the background mirror image is the image in the video frame excluding the target text region;
[0026] The pixel values of each pixel are mixed with the pixel values of the target pixel to obtain the mixed pixel values corresponding to each pixel;
[0027] Replace the pixel value of each pixel with the mixed pixel value corresponding to each pixel.
[0028] The above technical solution has the following advantages or effects: by mixing the pixel values of each pixel in the target text region with the corresponding target pixel, the edge jaggedness of the target text region can be eliminated, making the subsequent target video frame image more natural and improving the quality of the target video frame image.
[0029] In one embodiment, the pixel values of each pixel are mixed with the pixel values of the target pixel to obtain the mixed pixel values corresponding to each pixel, including:
[0030] Obtain the edge distance between each pixel and the corresponding target text region;
[0031] Determine the blending coefficient for each pixel based on the edge distance;
[0032] Based on the mixing coefficient, the pixel value of each pixel is mixed with the pixel value of the target pixel to obtain the mixed pixel value corresponding to each pixel.
[0033] The above technical solution has the following advantages or effects: by determining the corresponding blending coefficients through the edge distance between each pixel and the corresponding target text region, a natural transition can be achieved between the pixels near the boundary in the target text region and the pixels in the background mirror image, thereby eliminating the edge jaggedness of the target text region, making the subsequent target video frame image more natural, and improving the quality of the target video frame image.
[0034] In one embodiment, the text content in the original text region is horizontally mirrored to obtain the target text region, including:
[0035] Obtain the coordinate data of the original text region;
[0036] Based on the resolution of the video frame image to be processed, the coordinate data is normalized to obtain normalized coordinate data.
[0037] When the device resolution is lower than the resolution of the video frame image, the resolution of the video frame image to be processed is downsampled to the device resolution. Based on the device resolution and normalized coordinate data, the target coordinate data of the original text region is obtained; the device resolution is the resolution of the terminal device.
[0038] The target text region is obtained based on the target coordinate data and the preset horizontal mirroring method.
[0039] The above technical solution has the following advantages or effects: by automatically downsampling the resolution of the video frame image to the device resolution and adjusting the coordinate data of the original text area accordingly to the target coordinate data, horizontal mirroring of text content can be performed at different device resolutions, thus achieving normal display of text content at different device resolutions.
[0040] In one embodiment, before performing text region detection on the video frame image to be processed to obtain the original text region in the video frame image to be processed, the controller is further configured to:
[0041] The video frame image to be processed is downsampled to obtain the downsampled video frame image to be processed.
[0042] The format of the downsampled video frame image to be processed is converted.
[0043] The above technical solution has the following advantages or effects: by downsampling the video frame images to be processed, the amount of subsequent data processing can be reduced, and processing efficiency can be improved. Furthermore, by converting the format of the downsampled video frame images to be processed, subsequent text recognition is facilitated.
[0044] Secondly, this application also provides an image processing method, the method comprising:
[0045] Obtain the horizontally mirrored video frame image;
[0046] Perform text region detection on video frame images to obtain the original text regions in the video frame images;
[0047] Perform character recognition on the original text region to obtain the text content in the original text region;
[0048] The text content in the original text region is horizontally mirrored to obtain the target text region.
[0049] The target video frame image is obtained by replacing the original text region in the video frame image with the target text region.
[0050] Thirdly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method steps of the second aspect.
[0051] Fourthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the method steps of the second aspect.
[0052] The aforementioned terminal equipment, image processing method, computer-readable storage medium, and computer program product can achieve normal display of text content by identifying the original text region of the video frame image to be processed and performing horizontal mirroring processing on the text content of the original text region. Since only the original text region is horizontally mirrored, the high overhead of global processing of the entire video frame image to be processed is avoided, improving processing efficiency and meeting the high real-time requirements of user preview and shooting preview interfaces. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is a structural block diagram of a terminal device in one embodiment;
[0055] Figure 2 This is a schematic diagram showing the original text area in one embodiment;
[0056] Figure 3 This is a schematic diagram illustrating the display of the target text area in one embodiment;
[0057] Figure 4 This is a schematic diagram of the preprocessing process for a video frame image to be processed in one embodiment;
[0058] Figure 5 This is a flowchart illustrating the process of obtaining text content in an original text region in one embodiment;
[0059] Figure 6 This is a schematic diagram of the process for obtaining mixed pixel values in one embodiment;
[0060] Figure 7 This is a schematic diagram of the process for obtaining mixed pixel values in another embodiment;
[0061] Figure 8 This is a flowchart illustrating the process of obtaining a target text region in one embodiment;
[0062] Figure 9 This is a flowchart illustrating an image processing method in one embodiment;
[0063] Figure 10 This is a structural block diagram of an image processing device in one embodiment;
[0064] Figure 11 This is a structural block diagram of the text content acquisition module in one embodiment;
[0065] Figure 12 Here is a structural block diagram of the target text region acquisition module in one embodiment;
[0066] Figure 13 This is a structural block diagram of an image processing apparatus in another embodiment;
[0067] Figure 14 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0068] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0069] In one exemplary embodiment, such as Figure 1 As shown, a terminal device is provided, the terminal device including:
[0070] Screen component 110 is configured to display a shooting preview interface;
[0071] The front-facing camera assembly 120 is configured to capture images from one side of the screen assembly 110;
[0072] The controller 130 is coupled to the screen assembly 110 and the front-facing camera assembly 120 respectively, and is configured as follows:
[0073] Acquire video frame images to be processed captured by the front camera component 120, including horizontally mirrored video frame images;
[0074] Perform text region detection on the video frame image to be processed to obtain the original text region in the video frame image;
[0075] Perform character recognition on the original text region to obtain the text content in the original text region;
[0076] The text content in the original text region is horizontally mirrored to obtain the target text region.
[0077] The original text region in the video frame image to be processed is replaced with the target text region to obtain the target video frame image;
[0078] The control screen component 110 displays the target video frame image in the shooting preview interface.
[0079] The terminal device can be a smart terminal with a front-facing camera, including but not limited to smartphones, selfie cameras, tablets, and personal digital assistants (PDAs).
[0080] The screen component can be a display screen that shows real-time captured images or photos.
[0081] The front-facing camera component can be a front-facing camera or a camera with equivalent front-facing camera capabilities. For example, a rotating camera can be rotated to the same side of the screen component to be used as a front-facing camera.
[0082] In this embodiment, the user activates the front-facing camera component to enable the mirror preview mode (i.e., selfie mode). The front-facing camera component captures image data within its field of view, and the image data is then horizontally mirrored to obtain a video frame image to be processed. This video frame image may include faces, text, and other content.
[0083] The text region detection can be performed on the entire video frame image to be processed, or it can be performed on the central region of the entire video frame image to be processed. The position and size of the central region can be set according to actual needs.
[0084] Optical Character Recognition (OCR) technology is used to recognize characters in the original text area and obtain the text content in the original text area.
[0085] The text content in the original text region is horizontally mirrored to obtain the target text region, so that the text content in the target text region can be displayed normally. Specifically, for each pixel in the original text region... After coordinate transformation, the coordinates of the corresponding pixels in the target text region are obtained. The formula for pixel coordinate transformation is:
[0086]
[0087]
[0088]
[0089]
[0090] in, The x-coordinate of the top-left or bottom-left vertex of the original text region. The y-coordinate represents the top-left or bottom-left vertex of the original text region. The x-coordinate of the top-right or bottom-right vertex of the original text region. The ordinate of the top right or bottom right vertex of the original text region.
[0091] The original text region in the video frame image to be processed is replaced with the target text region to obtain the target video frame image. This target video frame image is then displayed on the screen component so that the user can see the text content as it appears. For example... Figure 2 and Figure 3 As shown, Figure 2 The original text region of the video frame image to be processed. Figure 3 The target text region in the target video frame image.
[0092] The aforementioned terminal device identifies the original text region of the video frame image to be processed and performs horizontal mirroring on the text content of the original text region, thereby achieving normal display of the text content. Since only the original text region is horizontally mirrored, the high overhead of global horizontal mirroring of the entire video frame image to be processed is avoided, improving processing efficiency and meeting the high real-time requirements of the user's preview / capture preview interface.
[0093] In one embodiment, such as Figure 4 As shown, before performing text region detection on the video frame image to be processed and obtaining the original text region in the video frame image, the controller is also configured to:
[0094] Step S410: Downsample the video frame image to be processed to obtain the downsampled video frame image to be processed.
[0095] In this embodiment, the high-resolution video frame image to be processed is downsampled to a lower resolution. For example, the resolution of the video frame image to be processed is reduced from 4K to 1080p.
[0096] Step S420: Convert the format of the downsampled video frame image to be processed.
[0097] In this embodiment of the application, the video frame image to be processed is in YUV format, and the video frame image to be processed is converted into RGB format.
[0098] This application embodiment reduces the amount of subsequent data processing and improves processing efficiency by downsampling the video frame images to be processed. Format conversion of the downsampled video frame images facilitates subsequent text recognition.
[0099] In one embodiment, character recognition is performed on the original text region to obtain the text content within the original text region, including:
[0100] Step S430: At each preset number of video frame images, perform text recognition on the original text region in the video frame images to obtain the text content in the original text region.
[0101] In this embodiment of the application, after identifying the original text region of each video frame image frame by frame, considering that the text recognition of the original text region requires a long processing time, the text content recognition is performed by intervening at a preset number of video frames, for example, by performing text recognition once every 3 frames, avoiding text recognition frame by frame, which can significantly reduce the processing time of text recognition and improve processing efficiency.
[0102] In one embodiment, such as Figure 5 As shown, character recognition is performed on the original text region to obtain the text content within the original text region, including:
[0103] Step S510: For each video frame image, perform text recognition on the original text region in the current video frame image to obtain the text content in the current video frame image;
[0104] Step S520: Perform position change detection on the original text region in the next video frame image and the original text region in the current video frame image to obtain the position change detection result.
[0105] Step S530: If the position change detection result indicates that the position change of the original text region is less than the preset position change threshold, the text content of the original text region in the current video frame image is used as the text content in the next video frame image.
[0106] The preset position change threshold can be set according to actual needs. For example, the preset position change threshold is 5% of the original text area width.
[0107] In this embodiment, considering that the text content in the image to be processed may move, for example, the text on the user's clothes moves with the user, or the text on the billboard held by the user moves with the user, the original text region of the video frame image is detected frame by frame. The position change of the original text region of two adjacent video frame images is compared with a preset position change threshold. If the position change detection result indicates that the position change of the original text region is less than the preset position change threshold, the text content of the next video frame image is not recognized, and the text content of the previous video frame image is reused.
[0108] This application embodiment detects the positional changes of the original text region in two adjacent video frames, which avoids repeated detection of the text content in the original text region, thereby significantly reducing the processing time of text recognition and improving processing efficiency.
[0109] In one embodiment, such as Figure 6 As shown, before replacing the original text region in the video frame image to be processed with the target text region to obtain the target video frame image, the controller is also configured to:
[0110] Step S610: For each pixel in the target text region, obtain the pixel value of each pixel and the pixel value of the target pixel; the target pixel is the pixel in the background mirror image; the background mirror image is the image in the video frame image excluding the target text region.
[0111] The target pixel can be any pixel in the background mirror image, or a pixel in the background mirror image that is adjacent to the target text region. For example, the target pixel can be a pixel in the background mirror image that is close to the left, right, top, or bottom boundary of the target text region.
[0112] Step S620: Mix the pixel value of each pixel with the pixel value of the target pixel to obtain the mixed pixel value corresponding to each pixel.
[0113] In this embodiment of the application, the pixel value of each pixel and the pixel value of the target pixel can be weighted and summed to obtain the mixed pixel value corresponding to each pixel.
[0114] Step S630: Replace the pixel value of each pixel with the mixed pixel value corresponding to each pixel.
[0115] In this embodiment of the application, the pixel value of each pixel is replaced by the mixed pixel value corresponding to each pixel to generate the processed target text region.
[0116] This application embodiment achieves the effect of eliminating jagged edges in the target text region by mixing the pixel values of each pixel in the target text region with the corresponding target pixel values, making the subsequent target video frame image more natural and improving the quality of the target video frame image.
[0117] In one embodiment, such as Figure 7 As shown, the pixel values of each pixel are mixed with the pixel values of the target pixel to obtain the mixed pixel values corresponding to each pixel, including:
[0118] Step S710: Obtain the edge distance between each pixel and the corresponding target text region.
[0119] In this embodiment of the application, an image edge detection algorithm is used to identify the boundaries of the target text region (i.e., the top, bottom, left, and right boundaries), determine the distance from each pixel in the target text region to each boundary, and take the minimum distance as the edge distance from the pixel to the target text region.
[0120] Step S720: Determine the blending coefficients corresponding to each pixel based on the edge distance.
[0121] In this embodiment of the application, the expression for the mixing coefficient is as follows:
[0122]
[0123] in, denoted by , where d represents the mixing coefficient and d represents the edge distance.
[0124] Step S730: Based on the mixing coefficient, the pixel value of each pixel is mixed with the pixel value of the target pixel to obtain the mixed pixel value corresponding to each pixel.
[0125] In this embodiment, the expression for the mixed pixel values is as follows:
[0126]
[0127] in, Indicates the blended pixel value. Represents the pixel value of a pixel. This represents the pixel value of the target pixel.
[0128] When the pixel is located on the boundary of the target text region, d=0. Retain 20% of the text color and 80% of the background color, softening hard edges. When d=1, =0.6, retaining 60% of the text color and 40% of the background color to achieve a smooth transition. When d≥2, =1, using only the text color, with no blending within the text area.
[0129] This application embodiment determines the corresponding blending coefficient by measuring the edge distance between each pixel and the corresponding target text region. This enables a natural transition between pixels near the boundary in the target text region and pixels in the background mirror image, thereby eliminating jagged edges in the target text region. This makes subsequent target video frame images more natural and improves the quality of the target video frame images.
[0130] In one embodiment, such as Figure 8 As shown, the text content in the original text region is horizontally mirrored to obtain the target text region, including:
[0131] Step S810: Obtain the coordinate data of the original text region.
[0132] In this embodiment of the application, the x and y coordinates of the four vertices of the original text region (i.e., the top left vertex, the bottom left vertex, the top right vertex, and the bottom right vertex) are obtained.
[0133] Step S820: Normalize the coordinate data according to the resolution of the video frame image to be processed to obtain normalized coordinate data.
[0134] In this embodiment, the width and height of the video frame image to be processed are obtained. The difference between the x-coordinate of the top-left vertex of the original text region and the width is calculated, and the difference is divided by the width to obtain the normalized x-coordinate of the top-left vertex. The difference between the y-coordinate of the top-left vertex of the original text region and the height is calculated, and the difference is divided by the height to obtain the normalized y-coordinate of the top-left vertex. Similarly, the normalized coordinate data of the bottom-left, top-right, and bottom-right vertices of the original text region can be obtained.
[0135] Step S830: When the device resolution is lower than the resolution of the video frame image, the resolution of the video frame image to be processed is downsampled to the device resolution. Based on the device resolution and normalized coordinate data, the target coordinate data of the original text region is obtained; the device resolution is the resolution of the terminal device.
[0136] In this embodiment of the application, the device resolution is... Normalized coordinate data is For example, target coordinate data The expression is:
[0137]
[0138] in, This indicates the floor function.
[0139] Step S840: Obtain the target text region based on the target coordinate data and the preset horizontal mirroring processing method.
[0140] In this embodiment, a horizontal mirroring method is used to transform the target coordinate data to obtain the target text region. The coordinate transformation formula can be found in the foregoing embodiments and will not be repeated here.
[0141] This application embodiment automatically downsamples the resolution of the video frame image to the device resolution and adjusts the coordinate data of the original text area accordingly to the target coordinate data. This enables horizontal mirroring of text content at different device resolutions, achieving normal display of text content at different device resolutions.
[0142] like Figure 9 As shown, this application also provides an image processing method, the method comprising:
[0143] Step S910: Obtain the horizontally mirrored video frame image;
[0144] Step S920: Perform text region detection on the video frame image to obtain the original text region in the video frame image;
[0145] Step S930: Perform character recognition on the original text region to obtain the text content in the original text region;
[0146] Step S940: Horizontally mirror the text content in the original text region to obtain the target text region;
[0147] Step S950: Replace the original text region in the video frame image with the target text region to obtain the target video frame image.
[0148] It should be noted that the specific limitations of the above steps can be found in the specific limitations of a terminal device mentioned above, and will not be repeated here.
[0149] The technical solution of this embodiment identifies the original text region of the video frame image to be processed and performs horizontal mirroring processing on the text content of the original text region, thereby achieving normal display of the text content. Since horizontal mirroring processing is only performed on the original text region, the high overhead of global horizontal mirroring processing of the entire video frame image to be processed is avoided, improving processing efficiency and meeting the high real-time requirements of the user's preview shooting preview interface.
[0150] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0151] Based on the same inventive concept, this application also provides an image processing apparatus for implementing the image processing method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more air conditioner control device embodiments provided below can be found in the limitations of the air conditioner control method described above, and will not be repeated here.
[0152] In one exemplary embodiment, such as Figure 10 As shown, an image processing apparatus is provided, comprising:
[0153] The video frame image acquisition module 1010 is used to acquire horizontally mirrored video frame images;
[0154] The original text region acquisition module 1020 is used to perform text region detection on video frame images to obtain the original text regions in the video frame images.
[0155] The text content acquisition module 1030 is used to perform text recognition on the original text region to obtain the text content in the original text region;
[0156] The target text region acquisition module 1040 is used to perform horizontal mirroring of the text content in the original text region to obtain the target text region;
[0157] The target video frame image acquisition module 1050 is used to replace the original text region in the video frame image with the target text region to obtain the target video frame image.
[0158] In one embodiment, the text content acquisition module 1030 includes:
[0159] The text recognition unit is used to perform text recognition on the original text regions in the video frame images at preset intervals of a number of video frame images, and obtain the text content in the original text regions.
[0160] In one embodiment, please refer to Figure 11 The text content acquisition module 1030 includes:
[0161] The text content acquisition unit 1110 is used to perform text recognition on the original text region in the current video frame image for each video frame image, and obtain the text content in the current video frame image.
[0162] The position change detection result acquisition unit 1120 is used to perform position change detection on the original text region in the next video frame image of the current video frame image and the original text region in the current video frame image, and obtain the position change detection result.
[0163] The text content replacement unit 1130 is used to replace the text content of the original text region in the current video frame image with the text content of the next video frame image when the position change detection result indicates that the position change of the original text region is less than a preset position change threshold.
[0164] In one embodiment, please refer to Figure 12 The target text region acquisition module 1040 includes:
[0165] The coordinate data acquisition unit 1210 is used to acquire the coordinate data of the original text region;
[0166] The normalized coordinate data acquisition unit 1220 is used to normalize the coordinate data according to the resolution of the video frame image to be processed, and obtain normalized coordinate data.
[0167] The target coordinate data acquisition unit 1230 is used to downsample the resolution of the video frame image to be processed to the device resolution when the device resolution is lower than the resolution of the video frame image, and obtain the target coordinate data of the original text region based on the device resolution and the normalized coordinate data; the device resolution is the resolution of the terminal device.
[0168] The target text region acquisition unit 1240 is used to obtain the target text region based on the target coordinate data and the preset horizontal mirroring processing method.
[0169] In one embodiment, please refer to Figure 13 The device also includes:
[0170] The pixel value acquisition module 1310 is used to acquire the pixel value of each pixel in the target text region and the pixel value of the target pixel; the target pixel is the pixel in the background mirror image; the background mirror image is the image in the video frame image excluding the target text region;
[0171] The mixed pixel value acquisition module 1320 is used to mix the pixel value of each pixel with the pixel value of the target pixel to obtain the mixed pixel value corresponding to each pixel.
[0172] The pixel value replacement module 1330 is used to replace the pixel value of each pixel with the mixed pixel value corresponding to each pixel.
[0173] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 14As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements an image processing method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0174] Those skilled in the art will understand that Figure 14 The structures shown are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements. In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the aforementioned image processing method. The steps of the image processing method described here may be steps from one of the image processing methods in the various embodiments described above.
[0175] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the steps of the image processing method described above. The steps of the image processing method described here may be steps from one of the image processing methods in the various embodiments described above.
[0176] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, causes the processor to perform the steps of the image processing method described above. The steps of the image processing method described here may be steps from one of the image processing methods in the various embodiments described above.
[0177] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0178] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic resistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0179] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0180] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A terminal device, characterized in that, include: The screen component is configured to display the shooting preview interface; The front-facing camera component is configured to capture images from one side of the screen component; The controller, coupled to both the screen assembly and the front-facing camera assembly, is configured to: Acquire video frame images to be processed captured by the front camera component, the video frame images to be processed including horizontally mirrored video frame images; The text region detection is performed on the video frame image to be processed to obtain the original text region in the video frame image to be processed. The original text region is subjected to character recognition to obtain the text content in the original text region; The text content in the original text region is horizontally mirrored to obtain the target text region. The target text region is used to replace the original text region in the video frame image to be processed to obtain the target video frame image; The screen component is controlled to display the target video frame image in the shooting preview interface.
2. The terminal device according to claim 1, characterized in that, The step of performing character recognition on the original text region to obtain the text content in the original text region includes: At preset intervals, a number of video frames are used to perform text recognition on the original text regions in the video frames to obtain the text content in the original text regions.
3. The terminal device according to claim 1, characterized in that, The step of performing character recognition on the original text region to obtain the text content in the original text region includes: For each video frame image, perform text recognition on the original text region in the current video frame image to obtain the text content in the current video frame image; Position change detection is performed on the original text region in the next video frame image of the current video frame image and the original text region in the current video frame image to obtain the position change detection result; If the position change detection result indicates that the position change of the original text region is less than a preset position change threshold, the text content of the original text region in the current video frame image is taken as the text content in the next video frame image.
4. The terminal device according to claim 1, characterized in that, Before replacing the original text region in the video frame image to be processed with the target text region to obtain the target video frame image, the controller is further configured to: For each pixel in the target text region, obtain the pixel value of each pixel and the pixel value of the target pixel; The target pixel is a pixel in the background mirror image; the background mirror image is the image in the video frame image excluding the target text region. The pixel values of each pixel are mixed with the pixel values of the target pixel to obtain the mixed pixel values corresponding to each pixel. The pixel value of each pixel is replaced with the mixed pixel value corresponding to each pixel.
5. The terminal device according to claim 4, characterized in that, The step of mixing the pixel values of each of the aforementioned pixels with the pixel value of the target pixel to obtain the mixed pixel value corresponding to each of the aforementioned pixels includes: Obtain the edge distance between each pixel and the corresponding target text region; Based on the edge distance, determine the mixing coefficient corresponding to each pixel; According to the mixing coefficient, the pixel value of each pixel is mixed with the pixel value of the target pixel to obtain the mixed pixel value corresponding to each pixel.
6. The terminal device according to any one of claims 1 to 5, characterized in that, The step of horizontally mirroring the text content in the original text region to obtain the target text region includes: Obtain the coordinate data of the original text region; Based on the resolution of the video frame image to be processed, the coordinate data is normalized to obtain normalized coordinate data. If the device resolution is lower than the resolution of the video frame image, the resolution of the video frame image to be processed is downsampled to the device resolution, and the target coordinate data of the original text region is obtained based on the device resolution and the normalized coordinate data; the device resolution is the resolution of the terminal device. The target text region is obtained based on the target coordinate data and the preset horizontal mirroring processing method.
7. The terminal device according to any one of claims 1 to 5, characterized in that, Before performing text region detection on the video frame image to be processed to obtain the original text region in the video frame image to be processed, the controller is further configured to: The video frame image to be processed is downsampled to obtain the downsampled video frame image to be processed; The downsampled video frame image to be processed is converted to a different format.
8. An image processing method, characterized in that, The method includes: Obtain the horizontally mirrored video frame image; Perform text region detection on the video frame image to obtain the original text region in the video frame image; The original text region is subjected to character recognition to obtain the text content in the original text region; The text content in the original text region is horizontally mirrored to obtain the target text region. The target text region is used to replace the original text region in the video frame image to obtain the target video frame image.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method of claim 8.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method of claim 8.