An optimization method and system for simulating a camera interface to de-interlace
By reading the data field information register of the video decoder through the I2C bus, the current frame category of the analog camera is determined, which solves the image quality problem caused by interlaced scanning and achieves higher quality video display.
Patent Information
- Application Number
- CN202411736502.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-11-29
AI Technical Summary
In existing technologies, interlaced scanning of analog cameras leads to a decrease in image clarity and stability in fast-moving scenes, and software correction methods may cause the top and bottom fields to be reversed, affecting image quality.
The data field information register of the video decoder is read through the I2C bus to determine the current frame category information of the original image data, and this information is processed before the deinterlacing operation to avoid incorrect top and bottom field settings.
It improves the image quality of displayed video images, avoids the problem of reversed top and bottom field settings, and ensures the stability and clarity of image quality.
Smart Images

Figure CN119767134B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video image processing technology, and in particular to an optimization method and system for deinterlacing analog camera interfaces. Background Technology
[0002] In power applications, analog cameras are often used for image acquisition. Typically, several analog cameras are connected to a video decoding chip to capture, stitch, and convert the analog camera data into digital signals, which are then transmitted to the main controller (SOC) via the MIPI-CSI interface. After acquiring the data, the main controller processes it and ultimately performs LCD display or other actions. Interlaced scanning of analog cameras is a common video scanning method. Interlaced scanning divides a frame of image into two fields: an odd field and an even field. The odd field scans odd lines, and the even field scans even lines. This reduces the amount of information transmitted per unit time by half, lowering the bandwidth requirements. However, in fast-moving scenes, interlaced scanning can produce noticeable jagged edges and flickering, affecting image clarity and stability. Related methods implement this in software, but these may reverse the top and bottom fields, resulting in a worse image than the original.
[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the Invention
[0004] The main objective of this application is to propose an optimization method and system for deinterlacing a simulated camera interface, which can determine the category information of the current frame of the original image data before performing deinterlacing operations, thereby improving the image quality of the displayed video image.
[0005] To achieve the above objectives, one aspect of this application proposes an optimization method for deinterlacing an analog camera interface, the method comprising:
[0006] Obtain the raw image data from the simulated camera and the corresponding frame information data;
[0007] Based on the frame information data, the original image data is subjected to deinterlacing to obtain the deinterlaced image data.
[0008] The image data after the deinterlacing operation is read and displayed to obtain the displayed image data.
[0009] In some embodiments, acquiring the raw image data from the simulated camera and the corresponding frame information data includes:
[0010] Acquire the raw image data from the simulated camera;
[0011] The thread that reads field information is awakened, and the parameters of the registers of the analog camera are read and processed through the I2C bus to obtain the frame information data corresponding to the original image data.
[0012] In some embodiments, acquiring the raw image data from the simulated camera includes:
[0013] The raw image data from the simulated camera is transmitted to the main controller via an interrupt signal;
[0014] Based on the main controller, the frame completion flag bit of the CSI status register is determined;
[0015] If the frame completion flag does not have a set flag, then the frame completion flag in the CSI status register will continue to be monitored.
[0016] If the frame completion flag is present, the original image data from the simulated camera is obtained and stored in the data buffer.
[0017] In some embodiments, it also includes:
[0018] Submit the next data buffer to the CSI hardware and clear the frame completion flag in the CSI status register.
[0019] In some embodiments, the frame information data corresponding to the original image data includes the top frame information and the bottom frame information of the original image data.
[0020] In some embodiments, performing deinterlacing processing on the original image data based on the frame information data to obtain deinterlaced image data includes:
[0021] Define the input circular buffer and the output circular buffer;
[0022] The raw image data is input into the input circular buffer;
[0023] Based on the frame information data, logical reasoning and judgment are performed to construct the first parameter and the second parameter;
[0024] Based on the first parameter and the second parameter, the original image data in the input circular buffer is deinterlaced, and the processing result is input into the output circular buffer to obtain the image data after the deinterlacing operation.
[0025] In some embodiments, the step of performing logical reasoning and judgment based on the frame information data to construct the first parameter and the second parameter includes:
[0026] The current frame of the frame information data is determined;
[0027] If the current frame of the frame information data is the top frame information, then the current frame of the frame information data is marked as the first parameter, and the next frame of the frame information data is marked as the second parameter;
[0028] If the current frame of the frame information data is the bottom frame information, then the current frame of the frame information data is marked as the second parameter, and the next frame of the frame information data is marked as the first parameter.
[0029] In some embodiments, the step of performing deinterlacing processing on the original image data in the input circular buffer based on the first parameter and the second parameter, and inputting the processing result into the output circular buffer to obtain the image data after the deinterlacing operation, includes:
[0030] Based on the first parameter and the second parameter, the original image data in the input circular buffer is divided to obtain the divided image;
[0031] The image is divided into segments, and the deinterlacing operation is performed. The processing result is then input into the output circular buffer to obtain the image data after the deinterlacing operation.
[0032] In some embodiments, it also includes:
[0033] The divided image includes odd-numbered rows and even-numbered rows. The first parameter is filled into the odd-numbered rows, and the second parameter is filled into the even-numbered rows.
[0034] To achieve the above objectives, another aspect of this application proposes an optimized system for deinterlacing an analog camera interface, the system comprising:
[0035] The first module is used to acquire the raw image data from the simulated camera and the frame information data corresponding to the raw image data;
[0036] The second module is used to perform deinterlacing operation on the original image data according to the frame information data to obtain the deinterlaced image data.
[0037] The third module is used to read the image data after the deinterlacing operation and perform display processing to obtain the displayed image data.
[0038] The embodiments of this application include at least the following beneficial effects: This application provides an optimization method and system for deinterlacing an analog camera interface. This solution obtains the original image data of the analog camera and the corresponding frame information data, and then performs deinterlacing processing on the original image data based on the frame information data. That is, it reads the data field information register of the video decoder through the I2C bus, so that the main controller determines the category information of the current frame of the original image data before performing deinterlacing processing, avoiding the problem that related methods may set the top field and bottom field in opposite directions, thereby improving the image quality of the displayed video image. Attached Figure Description
[0039] Figure 1 This is a flowchart of an optimization method for deinterlacing a simulated camera interface provided in an embodiment of this application;
[0040] Figure 2 This is a schematic diagram of the structure of an optimized system for deinterlacing an analog camera interface provided in an embodiment of this application;
[0041] Figure 3 This is a schematic diagram of the framework for deinterlacing and displaying the original image data provided in the embodiments of this application;
[0042] Figure 4 This is a schematic diagram of frame mode deinterlacing provided in the embodiments of this application;
[0043] Figure 5 This is a schematic diagram of field mode deinterlacing provided in an embodiment of this application;
[0044] Figure 6 This is a schematic diagram of the process by which the main controller receives raw image data, as provided in an embodiment of this application.
[0045] Figure 7 This is a schematic diagram of the process for deinterlacing raw image data provided in an embodiment of this application. Detailed Implementation
[0046] 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 of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of systems and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0047] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to a determination” as used herein may be interpreted as “when…” or “when…” or “in response to a determination.”
[0048] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0050] Before providing a detailed description of the embodiments of this application, some of the nouns and terms involved in the embodiments of this application will be explained first. The nouns and terms involved in the embodiments of this application are subject to the following interpretations.
[0051] 1) Internal Video Acquisition Device (MIPI-CSI) of the SOC: MIPI-CSI is a high-speed serial interface used to connect camera sensors (or image sensors) to the host controller (such as an SOC). The MIPI-CSI protocol supports high-bandwidth, low-power data transmission and is widely used in mobile devices and embedded systems.
[0052] 2) Top Field in Interlaced Video Images: The top field is the first part of an interlaced scan and typically contains even-numbered rows of data (rows 0, 2, 4, ...). In each complete image frame, the top field is transmitted first and is usually identified as Field1. The quality and content of the top field determine the upper half of the image.
[0053] 3) Bottom Field in Interlaced Video Images: The bottom field is the second part of interlaced scanning, containing the odd-numbered rows of data (rows 1, 3, 5, ...). In a complete image frame, the bottom field is usually transmitted after the top field and is identified as Field2. The bottom field determines the lower half of the image.
[0054] 4) Deinterlacing: Deinterlacing is the process of converting an interlaced image into a progressive scan image. Through interpolation, motion compensation, and other methods, the top and bottom field data are merged to generate the final frame.
[0055] Some shortcomings exist in related technologies. For example, since MIPI-CSI does not have the concept of field, it can only determine whether it is a top or bottom frame based on the frame's CNT (e.g., the frame count CNT). Therefore, if one of the fields is incorrect or lost, it cannot be automatically corrected, and jagged edges may occur due to probability of being filled in backwards.
[0056] In view of this, this application provides an optimized method for deinterlacing a simulated camera interface. By reading the data field information register of the video decoder through the I2C bus, the main controller can determine the category information of the current frame of the original image data before performing deinterlacing operations, avoiding the problem that related methods may set the top field and bottom field in opposite directions, thereby improving the image quality of the displayed video image.
[0057] Reference Figure 1 , Figure 1 A flowchart of an optimization method for deinterlacing an analog camera interface provided in an embodiment of the present invention is shown below. Figure 1 The method includes the following steps:
[0058] S100: Obtain the raw image data and corresponding frame information data from the analog camera;
[0059] It should be noted that, in some embodiments, step S100 may include:
[0060] S110. Acquire raw image data from the analog camera;
[0061] It should be noted that in some embodiments, step S110 may include: S111, transmitting the raw image data of the analog camera to the main controller in the form of an interrupt signal; S112, judging the frame completion flag bit of the CSI status register based on the main controller; S113, if the frame completion flag bit does not have a set flag, then continuing to monitor the frame completion flag bit of the CSI status register; S114, if the frame completion flag bit has a set flag, obtaining the raw image data of the analog camera and storing it in the data buffer.
[0062] S120: Wake up the thread that reads field information, and use the I2C bus to read parameters from the registers of the analog camera to obtain the frame information data corresponding to the original image data.
[0063] In some specific embodiments, such as Figure 3As shown, several analog cameras are connected to a video decoding chip. The analog camera data is acquired, spliced, and converted into digital signals, which are then transmitted to the main controller SOC via the MIP I-CS1 interface. When receiving the MIP I-CS1 image data, the SOC reads the data field information register of the video decoder via the I2C bus. After acquiring the data, the main controller performs various processing steps and ultimately performs LCD display or other actions.
[0064] The explanation focuses on reading parameters from the analog camera's registers via the I2C bus. By controlling the I2C to read data, the system can determine whether the current frame is a top or bottom frame. For example, reading 0x0 indicates the top field, while reading 0x1 indicates the bottom field. This allows the system-on-a-chip (SOC) to identify whether the current frame is a top or bottom frame, which is beneficial for subsequent image processing.
[0065] In summary, as Figure 6 As shown, data is transmitted from the CVBS camera via an interrupt. Upon receiving the interrupt signal, the SOC checks if the frame completion flag in the CSI status register is set. If not, it means the previous frame is still being processed, so it continues monitoring the frame completion flag in the status register until it is set. Once the frame completion flag is successfully set, it indicates the corresponding CSI hardware is ready to receive this frame of data. Then, the data buffer for the next frame is provided to the hardware (the hardware will automatically put the received data into this data buffer). Further steps include clearing various flags and waking up the field information reading thread. After being woken up, the new thread reads the value of a specific register via the I2C bus. This value is updated in the current frame buffer structure, and then the thread enters a waiting state.
[0066] Through the above operations, the SOC will finally obtain a complete frame of data. This frame of data not only contains the data itself, but also some parameter values of specific registers on the camera side read through the I2C bus, which prepares for the subsequent deinterlacing operation.
[0067] S200. Based on the frame information data, perform deinterlacing on the original image data to obtain the deinterlaced image data.
[0068] It should be noted that, in some embodiments, step S200 may include:
[0069] S210. Define the input circular buffer and the output circular buffer;
[0070] It should be noted that the input ring buffer (input_ring_buffer) represents the ring buffer of camera input, and the output ring buffer (output_ring_buffer) represents the ring buffer of camera output.
[0071] S220. Input the raw image data into the input circular buffer;
[0072] S230. Based on the frame information data, perform logical reasoning and judgment to construct the first parameter and the second parameter;
[0073] In this embodiment, the current frame of the frame information data is determined; if the current frame of the frame information data is the top frame information, the current frame of the frame information data is marked as the first parameter, and the next frame of the frame information data is marked as the second parameter; if the current frame of the frame information data is the bottom frame information, the current frame of the frame information data is marked as the second parameter, and the next frame of the frame information data is marked as the first parameter.
[0074] S240. Based on the first parameter and the second parameter, perform deinterlacing on the original image data in the input circular buffer, and input the processing result into the output circular buffer to obtain the image data after deinterlacing.
[0075] First, it's important to clarify that interlaced scanning in analog cameras is a common video scanning method. Interlaced scanning divides a frame of image into two fields: an odd field and an even field. The odd field scans odd-numbered lines, and the even field scans even-numbered lines. This reduces the amount of information transmitted per unit time by half, lowering the bandwidth requirements.
[0076] For the output of the MIPI-CSI interface, there are two modes: frame mode and field mode.
[0077] Among them, such as Figure 4 As shown, for frame mode, the front-end input frame size is 960x480 frame mode, where the upper part of 960x240 is the top field and the lower part of 960x240 is the bottom field.
[0078] like Figure 5 As shown, for field mode, the front-end input frame size is 960x240 field mode, where frames 1 / 3 / 5 / 7... are top, and frames 2 / 4 / 6 / 8... are bottom. CSI fills odd-numbered frames in odd-numbered rows of buf and even-numbered frames in even-numbered rows of buf, thus achieving deinterlacing.
[0079] However, the above method can only determine whether it is a top frame or a bottom frame based on the frame's cnt. Therefore, if an error occurs or a frame is lost, it cannot be automatically corrected and may result in jagged edges due to inversion.
[0080] Therefore, in this embodiment, the original image data in the input circular buffer is divided according to the first parameter and the second parameter. The divided image includes odd rows and even rows. The first parameter is filled into the odd rows and the second parameter is filled into the even rows. Then, deinterlacing is performed on the divided image, and the processing result is input into the output circular buffer to obtain the image data after deinterlacing.
[0081] In some specific embodiments, such as Figure 7 As shown, the next frame data of the circular buff input from the camera is obtained. One or more parameter values of a specific register at the camera end are obtained from the frame data, and it is determined whether this frame is the top field. If the current frame is the top field, the current frame is used as the first parameter for deinterlacing, and the next frame is used as the second parameter. If the current frame is not the top field, the current frame is used as the second parameter for deinterlacing, and the next frame is used as the second parameter. Using the above two parameters, the deinterlacing operation is performed to obtain the processed data, which is placed in the output circular buff.
[0082] S300: Read the image data after deinterlacing and perform display processing to obtain the displayed image data;
[0083] Finally, this solution is explained using a practical engineering case. Traditional aircraft displays often have a reset button on the side or top. If you see jagged edges on the displayed image, pressing the reset button will correct the picture. The principle is that jagged edges indicate an error in the deinterlacing of the top and bottom fields—the top and bottom fields are reversed. Pressing the reset button reverses the top and bottom fields before re-interlacing, restoring the original image information. Based on this, this solution uses automated methods to correct the top and bottom fields. In scenarios using analog cameras and the MIP-CSI interface for transmission, reading the video decoder's data field information register via the I2C bus allows the SOC to know in real time whether the acquired camera data is top or bottom field, which is beneficial for subsequent deinterlacing. Otherwise, the SOC would not know the field information. When the camera or environmental factors cause data link errors or anomalies, resulting in the loss of one or more frames, the field change might lead to a worse deinterlaced image than the original data.
[0084] Please see Figure 2 This application also provides an optimization system for deinterlacing an analog camera interface, which can implement the above-mentioned optimization method for deinterlacing an analog camera interface. The system includes:
[0085] The first module 201 is used to acquire the raw image data of the analog camera and the frame information data corresponding to the raw image data;
[0086] The second module 202 is used to perform deinterlacing operation on the original image data according to the frame information data to obtain the deinterlaced image data.
[0087] The third module 203 is used to read the image data after deinterlacing and perform display processing to obtain the displayed image data.
[0088] It is understood that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0089] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. An optimization method for de-interlacing of a video camera interface, characterized in that, The method comprises the following steps: Obtain the original image data of the analog camera and the frame information data corresponding to the original image data; According to the frame information data, the original image data is de-interlaced to obtain the de-interlaced image data; Read the de-interlaced image data and perform display processing to obtain the displayed image data; The original image data of the analog camera and the frame information data corresponding to the original image data are obtained, comprising: Obtain the original image data of the analog camera; Wake up the thread for reading field information, and perform parameter reading processing on the register of the analog camera through the I2C bus to obtain the frame information data corresponding to the original image data; The frame information data corresponding to the original image data includes the top frame information of the original image data and the bottom frame information of the original image data.
2. The method of claim 1, wherein, The original image data of the analog camera is obtained, comprising: The original image data of the analog camera is transmitted to the host controller in the form of an interrupt signal; Based on the host controller, the frame completion flag bit of the CSI state register is judged; If the frame completion flag bit does not exist, the frame completion flag bit of the CSI state register is continuously monitored; If the frame completion flag bit exists, the original image data of the analog camera is obtained and stored in the data buffer.
3. The method of claim 2, wherein, Further comprising: Submit the next data buffer to the CSI hardware and clear the frame completion flag bit of the CSI state register.
4. The method of claim 1, wherein, According to the frame information data, the original image data is de-interlaced to obtain the de-interlaced image data, comprising: Define the input ring buffer and the output ring buffer; The original image data is input into the input ring buffer; Logical reasoning is performed according to the frame information data to construct the first parameter and the second parameter; Based on the first parameter and the second parameter, the original image data in the input ring buffer is de-interlaced, and the processing result is input into the output ring buffer to obtain the de-interlaced image data.
5. The method of claim 4, wherein, Logical reasoning is performed according to the frame information data to construct the first parameter and the second parameter, comprising: Judge the current frame of the frame information data; If the current frame of the frame information data is the top frame information, mark the current frame of the frame information data as the first parameter, and mark the next frame of the frame information data as the second parameter; If the current frame of the frame information data is the bottom frame information, mark the current frame of the frame information data as the second parameter, and mark the next frame of the frame information data as the first parameter.
6. The method of claim 4, wherein, Based on the first parameter and the second parameter, the original image data in the input ring buffer is de-interlaced, and the processing result is input into the output ring buffer to obtain the de-interlaced image data, comprising: According to the first parameter and the second parameter, the original image data in the input ring buffer is divided to obtain divided images; According to the divided images, a de-interlacing operation is performed, and the processing result is input to the output ring buffer to obtain image data after the de-interlacing operation.
7. The method of claim 6, wherein, Further comprising: The divided images include odd rows and even rows, the first parameter is filled in the odd rows, and the second parameter is filled in the even rows.
8. An optimized system for deinterlacing analog camera interfaces, characterized in that, The system comprises: A first module is configured to acquire original image data of an analog camera and frame information data corresponding to the original image data; A second module is configured to perform a de-interlacing operation on the original image data according to the frame information data to obtain image data after the de-interlacing operation; A third module is configured to read the image data after the de-interlacing operation and perform display processing to obtain displayed image data; The acquisition of the original image data of the analog camera and the frame information data corresponding to the original image data comprises: Acquiring the original image data of the analog camera; Waking up a thread for reading field information, performing parameter reading processing on a register of the analog camera through an I2C bus to obtain frame information data corresponding to the original image data; The frame information data corresponding to the original image data includes top frame information of the original image data and bottom frame information of the original image data.
Citation Information
Patent Citations
Auxiliary signal synchronization for closed captioning insertion
CN1663247A
Method and apparatus for processing video signal
US20180098024A1