WO2017041714A1 - Method and device for acquiring rgb data - Google Patents
Method and device for acquiring rgb data Download PDFInfo
- Publication number
- WO2017041714A1 WO2017041714A1 PCT/CN2016/098318 CN2016098318W WO2017041714A1 WO 2017041714 A1 WO2017041714 A1 WO 2017041714A1 CN 2016098318 W CN2016098318 W CN 2016098318W WO 2017041714 A1 WO2017041714 A1 WO 2017041714A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- channel
- pixel
- image
- gradient
- interpolation result
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 48
- 238000004891 communication Methods 0.000 description 26
- 230000006870 function Effects 0.000 description 10
- 230000000007 visual effect Effects 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 7
- 238000010295 mobile communication Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 238000012545 processing Methods 0.000 description 4
- 230000005236 sound signal Effects 0.000 description 4
- 238000007726 management method Methods 0.000 description 3
- 238000005192 partition Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000002474 experimental method Methods 0.000 description 2
- 230000002441 reversible effect Effects 0.000 description 2
- 101150012579 ADSL gene Proteins 0.000 description 1
- 102100020775 Adenylosuccinate lyase Human genes 0.000 description 1
- 108700040193 Adenylosuccinate lyases Proteins 0.000 description 1
- 238000012935 Averaging Methods 0.000 description 1
- FYZYXYLPBWLLGI-AUOPOVQUSA-N Genipin 1-beta-gentiobioside Chemical compound C([C@H]1O[C@H]([C@@H]([C@@H](O)[C@@H]1O)O)O[C@@H]1OC=C([C@@H]2[C@H]1C(=CC2)CO)C(=O)OC)O[C@@H]1O[C@H](CO)[C@@H](O)[C@H](O)[C@H]1O FYZYXYLPBWLLGI-AUOPOVQUSA-N 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 229910044991 metal oxide Inorganic materials 0.000 description 1
- 150000004706 metal oxides Chemical class 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003909 pattern recognition Methods 0.000 description 1
- 238000013468 resource allocation Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000000638 solvent extraction Methods 0.000 description 1
- 238000001228 spectrum Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001629 suppression Effects 0.000 description 1
- 239000010409 thin film Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/10—Cameras or camera modules comprising electronic image sensors; Control thereof for generating image signals from different wavelengths
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T3/4015—Image demosaicing, e.g. colour filter arrays [CFA] or Bayer patterns
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/64—Circuits for processing colour signals
- H04N9/646—Circuits for processing colour signals for image enhancement, e.g. vertical detail restoration, cross-colour elimination, contour correction, chrominance trapping filters
Definitions
- This document relates to, but is not limited to, image processing technology, and more particularly to a method and apparatus for acquiring data of RGB (Red Green Blue).
- CMOS Complementary Metal Oxide Semiconductor
- RGB data More methods for obtaining RGB data generally include:
- the pixel values of the G channels of the pixels corresponding to the R channel and the B channel in the image are reconstructed.
- the process of reconstructing the pixel value of the G channel of the pixel corresponding to the R channel in the image is similar, and the process of reconstructing the pixel value of the G channel of the pixel corresponding to the B channel in the image is similar.
- ⁇ H i1,j1 is the vertical gradient of the pixel in the j1th column of the i1th row
- ⁇ V i1, j1 is the horizontal gradient of the pixel in the j1th column of the i1th row
- G i1, j1-1 is the i1th row (j1) 1
- the pixel value of the G channel of the pixel of the column, G i1, j1+1 is the pixel value of the G channel of the pixel of the (i1+1)th column of the i1th row
- R i1, j1 is the j1 column of the i1th row
- the pixel value of the R channel of the pixel, R i1, j1-2 is the pixel value of the R channel of the pixel of the (i1-2)th column of the i1th row
- R i1, j1+2 is the i1th row (j1+2)
- the pixel values of the R channel of the pixel corresponding to the G channel and the B channel of the pixel corresponding to the G channel in the image are reconstructed.
- the formula Reconstructing the pixel value of the R channel of the pixel of the i2th row and the j2th column; The pixel value of the B channel of the pixel of the i2th row and the j2th column is reconstructed.
- r i2, j2 are the pixel values of the R channel of the pixel of the reconstructed i2 row and j2 column
- R i2-1, j2 are the pixel values of the R channel of the pixel of the (j2)th row and the j2th column
- R i2+1, j2 is the pixel value of the R channel of the pixel of the j2th column of the (i2+1)th row
- G i2, j2 is the pixel value of the G channel of the pixel of the i2th row and the j2th column
- g i2-1 , j2 is the pixel value of the G channel of the pixel of the reconstructed (i2-1)th row j2 column
- g i2+1, j2 is the pixel of the G channel of the pixel of the reconstructed (i2+1)th row j2 column
- b i2, j2 is the pixel value of the B channel of the pixel of the
- reconstructing the pixel values of the R channel of the pixel corresponding to the B channel in the image is similar.
- D 45 (i3,j3)
- Calculate the 45 degree gradient of the pixel in the j3th column of the i3rd line, according to the formula D 135 (i3, j3)
- D 45 (i3, j3) is the 45 degree gradient of the pixel of the i3th row and the j3th column
- D 135 (i3, j3) is the 145 degree gradient of the pixel of the i3th row and the j3th column
- B i3-1, j3 +1 is the pixel value of the B channel of the pixel of the (j3+1)th column of the (i3-1)th row
- B i3+1, j3-1 is the (i3+1)th row (j3-1) column of the (i3+1)th row.
- the pixel value of the B channel of the pixel, g i3, j3 is the pixel value of the G channel of the pixel of the i3th row and the j3th column of the reconstruction, and g i3-1, j3+1 is the reconstructed (i3-1) line ( J3+1)
- the pixel value of the G channel of the pixel of the column, g i3+1, j3-1 is the pixel value of the G channel of the pixel of the (i3+1)th row (j3-1) column of the reconstruction
- B i3 -1, j3 -1 is the pixel value of the B channel of the pixel of the (i3-1)th row (j3-1) column
- B i3+1, j3+1 is the (i3+1)th row (j3+) 1
- the pixel value of the B channel of the column of pixels, g i3-1, j3-1 is the pixel value of the G channel of the pixel of the (i3
- Embodiments of the present invention provide a method and apparatus for acquiring RGB data, which can reduce false color and moiré, thereby improving visual quality of an image.
- An embodiment of the present invention provides an apparatus for acquiring red, green, and blue RGB data, including:
- Obtaining a module configured to acquire a first horizontal interpolation result and a first vertical interpolation result of pixels corresponding to a red R channel/blue B channel in the image; and acquire a level of a pixel corresponding to the R channel/B channel in the image Gradient and vertical gradients;
- a first reconstruction module configured to determine that an absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than a first preset threshold, according to the obtained first horizontal interpolation result and the first vertical difference result Weighted average reconstructed image pixel values of the green G channel of the pixel corresponding to the R channel/B channel;
- a second reconstruction module configured to reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image; and reconstructing an R channel corresponding to the pixel value of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image.
- the first reconstruction module is further configured to: when determining that an absolute value of a difference between the horizontal gradient and the vertical gradient is equal to 0, according to the first horizontal interpolation result and the first vertical difference The average of the results reconstructs the pixel values of the G channels of the pixels corresponding to the R channel/B channel in the image.
- the first reconstruction module is further configured to: when it is determined that an absolute value of a difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is smaller than the vertical gradient And reconstructing, according to the first horizontal interpolation result, a pixel value of a G channel of a pixel corresponding to the R channel/B channel in the image;
- the second reconstruction module is configured to acquire a second horizontal interpolation result or a second vertical interpolation result of the pixel corresponding to the G channel in the image, and reconstruct according to the second horizontal interpolation result or the second vertical interpolation result a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image;
- the second reconstruction module is configured to reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image;
- Determining that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than 0 and less than a second predetermined threshold, according to the 45-degree interpolation result and the weighted average reconstruction of the 135-degree interpolation result The pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- the second reconstruction module is further configured to: when determining that the absolute value of the difference between the 45 degree gradient and the 135 degree gradient is equal to 0, according to the 45 degree interpolation result and the 135 degree interpolation result
- the average value reconstructs the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- the second reconstruction module is further configured to: when it is determined that an absolute value of a difference between the 45 degree gradient and the 135 degree gradient is greater than the second preset threshold, and the 45 degree gradient is smaller than the a 135 degree gradient, reconstructing a pixel value of a B channel/R channel of a pixel corresponding to the R channel/B channel in the image according to the 45 degree interpolation result;
- the interpolation result reconstructs the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- the obtaining module is configured to obtain a first horizontal interpolation result and a first vertical interpolation result of the pixel corresponding to the red R channel/blue B channel in the image by:
- G i1, j1 are the first horizontal interpolation result
- g2 i1, j1 is the first vertical interpolation result
- G i1, j1-1 are the pixels of the G channel of the pixel of the (i1-1)th column (j1-1) column in the image.
- the value, G i1, j1+1 is the pixel value of the G channel of the pixel in the (i1+1)th column of the i1th row in the image
- a i1, j1 is the R channel/B of the pixel of the i1th row and the j1th column in the image.
- the pixel value of the channel, A i1, j1-2 is the pixel value of the R channel/B channel of the pixel of the (i1-2)th column in the i1th row of the image, and A i1, j1+2 is the i1th row of the image ( J1+2) the pixel value of the R channel/B channel of the pixel of the column; G i1-1, j1 is the pixel value of the G channel of the pixel of the (j1)th row and the j1th column of the image, G i1+1, J1 is the pixel value of the G channel of the pixel of the j1th column of the (i1+1)th row in the image, and A i1-2, j1 is the R channel/B channel of the pixel of the (j1)th row of the (i1-2)th row in the image.
- the pixel value, A i1+2, j1 is the pixel value of the R channel/B channel of the pixel of the j1th column of
- the acquiring module is configured to obtain a horizontal gradient and a vertical gradient of pixels corresponding to the R channel/B channel in the image by:
- ⁇ H1 i1, j1 is a horizontal gradient
- ⁇ H2 i1, and j1 is a vertical gradient
- the first reconstruction module is configured to implement, according to the obtained first horizontal interpolation result and the first vertical difference result, weighted average reconstructed pixels of the green channel of the pixel corresponding to the R channel/B channel in the image. value:
- the embodiment of the invention further provides a method for acquiring red, green and blue RGB data, comprising:
- the pixel value of the B channel of the pixel corresponding to the R channel in the image and the pixel value of the R channel of the pixel corresponding to the B channel in the image are reconstructed according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image.
- the method further includes: when it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is equal to 0,
- the method further includes:
- the pixel values of the R channel/B channel of the pixel corresponding to the G channel in the reconstructed image include:
- the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image reconstructed according to the pixel value of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image include:
- the determining, according to the pixel value of the pixel corresponding to the G channel in the image and the pixel value of the reconstructed G channel, the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image further includes: when determining When the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is equal to 0, the R channel/B in the image is reconstructed according to the 45-degree interpolation result and the average value of the 135-degree interpolation result The pixel value of the B channel/R channel of the pixel corresponding to the channel.
- the determining, according to the pixel value of the pixel corresponding to the G channel in the image and the pixel value of the reconstructed G channel, the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image further includes:
- the interpolation result reconstructs the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- obtaining a first horizontal interpolation result and a first vertical interpolation result of the pixel corresponding to the red R channel/blue B channel in the image including:
- G i1, j1 are the first horizontal interpolation result
- g2 i1, j1 is the first vertical interpolation result
- G i1, j1-1 are the pixels of the G channel of the pixel of the (i1-1)th column (j1-1) column in the image.
- the value, G i1, j1+1 is the pixel value of the G channel of the pixel in the (i1+1)th column of the i1th row in the image
- a i1, j1 is the R channel/B of the pixel of the i1th row and the j1th column in the image.
- the pixel value of the channel, A i1, j1-2 is the pixel value of the R channel/B channel of the pixel of the (i1-2)th column in the i1th row of the image, and A i1, j1+2 is the i1th row of the image ( J1+2) the pixel value of the R channel/B channel of the pixel of the column; G i1-1, j1 is the pixel value of the G channel of the pixel of the (j1)th row and the j1th column of the image, G i1+1, J1 is the pixel value of the G channel of the pixel of the j1th column of the (i1+1)th row in the image, and A i1-2, j1 is the R channel/B channel of the pixel of the (j1)th row of the (i1-2)th row in the image.
- the pixel value, A i1+2, j1 is the pixel value of the R channel/B channel of the pixel of the j1th column of
- Obtaining the horizontal and vertical gradients of the pixels corresponding to the R channel/B channel in the image includes:
- ⁇ H1 i1, j1 is a horizontal gradient
- ⁇ H2 i1, and j1 is a vertical gradient
- the pixel value of the G channel of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the obtained first horizontal interpolation result and the weighted average of the first vertical difference result, including:
- the technical solution of the embodiment of the present invention includes: acquiring a first horizontal interpolation result and a first vertical interpolation result of pixels corresponding to the R channel/B channel in the image; and acquiring pixels corresponding to the R channel/B channel in the image.
- the pixel value of the reconstructed G channel reconstructs the pixel value of the B channel of the pixel corresponding to the R channel in the image, and the pixel value of the R channel of the pixel corresponding to the B channel in the image.
- the weighted average reconstructs the pixel values of the G channel of the pixel corresponding to the R channel or the B channel in the image, reducing the pseudo color and moiré, thereby improving the visual quality of the image.
- FIG. 1 is a schematic structural diagram of hardware of a mobile terminal that implements various embodiments of the present invention
- FIG. 2 is a schematic diagram of a wireless communication system of the mobile terminal shown in FIG. 1;
- FIG. 3 is a flowchart of a method for acquiring RGB data according to an embodiment of the present invention.
- FIG. 4 is a schematic diagram of an image according to an embodiment of the present invention.
- FIG. 5 is a schematic structural diagram of an apparatus for acquiring RGB data according to an embodiment of the present invention.
- the mobile terminal can be implemented in various forms.
- the terminal described in the embodiments of the present invention may include, for example, a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet), a PMP (Portable Multimedia Player), a navigation device Mobile terminals of the like and fixed terminals such as digital TVs, desktop computers, and the like.
- PDA Personal Digital Assistant
- PAD Tablett
- PMP Portable Multimedia Player
- FIG. 1 is a schematic diagram showing the hardware structure of a mobile terminal embodying various embodiments of the present invention.
- the mobile terminal 100 may include a wireless communication unit 110, an A/V (Audio/Video) input unit 120, The user input unit 130, the sensing unit 140, the output unit 150, the memory 160, the interface unit 170, the controller 180, the power supply unit 190, and the like.
- Figure 1 illustrates a mobile terminal having various components, but it should be understood that not all illustrated components are required to be implemented. More or fewer components can be implemented instead. The elements of the mobile terminal will be described in detail below.
- Wireless communication unit 110 typically includes one or more components that permit radio communication between mobile terminal 100 and a wireless communication system or network.
- the wireless communication unit may include at least one of a broadcast receiving module 111, a mobile communication module 112, a wireless internet module 113, a short-range communication module 114, and a location information module 115.
- the broadcast receiving module 111 receives a broadcast signal and/or broadcast associated information from an external broadcast management server via a broadcast channel.
- the broadcast channel can include a satellite channel and/or a terrestrial channel.
- the broadcast management server may be a server that generates and transmits a broadcast signal and/or broadcast associated information or a server that receives a previously generated broadcast signal and/or broadcast associated information and transmits it to the terminal.
- the broadcast signal may include a TV broadcast signal, a radio broadcast signal, a data broadcast signal, and the like.
- the broadcast signal may further include a broadcast signal combined with a TV or radio broadcast signal.
- the broadcast associated information may also be provided via a mobile communication network, and in this case, the broadcast associated information may be received by the mobile communication module 112.
- the broadcast signal may exist in various forms, for example, it may exist in the form of Digital Multimedia Broadcasting (DMB) Electronic Program Guide (EPG), Digital Video Broadcasting Handheld (DVB-H) Electronic Service Guide (ESG), and the like.
- the broadcast receiving module 111 can receive a signal broadcast by using various types of broadcast systems.
- the broadcast receiving module 111 can use forward link media (MediaFLO) by using, for example, multimedia broadcast-terrestrial (DMB-T), digital multimedia broadcast-satellite (DMB-S), digital video broadcast-handheld (DVB-H)
- MediaFLO forward link media
- the digital broadcasting system of the @) data broadcasting system, the terrestrial digital broadcasting integrated service (ISDB-T), and the like receives digital broadcasting.
- the broadcast receiving module 111 can be constructed as various broadcast systems suitable for providing broadcast signals as well as the above-described digital broadcast system.
- the broadcast signal and/or broadcast associated information received via the broadcast receiving module 111 may be stored in the memory 160 (or other type of storage
- the mobile communication module 112 transmits the radio signals to and/or receives radio signals from at least one of a base station (e.g., an access point, a Node B, etc.), an external terminal, and a server.
- a base station e.g., an access point, a Node B, etc.
- Such radio signals may include voice call signals, video call signals, or various types of data transmitted and/or received in accordance with text and/or multimedia messages.
- the wireless internet module 113 supports wireless internet access of the mobile terminal.
- the module can be internally or externally coupled to the terminal.
- the wireless Internet access technologies involved in the module may include WLAN (Wireless LAN) (Wi-Fi), Wibro (Wireless Broadband), Wimax (Worldwide Interoperability for Microwave Access), HSDPA (High Speed Downlink Packet Access), etc. .
- the short range communication module 114 is a module that is configured to support short range communication.
- Some examples of short-range communication technology include Bluetooth TM, a radio frequency identification (RFID), infrared data association (IrDA), ultra wideband (UWB), ZigBee, etc. TM.
- the location information module 115 is a module configured to check or acquire location information of the mobile terminal.
- a typical example of a location information module is GPS (Global Positioning System).
- GPS Global Positioning System
- the GPS module 115 calculates distance information and accurate time information from three or more satellites and applies triangulation to the calculated information to accurately calculate three-dimensional current position information based on longitude, latitude, and altitude.
- the method for calculating position and time information uses three satellites and corrects the calculated position and time information errors by using another satellite.
- the GPS module 115 is capable of calculating speed information by continuously calculating current position information in real time.
- the A/V input unit 120 is arranged to receive an audio or video signal.
- the A/V input unit 120 may include a camera 121 and a microphone 1220 that processes image data of still pictures or video obtained by the image capturing device in a video capturing mode or an image capturing mode.
- the processed image frame can be displayed on the display unit 151.
- the image frames processed by the camera 121 may be stored in the memory 160 (or other storage medium) or transmitted via the wireless communication unit 110, and two or more cameras 1210 may be provided according to the configuration of the mobile terminal.
- the microphone 122 can receive sound (audio data) via a microphone in an operation mode of a telephone call mode, a recording mode, a voice recognition mode, and the like, and can process such sound as audio data.
- the processed audio (voice) data can be converted to a format output that can be transmitted to the mobile communication base station via the mobile communication module 112 in the case of a telephone call mode.
- the microphone 122 can implement various types of noise cancellation (or suppression) algorithms to cancel (or suppress) noise or interference generated during the process of receiving and transmitting audio signals.
- the user input unit 130 may generate key input data according to a command input by the user to control various operations of the mobile terminal.
- the user input unit 130 allows the user to input various types of information, and may include a keyboard, a pot, a touch pad (eg, a touch sensitive component that detects changes in resistance, pressure, capacitance, etc. due to contact), a scroll wheel , rocker, etc.
- a touch pad eg, a touch sensitive component that detects changes in resistance, pressure, capacitance, etc. due to contact
- a scroll wheel e.g, a scroll wheel, rocker, etc.
- a touch screen can be formed.
- the sensing unit 140 detects the current state of the mobile terminal 100 (eg, the open or closed state of the mobile terminal 100), the location of the mobile terminal 100, the presence or absence of contact (ie, touch input) by the user with the mobile terminal 100, and the mobile terminal.
- the sensing unit 140 can sense whether the slide type phone is turned on or off.
- the sensing unit 140 can detect whether the power supply unit 190 provides power or whether the interface unit 170 is coupled to an external device.
- Sensing unit 140 may include proximity sensor 1410 which will be described below in connection with a touch screen.
- the interface unit 170 serves as an interface through which at least one external device can connect with the mobile terminal 100.
- the external device may include a wired or wireless headset port, an external power (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, and an audio input/output. (I/O) port, video I/O port, headphone port, and more.
- the identification module may be stored to verify various information used by the user using the mobile terminal 100 and may include a User Identification Module (UIM), a Customer Identification Module (SIM), a Universal Customer Identity Module (USIM), and the like.
- the device having the identification module may take the form of a smart card, and thus the identification device may be connected to the mobile terminal 100 via a port or other connection device.
- the interface unit 170 may be arranged to receive input from an external device (eg, data information, power, etc.) and transmit the received input to one or more components within the mobile terminal 100 or may be used at the mobile terminal and external device Transfer data between.
- the interface unit 170 may function as a path through which power is supplied from the base to the mobile terminal 100 or may be used as a transmission of various command signals allowing input from the base to the mobile terminal 100 The path to the terminal.
- Various command signals or power input from the base can be used as signals for identifying whether the mobile terminal is accurately mounted on the base.
- Output unit 150 is configured to provide an output signal (eg, an audio signal, a video signal, an alarm signal, a vibration signal, etc.) in a visual, audio, and/or tactile manner.
- the output unit 150 may include a display unit 151, an audio output module 152, an alarm unit 153, and the like.
- the display unit 151 can display information processed in the mobile terminal 100. For example, when the mobile terminal 100 is in the phone call mode, the display unit 151 can display a call or other communication (eg, text) This messaging, multimedia file download, etc.) related user interface (UI) or graphical user interface (GUI). When the mobile terminal 100 is in a video call mode or an image capturing mode, the display unit 151 may display a captured image and/or a received image, a UI or GUI showing a video or image and related functions, and the like.
- UI user interface
- GUI graphical user interface
- the display unit 151 can function as an input device and an output device.
- the display unit 151 may include at least one of a liquid crystal display (LCD), a thin film transistor LCD (TFT-LCD), an organic light emitting diode (OLED) display, a flexible display, a three-dimensional (3D) display, and the like.
- LCD liquid crystal display
- TFT-LCD thin film transistor LCD
- OLED organic light emitting diode
- a flexible display a three-dimensional (3D) display, and the like.
- 3D three-dimensional
- Some of these displays may be configured to be transparent to allow a user to view from the outside, which may be referred to as a transparent display, and a typical transparent display may be, for example, a TOLED (Transparent Organic Light Emitting Diode) display or the like.
- TOLED Transparent Organic Light Emitting Diode
- the mobile terminal 100 may include two or more display units (or other display devices), for example, the mobile terminal may include an external display unit (not shown) and an internal display unit (not shown) .
- the touch screen can be set to detect touch input pressure as well as touch input position and touch input area.
- the audio output module 152 may convert audio data received by the wireless communication unit 110 or stored in the memory 160 when the mobile terminal is in a call signal receiving mode, a call mode, a recording mode, a voice recognition mode, a broadcast receiving mode, and the like.
- the audio signal is output as sound.
- the audio output module 152 can provide audio output (eg, call signal reception sound, message reception sound, etc.) associated with a particular function performed by the mobile terminal 100.
- the audio output module 152 can include a speaker, a buzzer, and the like.
- the alarm unit 153 can provide an output to notify the mobile terminal 100 of the occurrence of an event. Typical events may include call reception, message reception, key signal input, touch input, and the like. In addition to audio or video output, the alert unit 153 can provide an output in a different manner to notify of the occurrence of an event. For example, the alarm unit 153 can provide an output in the form of vibrations, and when a call, message, or some other incoming communication is received, the alarm unit 153 can provide a tactile output (ie, vibration) to notify the user of it. By providing such a tactile output, the user is able to recognize the occurrence of various events even when the user's mobile phone is in the user's pocket. The alarm unit 153 can also provide an output of the notification event occurrence via the display unit 151 or the audio output module 152.
- the memory 160 may store a software program or the like that performs processing and control operations performed by the controller 180, or may temporarily store data that has been output or is to be output (for example, a phone book, a message, Still images, videos, etc.). Moreover, the memory 160 can store data regarding vibrations and audio signals of various manners that are output when a touch is applied to the touch screen.
- the memory 160 may include at least one type of storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), a random access memory (RAM), a static random access memory ( SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like.
- the mobile terminal 100 can cooperate with a network storage device that performs a storage function of the memory 160 through a network connection.
- the controller 180 typically controls the overall operation of the mobile terminal. For example, the controller 180 performs the control and processing associated with voice calls, data communications, video calls, and the like. Additionally, the controller 180 can include a multimedia module 1810 that is configured to reproduce (or play back) multimedia data, and the multimedia module 1810 can be constructed within the controller 180 or can be configured to be separate from the controller 180. The controller 180 may perform a pattern recognition process to recognize a handwriting input or a picture drawing input performed on the touch screen as a character or an image.
- the power supply unit 190 receives external power or internal power under the control of the controller 180 and provides appropriate power required to operate the various components and components.
- the various embodiments described herein can be implemented in a computer readable medium using, for example, computer software, hardware, or any combination thereof.
- the embodiments described herein may be through the use of application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays ( An FPGA, a processor, a controller, a microcontroller, a microprocessor, at least one of the electronic units designed to perform the functions described herein, in some cases, such an embodiment may be at the controller 180 Implemented in the middle.
- implementations such as procedures or functions may be implemented with separate software modules that permit the execution of at least one function or operation.
- the software code can be implemented by a software application (or program) written in any suitable programming language, which can be stored in memory 160 and executed by
- the mobile terminal has been described in terms of its function.
- a slide type mobile terminal among various types of mobile terminals such as a folding type, a bar type, a swing type, a slide type mobile terminal, and the like will be described as an example. Therefore, embodiments of the present invention can be applied to any type of Mobile terminal, and is not limited to a slide type mobile terminal.
- the mobile terminal 100 as shown in FIG. 1 may be configured to operate using a communication system such as a wired and wireless communication system and a satellite-based communication system that transmits data via frames or packets.
- a communication system such as a wired and wireless communication system and a satellite-based communication system that transmits data via frames or packets.
- a communication system in which a mobile terminal is operable according to an embodiment of the present invention will now be described with reference to FIG.
- Such communication systems may use different air interfaces and/or physical layers.
- air interfaces used by communication systems include, for example, Frequency Division Multiple Access (FDMA), Time Division Multiple Access (TDMA), Code Division Multiple Access (CDMA), and Universal Mobile Telecommunications System (UMTS) (in particular, Long Term Evolution (LTE)). ), Global System for Mobile Communications (GSM), etc.
- FDMA Frequency Division Multiple Access
- TDMA Time Division Multiple Access
- CDMA Code Division Multiple Access
- UMTS Universal Mobile Telecommunications System
- LTE Long Term Evolution
- GSM Global System for Mobile Communications
- the following description relates to a CDMA communication system, but such teachings are equally applicable to other types of systems.
- a CDMA wireless communication system can include a plurality of mobile terminals 100, a plurality of base stations (BS) 270, a base station controller (BSC) 275, and a mobile switching center (MSC) 280.
- the MSC 280 is configured to interface with a public switched telephone network (PSTN) 290.
- PSTN public switched telephone network
- the MSC 280 is also configured to interface with a BSC 275 that can be coupled to the base station 270 via a backhaul line.
- the backhaul line can be constructed in accordance with any of a number of well known interfaces including, for example, E1/T1, ATM, IP, PPP, Frame Relay, HDSL, ADSL, or xDSL. It will be appreciated that the system as shown in FIG. 2 may include multiple BSC 2750s.
- Each BS 270 can serve one or more partitions (or regions), each of which is covered by a multi-directional antenna or an antenna directed to a particular direction radially away from the BS 270. Alternatively, each partition may be covered by two or more antennas that are set to receive diversity. Each BS 270 can be configured to support multiple frequency allocations, and each frequency allocation has a particular frequency spectrum (eg, 1.25 MHz, 5 MHz, etc.).
- BS 270 may also be referred to as a Base Transceiver Subsystem (BTS) or other equivalent terminology.
- BTS Base Transceiver Subsystem
- the term "base station” can be used to generally refer to a single BSC 275 and at least one BS 270.
- a base station can also be referred to as a "cell station.”
- each partition of a particular BS 270 may be referred to as a plurality of cellular stations.
- a broadcast transmitter (BT) 295 transmits a broadcast signal to the mobile terminal 100 operating within the system.
- a broadcast receiving module 111 as shown in FIG. 1 is provided at the mobile terminal 100 to receive a broadcast signal transmitted by the BT 295.
- GPS Global Positioning System
- the satellite 300 helps locate at least one of the plurality of mobile terminals 100.
- a plurality of satellites 300 are depicted, but it is understood that useful positioning information can be obtained using any number of satellites.
- the GPS module 115 as shown in Figure 1 is typically configured to cooperate with the satellite 300 to obtain desired positioning information. Instead of GPS tracking technology or in addition to GPS tracking technology, other techniques that can track the location of the mobile terminal can be used. Additionally, at least one GPS satellite 300 can selectively or additionally process satellite DMB transmissions.
- BS 270 receives reverse link signals from various mobile terminals 100.
- Mobile terminal 100 typically participates in calls, messaging, and other types of communications.
- Each reverse link signal received by a particular base station 270 is processed within a particular BS 270.
- the obtained data is forwarded to the relevant BSC 275.
- the BSC provides call resource allocation and coordinated mobility management functions including a soft handoff procedure between the BSs 270.
- the BSC 275 also routes the received data to the MSC 280, which provides additional routing services for interfacing with the PSTN 290.
- PSTN 290 interfaces with MSC 280, which forms an interface with BSC 275, and BSC 275 controls BS 270 accordingly to transmit forward link signals to mobile terminal 100.
- a first embodiment of the present invention provides a method for acquiring RGB data, including:
- Step 300 Acquire a first horizontal interpolation result of the pixel corresponding to the R channel/B channel in the image and a first vertical interpolation result; and obtain a horizontal gradient and a vertical gradient of the pixel corresponding to the R channel/B channel in the image.
- "/" means replaceable, that is, the process of reconstructing the pixel value of the G channel of the pixel corresponding to the R channel in the reconstructed image and the pixel value of the G channel of the pixel corresponding to the B channel in the reconstructed image are the same.
- FIG. 4 is a schematic illustration of an image. As shown in FIG. 4, the format of the odd lines in the image is RGRG..., and the format of the even lines is GBGB. FIG. 4 is only a schematic diagram of an image, and does not represent the format of an image that can be processed by the embodiment of the present invention. Any image in the bayer format can be interpolated by the method of the embodiment of the present invention.
- the first horizontal interpolation result of the pixel corresponding to the R channel/B channel in the image is obtained.
- the first vertical interpolation result includes:
- G i1, j1 are the first horizontal interpolation result
- g2 i1, j1 is the first vertical interpolation result
- G i1, j1-1 are the pixels of the G channel of the pixel of the (i1-1)th column (j1-1) column in the image.
- the value, G i1, j1+1 is the pixel value of the G channel of the pixel in the (i1+1)th column of the i1th row in the image
- a i1, j1 is the R channel/B of the pixel of the i1th row and the j1th column in the image.
- the pixel value of the channel, A i1, j1-2 is the pixel value of the R channel/B channel of the pixel of the (i1-2)th column in the i1th row of the image, and A i1, j1+2 is the i1th row of the image ( J1+2) the pixel value of the R channel/B channel of the pixel of the column; G i1-1, j1 is the pixel value of the G channel of the pixel of the (j1)th row and the j1th column of the image, G i1+1, J1 is the pixel value of the G channel of the pixel of the j1th column of the (i1+1)th row in the image, and A i1-2, j1 is the R channel/B channel of the pixel of the (j1)th row of the (i1-2)th row in the image.
- the pixel value, A i1+2, j1 is the pixel value of the R channel/B channel of the pixel of the j1th column of
- obtaining horizontal and vertical gradients of pixels corresponding to the R channel/B channel in the image includes:
- ⁇ H1 i1, j1 is a horizontal gradient
- ⁇ H2 i1, and j1 is a vertical gradient
- Step 301 Determine that the absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than the first preset threshold, and reconstruct the image according to the obtained first horizontal interpolation result and the weighted average of the first vertical difference result.
- the pixel values of the G channel of the pixel corresponding to the R channel/B channel in the weighted average reconstructed image according to the obtained first horizontal interpolation result and the first vertical difference result include:
- g i1, j1 is the pixel value of the reconstructed G channel of the pixel corresponding to the R channel/B channel in the image.
- the R channel/B channel corresponding to the image is reconstructed according to the average of the first horizontal interpolation result and the first vertical difference result.
- the pixel values of the G channel of the pixel corresponding to the R channel/B channel in the image are reconstructed according to the average of the first horizontal interpolation result and the first vertical difference result, including:
- the R channel/B channel corresponding to the image is reconstructed according to the first horizontal interpolation result.
- the R channel/B channel corresponding to the image is reconstructed according to the first vertical interpolation result.
- the horizontal gradient and the vertical gradient are not much different, for example, the horizontal gradient is 10, and the vertical gradient is 13, at this time, if the two gradients can be accurately determined to be absolutely accurate, the gradient can be small.
- the interpolation result in the direction ie, the edge direction
- the problem now is that, due to other factors such as noise (main factor, noise is always present), if the calculated edge direction interpolation result is still used as the final result, the interpolation result cannot be guaranteed, so the result will be in the picture.
- Step 302 reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image.
- This step can be performed before or after any step, and is not affected by the order of execution of the other steps.
- the pixel values of the R channel/B channel of the pixel corresponding to the G channel in the reconstructed image include:
- the second horizontal interpolation result or the second vertical interpolation result of the pixel corresponding to the G channel in the image is:
- a1 i2, j2 is the second horizontal interpolation result
- a2 i2, j2 is the second vertical interpolation result
- a i2-1, j2 is the R channel/B of the pixel of the (j2-1)th row j2 column in the image.
- the pixel value of the channel, A i2+1, j2 is the pixel value of the R channel/B channel of the pixel of the ( j2 +1)th row and the j2th column in the image
- G i2, j2 is the i2th row and the j2th column in the image.
- the pixel value of the G channel of the pixel, G i2-2, j2 is the pixel value of the G channel of the pixel of the (j2-2)th row and the j2th column in the image
- G i2+2, j2 is the image (i2+2)
- the pixel value of the G channel of the pixel of the j2th column, A i2, j2-1 is the pixel value of the R channel/B channel of the pixel of the (i2-1)th column of the i2th row in the image
- a i2, j2+ 1 is the pixel value of the R channel/B channel of the pixel of the (i2th)th column of the i2th row in the image
- G i2, j2-2 is the G channel of the pixel of the (i2th)th column of the i2th row in the image.
- the pixel value, G i2, j2+2 is the pixel value of the G channel of the pixel of the (i2+2)th
- Step 303 reconstruct, according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, the pixel value of the B channel of the pixel corresponding to the R channel in the image, and the pixel of the R channel of the pixel corresponding to the B channel in the image. value.
- the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image are reconstructed according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, including:
- the 45-degree interpolation result and the 135-degree interpolation result of the pixel corresponding to the R channel/B channel in the image are calculated according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, and the 135 degree interpolation result includes:
- a1 i3, j3 are 45-degree interpolation results
- a2 i3, j3 are 135-degree interpolation results
- a i3-1, j3+1 are pixels of the (i3-1)th row (j3+1) column in the image.
- the pixel value of the R channel/B channel, A i3+1, j3 -1 is the pixel value of the R channel/B channel of the pixel of the (i3+1)th row (j3-1) column in the image, g i3, j3
- the pixel value of the reconstructed G channel of the pixel of the i3th row and the j3th column in the image, g i3-1, j3+1 is the reconstructed pixel of the (j3+1)th column of the (i3-1)th row in the image.
- the pixel value of the G channel, g i3+1, j3-1 is the pixel value of the reconstructed G channel of the pixel of the (i3+1)th row (j3-1) column in the image, A i3-1, j3-1
- the pixel value of the R channel/B channel of the pixel in the (j3-1)th column of the (i3-1)th line in the image, A i3+1, j3+1 is the (i3+1)th row in the image (j3 +1) the pixel value of the R channel/B channel of the pixel of the column
- g i3-1, j3-1 is the pixel of the reconstructed G channel of the pixel of the (i3-1)th row (j3-1) column in the image
- the value, g i3+1, j3+1 is the pixel value of the reconstructed G channel of the pixel of the (j3+1)th column of the (i3+1)th row in the image.
- calculating a 45 degree gradient and a 135 degree gradient of the pixel corresponding to the B channel/R channel in the image include:
- D 45 (i3, j3) is a 45 degree gradient
- D 135 (i3, j3) is a 135 degree gradient
- C i3, j3 are the pixel values of the B channel/R channel of the pixel of the i3th row and the j3th column in the image.
- the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the weighted average reconstructed image according to the 45 degree interpolation result and the 135 degree interpolation result include:
- a i3, j3 are the pixel values of the reconstructed B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- the B of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the average of the 45-degree interpolation result and the 135-degree interpolation result.
- the pixel value of the channel/R channel is reconstructed according to the average of the 45-degree interpolation result and the 135-degree interpolation result.
- the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image are reconstructed according to the 45-degree interpolation result and the average value of the 135-degree interpolation result, including:
- the R channel in the image is reconstructed according to the 45 degree interpolation result
- the corresponding R channel/B channel in the image is reconstructed according to the 135-degree interpolation result.
- step 302 "/" means replaceable, that is, the process of reconstructing the pixel value of the B channel of the pixel corresponding to the R channel in the image, and the pixel value of the R channel of the pixel corresponding to the B channel in the image is similar. .
- the gradient between the 45-degree gradient and the 135-degree gradient is not large, for example, the gradient of 45 degrees is 10, and the gradient of 135 degrees is 13, if the two gradients can be accurately determined, it is absolutely accurate.
- the interpolation result in the direction in which the gradient is small ie, the edge direction
- the edge direction can be used as the final interpolation result, so that the interpolation result is the most accurate.
- the edge direction can be accurately determined at this time, and the interpolation result of the edge direction can be used as the final result, and if the interpolation result of the two directions is still used for the weighted average, Decreased image quality (as well as experimental results), so gradients are used when the gradients are very different (I.e., the edge direction) as a result of the final interpolation result.
- the weighted average reconstructs the pixel values of the G channel of the pixel corresponding to the R channel or the B channel in the image, reducing the pseudo color and moiré, thereby improving the visual quality of the image.
- a second embodiment of the present invention further provides an apparatus for acquiring RGB data, including:
- Obtaining a module configured to acquire a first horizontal interpolation result and a first vertical interpolation result of pixels corresponding to the R channel/B channel in the image; and obtain a horizontal gradient of the pixel corresponding to the R channel/B channel in the image And vertical gradients;
- a first reconstruction module configured to determine that an absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than a first preset threshold, according to the obtained first horizontal interpolation result and the first vertical difference result Weighted average reconstructed image pixel values of G channels of pixels corresponding to R channels/B channels;
- a second reconstruction module configured to reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image; and reconstructing an R channel corresponding to the pixel value of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image.
- the first reconstruction module is further configured to:
- the G channel of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the average of the first horizontal interpolation result and the first vertical difference result The pixel value.
- the first reconstruction module is further configured to:
- the first reconstruction module is further configured to:
- the second reconstruction module is configured to:
- the pixel value of the B channel of the pixel corresponding to the R channel in the image and the pixel value of the R channel of the pixel corresponding to the B channel in the image are reconstructed according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image.
- the second reconstruction module is configured to:
- Determining that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than 0 and less than the second predetermined threshold, and corresponding to the R channel/B channel in the weighted average reconstructed image according to the 45-degree interpolation result and the 135-degree interpolation result The pixel value of the B channel/R channel of the pixel.
- the second reconstruction module is further configured to:
- the B channel of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the 45-degree interpolation result and the average value of the 135-degree interpolation result.
- the pixel value of the R channel is reconstructed according to the 45-degree interpolation result and the average value of the 135-degree interpolation result.
- the second reconstruction module is further configured to:
- the corresponding R channel/B channel in the image is reconstructed according to the 45-degree interpolation result.
- the second reconstruction module is further configured to:
- the corresponding R channel/B channel in the image is reconstructed according to the 135-degree interpolation result.
- the acquisition module, the first reconstruction module, and the second reconstruction module may all be disposed in the controller of FIG. 1.
- the above technical solution reduces false color and moiré, thereby improving the visual quality of the image.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Color Television Image Signal Generators (AREA)
Abstract
A method and device for acquiring RGB data. The device comprises: an acquisition module, configured to acquire a first horizontal interpolation result and a first vertical interpolation result of pixels corresponding to an R channel/B channel in an image and acquire a horizontal gradient and a vertical gradient of the pixels corresponding to the R channel/B channel in the image; a first reconstruction module, configured to determine that the absolute value of a difference between the acquired horizontal gradient and vertical gradient is greater than 0 and less than a first pre-set threshold and reconstruct a pixel value of a green G channel of the pixels corresponding to the R channel/B channel in the image according to a weighted mean of the acquired first horizontal interpolation result and first vertical interpolation result; and a second reconstruction module, configured to reconstruct a pixel value of the R channel/B channel of the pixels corresponding to the G channel in the image and reconstruct a pixel value of the B channel of the pixels corresponding to the R channel in the image and a pixel value of the R channel of the pixels corresponding to the B channel in the image according to the reconstructed pixel value of the G channel of the pixels corresponding to the R channel and the B channel in the image.
Description
本文涉及但不限于图像处理技术,尤指一种获取红绿蓝(RGB,Red Green Blue)数据的方法和装置。This document relates to, but is not limited to, image processing technology, and more particularly to a method and apparatus for acquiring data of RGB (Red Green Blue).
现有大部分图像传感器如互补金属氧化物半导体(CMOS,Complementary Metal Oxide Semiconductor),在获取图像的过程中,每个像素只有RGB三个通道数据中的一个,因此,需要对图像进行去马赛克,即利用插值的方法得到缺失的数据,从而得到完整的RGB数据。Most of the existing image sensors, such as Complementary Metal Oxide Semiconductor (CMOS), in the process of acquiring images, each pixel has only one of RGB three channel data, therefore, the image needs to be demosaiced. That is, the missing data is obtained by interpolation, thereby obtaining complete RGB data.
相关的获取RGB数据的方法大致包括:Related methods for obtaining RGB data generally include:
首先,重建图像中R通道和B通道对应的像素的G通道的像素值。以重建图像中R通道对应的像素的G通道的像素值进行说明,重建图像中B通道对应的像素的G通道的像素值的过程类似。按照公式ΔVi1,j1=|Gi1-1,j1-Gi1+1,j1|+|2Ri1,j1-Ri1-2,j1-Ri1+2,j1|计算第i1行第j1列的像素的水平梯度,按照公式ΔHi1,j1=|Gi1,j1-1-Gi1,j1+1|+|2Ri1,j1-Ri1,j1-2-Ri1,j1+2|计算第i1行第j1列的像素的垂直梯度;当ΔHi1,j1<ΔVi1,j1时,按照公式重建第i1行第j1列的像素的G通道的像素值;当ΔHi1,j1>ΔVi1,j1时,按照公式重建第i1行第j1列的像素的G通道的像素值;当ΔHi1,j1=ΔVi1,j1时,按照公式重建第i1行第j1列的像素的G通道的像素值。First, the pixel values of the G channels of the pixels corresponding to the R channel and the B channel in the image are reconstructed. The process of reconstructing the pixel value of the G channel of the pixel corresponding to the R channel in the image is similar, and the process of reconstructing the pixel value of the G channel of the pixel corresponding to the B channel in the image is similar. Calculate the j1th column of the i1th row according to the formula ΔV i1,j1 =|G i1-1,j1 -G i1+1,j1 |+|2R i1,j1 -R i1-2,j1 -R i1+2,j1 | The horizontal gradient of the pixel is calculated according to the formula ΔH i1,j1 =|G i1,j1-1 -G i1,j1+1 |+|2R i1,j1 -R i1,j1-2 -R i1,j1+2 | The vertical gradient of the pixel in the j1th column of the i1th row; when ΔH i1,j1 <ΔV i1,j1 , according to the formula Reconstructing the pixel value of the G channel of the pixel in the j1th column of the i1th row; when ΔH i1,j1 >ΔV i1,j1 , according to the formula Reconstructing the pixel value of the G channel of the pixel in the j1th column of the i1th row; when ΔH i1,j1 =ΔV i1,j1 , according to the formula The pixel value of the G channel of the pixel of the j1th column of the i1th row is reconstructed.
其中,ΔHi1,j1为第i1行第j1列的像素的垂直梯度,ΔVi1,j1为第i1行第j1列的像素的水平梯度,Gi1,j1-1为第i1行第(j1-1)列的像素的G通道的
像素值,Gi1,j1+1为第i1行第(j1+1)列的像素的G通道的像素值,Ri1,j1为第i1行第j1列的像素的R通道的像素值,Ri1,j1-2为第i1行第(j1-2)列的像素的R通道的像素值,Ri1,j1+2为第i1行第(j1+2)列的像素的R通道的像素值,Gi1-1,j1为第(i1-1)行第j1列的像素的G通道的像素值,Gi1+1,j1为第(i1+1)行第j1列的像素的G通道的像素值,Ri1-2,j1为第(i1-2)行第j1列的像素的R通道的像素值,Ri1+2,j1为第(i1+2)行第j1列的像素的G通道的像素值,gi1,j1为重建的第i1行第j1列的像素的G通道的像素值。Where ΔH i1,j1 is the vertical gradient of the pixel in the j1th column of the i1th row, ΔV i1, j1 is the horizontal gradient of the pixel in the j1th column of the i1th row, and G i1, j1-1 is the i1th row (j1) 1) The pixel value of the G channel of the pixel of the column, G i1, j1+1 is the pixel value of the G channel of the pixel of the (i1+1)th column of the i1th row, and R i1, j1 is the j1 column of the i1th row The pixel value of the R channel of the pixel, R i1, j1-2 is the pixel value of the R channel of the pixel of the (i1-2)th column of the i1th row, and R i1, j1+2 is the i1th row (j1+2) The pixel value of the R channel of the pixel of the column, G i1-1, j1 is the pixel value of the G channel of the pixel of the j1th column of the (i1-1)th row, and G i1+1, j1 is the (i1+1)th row The pixel value of the G channel of the pixel of the j1th column, R i1-2, j1 is the pixel value of the R channel of the pixel of the (j1)th row of the (i1-2)th row, and R i1+2, j1 is the (i1+2) The pixel value of the G channel of the pixel in the j1th column, g i1, j1 is the pixel value of the G channel of the pixel of the reconstructed i1th row and j1th column.
其次,重建图像中G通道对应的像素的R通道和G通道对应的像素的B通道的像素值。可选地,按照公式重建第i2行第j2列的像素的R通道的像素值;按照公式重建第i2行第j2列的像素的B通道的像素值。Next, the pixel values of the R channel of the pixel corresponding to the G channel and the B channel of the pixel corresponding to the G channel in the image are reconstructed. Optionally, according to the formula Reconstructing the pixel value of the R channel of the pixel of the i2th row and the j2th column; The pixel value of the B channel of the pixel of the i2th row and the j2th column is reconstructed.
其中,ri2,j2为重建的第i2行第j2列的像素的R通道的像素值,Ri2-1,j2为第(i2-1)行第j2列的像素的R通道的像素值,Ri2+1,j2为第(i2+1)行第j2列的像素的R通道的像素值,Gi2,j2为第i2行第j2列的像素的G通道的像素值,gi2-1,j2为重建的第(i2-1)行第j2列的像素的G通道的像素值,gi2+1,
j2为重建的第(i2+1)行第j2列的像素的G通道的像素值,bi2,j2为重建的第i2行第j2列的像素的B通道的像素值,Bi2,j2-1为第i2行第(j2-1)列的像素的B通道的像素值,Bi2,j2+1为第i2行第(j2+1)列的像素的B通道的像素值,gi2,j2-1为重建的第i2行第(j2-1)列的像素的G通道的像素值,gi2,j2+1为重建的第i2行第(j2+1)列的像素的G通道的像素值。Where r i2, j2 are the pixel values of the R channel of the pixel of the reconstructed i2 row and j2 column, and R i2-1, j2 are the pixel values of the R channel of the pixel of the (j2)th row and the j2th column, R i2+1, j2 is the pixel value of the R channel of the pixel of the j2th column of the (i2+1)th row, and G i2, j2 is the pixel value of the G channel of the pixel of the i2th row and the j2th column, g i2-1 , j2 is the pixel value of the G channel of the pixel of the reconstructed (i2-1)th row j2 column, g i2+1, j2 is the pixel of the G channel of the pixel of the reconstructed (i2+1)th row j2 column The value, b i2, j2 is the pixel value of the B channel of the pixel of the reconstructed i2th row and the j2th column, and B i2, j2-1 is the pixel value of the B channel of the pixel of the (i2-1)th column of the i2th row, B i2, j2+1 is the pixel value of the B channel of the pixel of the (i2th)th (j2+1)th column, and g i2, j2-1 is the G channel of the pixel of the reconstructed i2th row (j2-1) column The pixel value, g i2, j2+1 is the pixel value of the G channel of the pixel of the reconstructed i2th row (j2+1) column.
最后,重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值;可选地,以重建图像中R通道对应的像素的B通道的像素值为例进行说明,重建图像中B通道对应的像素的R通道的像素值的过程类似。按照公式D45(i3,j3)=|Bi3-1,j3+1-Bi3+1,j3-1|+|2gi3,j3-gi3-1,j3+1-gi3+1,j3-1|计算第i3行第j3列的像素的45度梯度,按照公式D135(i3,j3)=|Bi3-1,j3-1-Bi3+1,j3+1|+|2gi3,j3-gi3-1,j3-1-gi3+1,j3+1|计算第i3行第j3列的像素的135度梯度;当D45(i3,j3)<D135(i3,j3)时,
按照公式重建第i3行第j3列的像素的B通道的像素值;当D45(i3,j3)>D135(i3,j3)时,按照公式重建第i3行第j3列的像素的B通道的像素值;当D45(i3,j3)=D135(i3,j3)时,按照公式重建第i3行第j3列的像素的B通道的像素值。Finally, reconstructing the pixel value of the B channel of the pixel corresponding to the R channel in the image, and the pixel value of the R channel of the pixel corresponding to the B channel in the image; optionally, reconstructing the pixel of the B channel of the pixel corresponding to the R channel in the image As an example, the process of reconstructing the pixel values of the R channel of the pixel corresponding to the B channel in the image is similar. According to the formula D 45 (i3,j3)=|B i3-1,j3+1 -B i3+1,j3-1 |+|2g i3,j3 -g i3-1,j3+1 -g i3+1, J3-1 | Calculate the 45 degree gradient of the pixel in the j3th column of the i3rd line, according to the formula D 135 (i3, j3)=|B i3-1, j3-1 -B i3+1, j3+1 |+|2g I3,j3 -g i3-1,j3-1 -g i3+1,j3+1 |calculate the 135 degree gradient of the pixel of the j3th column of the i3th row; when D 45 (i3,j3)<D 135 (i3, J3), according to the formula Reconstruct the pixel value of the B channel of the pixel in the j3th column of the i3th row; when D 45 (i3, j3) > D 135 (i3, j3), according to the formula Reconstruct the pixel value of the B channel of the pixel in the j3th column of the i3th row; when D 45 (i3, j3)=D 135 (i3, j3), according to the formula The pixel value of the B channel of the pixel of the j3th column of the i3th row is reconstructed.
其中,D45(i3,j3)为第i3行第j3列的像素的45度梯度,D135(i3,j3)为第i3行第j3列的像素的145度梯度,Bi3-1,j3+1为第(i3-1)行第(j3+1)列的像素的B通道的像素值,Bi3+1,j3-1为第(i3+1)行第(j3-1)列的像素的B通道的像素值,gi3,j3为重建的第i3行第j3列的像素的G通道的像素值,gi3-1,j3+1为重建的第(i3-1)行第(j3+1)列的像素的G通道的像素值,gi3+1,
j3-1为重建的第(i3+1)行第(j3-1)列的像素的G通道的像素值,Bi3-1,j3
-1为第(i3-1)行第(j3-1)列的像素的B通道的像素值,Bi3+1,j3+1为第(i3+1)行第(j3+1)列的像素的B通道的像素值,gi3-1,j3-1为重建的第(i3-1)行第(j3-1)列的像素的G通道的像素值,gi3+1,j3+1为重建的第(i3+1)行第(j3+1)列的像素的G通道的像素值。Where D 45 (i3, j3) is the 45 degree gradient of the pixel of the i3th row and the j3th column, and D 135 (i3, j3) is the 145 degree gradient of the pixel of the i3th row and the j3th column, B i3-1, j3 +1 is the pixel value of the B channel of the pixel of the (j3+1)th column of the (i3-1)th row, and B i3+1, j3-1 is the (i3+1)th row (j3-1) column of the (i3+1)th row. The pixel value of the B channel of the pixel, g i3, j3 is the pixel value of the G channel of the pixel of the i3th row and the j3th column of the reconstruction, and g i3-1, j3+1 is the reconstructed (i3-1) line ( J3+1) The pixel value of the G channel of the pixel of the column, g i3+1, j3-1 is the pixel value of the G channel of the pixel of the (i3+1)th row (j3-1) column of the reconstruction, B i3 -1, j3 -1 is the pixel value of the B channel of the pixel of the (i3-1)th row (j3-1) column, B i3+1, j3+1 is the (i3+1)th row (j3+) 1) The pixel value of the B channel of the column of pixels, g i3-1, j3-1 is the pixel value of the G channel of the pixel of the (i3-1)th row (j3-1) column of the reconstruction, g i3+1 , j3+1 is the pixel value of the G channel of the pixel of the (i3+1)th column (j3+1) column of the reconstruction.
相关的获取RGB数据的方法中,由于不恰当的邻域插值平均导致出现伪彩色和摩尔纹,而这伪彩色和摩尔纹会严重影响图像的视觉质量。In the related method of acquiring RGB data, false color and moiré appear due to inappropriate neighborhood interpolation averaging, and this pseudo color and moiré will seriously affect the visual quality of the image.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本发明实施例提出了一种获取RGB数据的方法和装置,能够减少伪彩色和摩尔纹,从而提高图像的视觉质量。Embodiments of the present invention provide a method and apparatus for acquiring RGB data, which can reduce false color and moiré, thereby improving visual quality of an image.
本发明实施例提供了一种获取红绿蓝RGB数据的装置,包括:An embodiment of the present invention provides an apparatus for acquiring red, green, and blue RGB data, including:
获取模块,设置为获取图像中红R通道/蓝B通道对应的像素的第一水平插值结果和第一垂直插值结果;获取图像中R通道/B通道对应的像素的水平
梯度和垂直梯度;Obtaining a module, configured to acquire a first horizontal interpolation result and a first vertical interpolation result of pixels corresponding to a red R channel/blue B channel in the image; and acquire a level of a pixel corresponding to the R channel/B channel in the image
Gradient and vertical gradients;
第一重建模块,设置为判断出获得的水平梯度和垂直梯度之间的差值的绝对值大于0且小于第一预设阈值,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的绿G通道的像素值;a first reconstruction module, configured to determine that an absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than a first preset threshold, according to the obtained first horizontal interpolation result and the first vertical difference result Weighted average reconstructed image pixel values of the green G channel of the pixel corresponding to the R channel/B channel;
第二重建模块,设置为重建图像中G通道对应的像素的R通道/B通道的像素值;根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值。a second reconstruction module, configured to reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image; and reconstructing an R channel corresponding to the pixel value of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image The pixel value of the B channel of the pixel, and the pixel value of the R channel of the pixel corresponding to the B channel in the image.
可选的,Optional,
所述第一重建模块,还设置为当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值等于0时,根据所述第一水平插值结果和所述第一垂直差值结果的平均值重建所述图像中R通道/B通道对应的像素的G通道的像素值。The first reconstruction module is further configured to: when determining that an absolute value of a difference between the horizontal gradient and the vertical gradient is equal to 0, according to the first horizontal interpolation result and the first vertical difference The average of the results reconstructs the pixel values of the G channels of the pixels corresponding to the R channel/B channel in the image.
可选的,Optional,
所述第一重建模块,还设置为当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值大于所述第一预设阈值,且所述水平梯度小于所述垂直梯度时,根据所述第一水平插值结果重建所述图像中R通道/B通道对应的像素的G通道的像素值;The first reconstruction module is further configured to: when it is determined that an absolute value of a difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is smaller than the vertical gradient And reconstructing, according to the first horizontal interpolation result, a pixel value of a G channel of a pixel corresponding to the R channel/B channel in the image;
当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值大于所述第一预设阈值,且所述水平梯度大于所述垂直梯度时,根据所述第一垂直插值结果重建所述图像中R通道/B通道对应的像素的G通道的像素值。When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is greater than the vertical gradient, reconstructing according to the first vertical interpolation result The pixel value of the G channel of the pixel corresponding to the R channel/B channel in the image.
可选的,Optional,
所述第二重建模块,是设置为获取所述图像中G通道对应的像素的第二水平插值结果或第二垂直插值结果,根据所述第二水平插值结果或所述第二垂直插值结果重建所述图像中G通道对应的像素的R通道/B通道的像素值;The second reconstruction module is configured to acquire a second horizontal interpolation result or a second vertical interpolation result of the pixel corresponding to the G channel in the image, and reconstruct according to the second horizontal interpolation result or the second vertical interpolation result a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image;
根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的
R通道的像素值。Reconstructing the pixel value of the B channel of the pixel corresponding to the R channel in the image according to the pixel value of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, and the pixel corresponding to the B channel in the image
The pixel value of the R channel.
可选的,Optional,
所述第二重建模块,是设置为重建图像中G通道对应的像素的R通道/B通道的像素值;The second reconstruction module is configured to reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image;
根据所述图像中R通道和B通道对应的像素的重建的G通道的像素值计算所述图像中R通道/B通道对应的像素的45度插值结果和135度插值结果,并计算所述图像中B通道/R通道对应的像素的45度梯度和135度梯度;Calculating a 45-degree interpolation result and a 135-degree interpolation result of the pixel corresponding to the R channel/B channel in the image according to pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, and calculating the image a 45 degree gradient and a 135 degree gradient of pixels corresponding to the B channel/R channel;
判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于0且小于第二预设阈值,根据所述45度插值结果和所述135度插值结果的加权平均重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。Determining that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than 0 and less than a second predetermined threshold, according to the 45-degree interpolation result and the weighted average reconstruction of the 135-degree interpolation result The pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
可选的,Optional,
所述第二重建模块,还设置为当判断出所述45度梯度和所述135度梯度之间的差值的绝对值等于0时,根据所述45度插值结果和所述135度插值结果的平均值重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。The second reconstruction module is further configured to: when determining that the absolute value of the difference between the 45 degree gradient and the 135 degree gradient is equal to 0, according to the 45 degree interpolation result and the 135 degree interpolation result The average value reconstructs the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
可选的,Optional,
所述第二重建模块,还设置为当判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于所述第二预设阈值,且所述45度梯度小于所述135度梯度时,根据所述45度插值结果重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值;The second reconstruction module is further configured to: when it is determined that an absolute value of a difference between the 45 degree gradient and the 135 degree gradient is greater than the second preset threshold, and the 45 degree gradient is smaller than the a 135 degree gradient, reconstructing a pixel value of a B channel/R channel of a pixel corresponding to the R channel/B channel in the image according to the 45 degree interpolation result;
当判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于所述第二预设阈值,且所述45度梯度大于所述135度梯度时,根据所述135度插值结果重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than the second predetermined threshold, and the 45-degree gradient is greater than the 135-degree gradient, according to the 135 degrees The interpolation result reconstructs the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
可选的,获取模块,是设置为通过如下方式实现获取图像中红R通道/蓝B通道对应的像素的第一水平插值结果和第一垂直插值结果:Optionally, the obtaining module is configured to obtain a first horizontal interpolation result and a first vertical interpolation result of the pixel corresponding to the red R channel/blue B channel in the image by:
按照公式计算图像中R通道/B通道对应的像素的第一水平插值结果;
According to the formula Calculating a first horizontal interpolation result of pixels corresponding to the R channel/B channel in the image;
按照公式计算图像中R通道/B通道对应的像素的第一垂直插值结果;According to the formula Calculating a first vertical interpolation result of pixels corresponding to the R channel/B channel in the image;
其中,g1i1,j1为第一水平插值结果,g2i1,j1为第一垂直插值结果,Gi1,j1-1为图像中第i1行第(j1-1)列的像素的G通道的像素值,Gi1,j1+1为图像中第i1行第(j1+1)列的像素的G通道的像素值,Ai1,j1为图像中第i1行第j1列的像素的R通道/B通道的像素值,Ai1,j1-2为图像中第i1行第(j1-2)列的像素的R通道/B通道的像素值,Ai1,j1+2为图像中第i1行第(j1+2)列的像素的R通道/B通道的像素值;Gi1-1,j1为图像中第(i1-1)行第j1列的像素的G通道的像素值,Gi1+1,j1为图像中第(i1+1)行第j1列的像素的G通道的像素值,Ai1-2,j1为图像中第(i1-2)行第j1列的像素的R通道/B通道的像素值,Ai1+2,j1为图像中第(i1+2)行第j1列的像素的R通道/B通道的像素值。Where g1 i1, j1 are the first horizontal interpolation result, g2 i1, j1 is the first vertical interpolation result, and G i1, j1-1 are the pixels of the G channel of the pixel of the (i1-1)th column (j1-1) column in the image. The value, G i1, j1+1 is the pixel value of the G channel of the pixel in the (i1+1)th column of the i1th row in the image, and A i1, j1 is the R channel/B of the pixel of the i1th row and the j1th column in the image. The pixel value of the channel, A i1, j1-2 is the pixel value of the R channel/B channel of the pixel of the (i1-2)th column in the i1th row of the image, and A i1, j1+2 is the i1th row of the image ( J1+2) the pixel value of the R channel/B channel of the pixel of the column; G i1-1, j1 is the pixel value of the G channel of the pixel of the (j1)th row and the j1th column of the image, G i1+1, J1 is the pixel value of the G channel of the pixel of the j1th column of the (i1+1)th row in the image, and A i1-2, j1 is the R channel/B channel of the pixel of the (j1)th row of the (i1-2)th row in the image. The pixel value, A i1+2, j1 is the pixel value of the R channel/B channel of the pixel of the j1th column of the (i1+2)th row in the image.
可选的,获取模块,是设置为通过如下方式实现获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度:Optionally, the acquiring module is configured to obtain a horizontal gradient and a vertical gradient of pixels corresponding to the R channel/B channel in the image by:
按照公式ΔH1i1,j1=|Gi1-1,j1-Gi1+1,j1|+|2Ai1,j1-Gi1-1,j1-Gi1+1,j1|计算图像中R通道/B通道对应的像素的水平梯度;Calculate the R channel/B in the image according to the formula ΔH1 i1,j1 =|G i1-1,j1 -G i1+1,j1 |+|2A i1,j1 -G i1-1,j1 -G i1+1,j1 | The horizontal gradient of the pixel corresponding to the channel;
按照公式ΔH2i1,j1=|Gi1,j1-1-Gi1,j1+1|+|2Ai1,j1-Gi1,j1-1-Gi1,j1+1|计算图像中R通道/B通道对应的像素的垂直梯度;Calculate the R channel/B in the image according to the formula ΔH2 i1,j1 =|G i1,j1-1 -G i1,j1+1 |+|2A i1,j1 -G i1,j1-1 -G i1,j1+1 | The vertical gradient of the pixel corresponding to the channel;
其中,ΔH1i1,j1为水平梯度,ΔH2i1,j1为垂直梯度。Where ΔH1 i1, j1 is a horizontal gradient, ΔH2 i1, and j1 is a vertical gradient.
可选的,第一重建模块是设置为通过如下方式实现根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的绿G通道的像素值:Optionally, the first reconstruction module is configured to implement, according to the obtained first horizontal interpolation result and the first vertical difference result, weighted average reconstructed pixels of the green channel of the pixel corresponding to the R channel/B channel in the image. value:
按照公式重建图像中R通道/B通道对应的像素的重建的G通道的像素值。According to the formula Reconstruct the pixel values of the reconstructed G channel of the pixel corresponding to the R channel/B channel in the image.
本发明实施例还提供了一种获取红绿蓝RGB数据的方法,包括:The embodiment of the invention further provides a method for acquiring red, green and blue RGB data, comprising:
获取图像中红R通道/蓝B通道对应的像素的第一水平插值结果和第一垂直插值结果;获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度;Obtaining a first horizontal interpolation result and a first vertical interpolation result of the pixel corresponding to the red R channel/blue B channel in the image; acquiring a horizontal gradient and a vertical gradient of the pixel corresponding to the R channel/B channel in the image;
判断出获得的水平梯度和垂直梯度之间的差值的绝对值大于0且小于第
一预设阈值,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的G通道的像素值;Judging that the absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than the first
a preset threshold, and reconstructing, according to the obtained first horizontal interpolation result and the weighted average of the first vertical difference result, a pixel value of a G channel of a pixel corresponding to the R channel/B channel in the image;
重建图像中G通道对应的像素的R通道/B通道的像素值;Reconstructing the pixel values of the R channel/B channel of the pixel corresponding to the G channel in the image;
根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值。The pixel value of the B channel of the pixel corresponding to the R channel in the image and the pixel value of the R channel of the pixel corresponding to the B channel in the image are reconstructed according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image.
可选的,该方法还包括:当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值等于0时,Optionally, the method further includes: when it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is equal to 0,
根据所述第一水平插值结果和所述第一垂直差值结果的平均值重建所述图像中R通道/B通道对应的像素的G通道的像素值。And reconstructing a pixel value of a G channel of a pixel corresponding to the R channel/B channel in the image according to the first horizontal interpolation result and the average value of the first vertical difference result.
可选的,该方法还包括:Optionally, the method further includes:
当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值大于所述第一预设阈值,且所述水平梯度小于所述垂直梯度时,根据所述第一水平插值结果重建所述图像中R通道/B通道对应的像素的G通道的像素值;When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is smaller than the vertical gradient, reconstructing according to the first horizontal interpolation result a pixel value of a G channel of a pixel corresponding to the R channel/B channel in the image;
当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值大于所述第一预设阈值,且所述水平梯度大于所述垂直梯度时,根据所述第一垂直插值结果重建所述图像中R通道/B通道对应的像素的G通道的像素值。When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is greater than the vertical gradient, reconstructing according to the first vertical interpolation result The pixel value of the G channel of the pixel corresponding to the R channel/B channel in the image.
可选的,所述重建图像中G通道对应的像素的R通道/B通道的像素值包括:Optionally, the pixel values of the R channel/B channel of the pixel corresponding to the G channel in the reconstructed image include:
获取所述图像中G通道对应的像素的第二水平插值结果或第二垂直插值结果,根据所述第二水平插值结果或所述第二垂直插值结果重建所述图像中G通道对应的像素的R通道/B通道的像素值。Obtaining a second horizontal interpolation result or a second vertical interpolation result of the pixel corresponding to the G channel in the image, and reconstructing a pixel corresponding to the G channel in the image according to the second horizontal interpolation result or the second vertical interpolation result The pixel value of the R channel/B channel.
可选的,所述根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道/B通道对应的像素的B通道/R通道的像素值包括:Optionally, the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image reconstructed according to the pixel value of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image include:
根据所述图像中R通道和B通道对应的像素的重建的G通道的像素值计算所述图像中R通道/B通道对应的像素的45度插值结果和135度插值结果,并计算所述图像中B通道/R通道对应的像素的45度梯度和135度梯度;Calculating a 45-degree interpolation result and a 135-degree interpolation result of the pixel corresponding to the R channel/B channel in the image according to pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, and calculating the image a 45 degree gradient and a 135 degree gradient of pixels corresponding to the B channel/R channel;
判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于0且小
于第二预设阈值,根据所述45度插值结果和所述135度插值结果的加权平均重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。Determining that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than 0 and small
And at a second preset threshold, reconstructing a pixel value of a B channel/R channel of a pixel corresponding to the R channel/B channel in the image according to the weighted average of the 45 degree interpolation result and the 135 degree interpolation result.
可选的,所述根据图像中G通道对应的像素的像素值和重建的G通道的像素值重建图像中R通道/B通道对应的像素的B通道/R通道的像素值还包括:当判断出所述45度梯度和所述135度梯度之间的差值的绝对值等于0时,根据所述45度插值结果和所述135度插值结果的平均值重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。Optionally, the determining, according to the pixel value of the pixel corresponding to the G channel in the image and the pixel value of the reconstructed G channel, the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image further includes: when determining When the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is equal to 0, the R channel/B in the image is reconstructed according to the 45-degree interpolation result and the average value of the 135-degree interpolation result The pixel value of the B channel/R channel of the pixel corresponding to the channel.
可选的,所述根据图像中G通道对应的像素的像素值和重建的G通道的像素值重建图像中R通道/B通道对应的像素的B通道/R通道的像素值还包括:Optionally, the determining, according to the pixel value of the pixel corresponding to the G channel in the image and the pixel value of the reconstructed G channel, the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image further includes:
当判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于所述第二预设阈值,且所述45度梯度小于所述135度梯度时,根据所述45度插值结果重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值;When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than the second predetermined threshold, and the 45-degree gradient is smaller than the 135-degree gradient, according to the 45 degrees Interpolating results reconstructing pixel values of B channels/R channels of pixels corresponding to R channels/B channels in the image;
当判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于所述第二预设阈值,且所述45度梯度大于所述135度梯度时,根据所述135度插值结果重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than the second predetermined threshold, and the 45-degree gradient is greater than the 135-degree gradient, according to the 135 degrees The interpolation result reconstructs the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
可选的,获取图像中红R通道/蓝B通道对应的像素的第一水平插值结果和第一垂直插值结果,包括:Optionally, obtaining a first horizontal interpolation result and a first vertical interpolation result of the pixel corresponding to the red R channel/blue B channel in the image, including:
按照公式计算图像中R通道/B通道对应的像素的第一水平插值结果;According to the formula Calculating a first horizontal interpolation result of pixels corresponding to the R channel/B channel in the image;
按照公式计算图像中R通道/B通道对应的像素的第一垂直插值结果;According to the formula Calculating a first vertical interpolation result of pixels corresponding to the R channel/B channel in the image;
其中,g1i1,j1为第一水平插值结果,g2i1,j1为第一垂直插值结果,Gi1,j1-1为图像中第i1行第(j1-1)列的像素的G通道的像素值,Gi1,j1+1为图像中第i1行第(j1+1)列的像素的G通道的像素值,Ai1,j1为图像中第i1行第j1列的像素的R通道/B通道的像素值,Ai1,j1-2为图像中第i1行第(j1-2)列的像素的R通道/B通道的像素值,Ai1,j1+2为图像中第i1行第(j1+2)列的像
素的R通道/B通道的像素值;Gi1-1,j1为图像中第(i1-1)行第j1列的像素的G通道的像素值,Gi1+1,j1为图像中第(i1+1)行第j1列的像素的G通道的像素值,Ai1-2,j1为图像中第(i1-2)行第j1列的像素的R通道/B通道的像素值,Ai1+2,j1为图像中第(i1+2)行第j1列的像素的R通道/B通道的像素值。Where g1 i1, j1 are the first horizontal interpolation result, g2 i1, j1 is the first vertical interpolation result, and G i1, j1-1 are the pixels of the G channel of the pixel of the (i1-1)th column (j1-1) column in the image. The value, G i1, j1+1 is the pixel value of the G channel of the pixel in the (i1+1)th column of the i1th row in the image, and A i1, j1 is the R channel/B of the pixel of the i1th row and the j1th column in the image. The pixel value of the channel, A i1, j1-2 is the pixel value of the R channel/B channel of the pixel of the (i1-2)th column in the i1th row of the image, and A i1, j1+2 is the i1th row of the image ( J1+2) the pixel value of the R channel/B channel of the pixel of the column; G i1-1, j1 is the pixel value of the G channel of the pixel of the (j1)th row and the j1th column of the image, G i1+1, J1 is the pixel value of the G channel of the pixel of the j1th column of the (i1+1)th row in the image, and A i1-2, j1 is the R channel/B channel of the pixel of the (j1)th row of the (i1-2)th row in the image. The pixel value, A i1+2, j1 is the pixel value of the R channel/B channel of the pixel of the j1th column of the (i1+2)th row in the image.
可选的,Optional,
获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度包括:Obtaining the horizontal and vertical gradients of the pixels corresponding to the R channel/B channel in the image includes:
按照公式ΔH1i1,j1=|Gi1-1,j1-Gi1+1,j1|+|2Ai1,j1-Gi1-1,j1-Gi1+1,j1|计算图像中R通道/B通道对应的像素的水平梯度;Calculate the R channel/B in the image according to the formula ΔH1 i1,j1 =|G i1-1,j1 -G i1+1,j1 |+|2A i1,j1 -G i1-1,j1 -G i1+1,j1 | The horizontal gradient of the pixel corresponding to the channel;
按照公式ΔH2i1,j1=|Gi1,j1-1-Gi1,j1+1|+|2Ai1,j1-Gi1,j1-1-Gi1,j1+1|计算图像中R通道/B通道对应的像素的垂直梯度;Calculate the R channel/B in the image according to the formula ΔH2 i1,j1 =|G i1,j1-1 -G i1,j1+1 |+|2A i1,j1 -G i1,j1-1 -G i1,j1+1 | The vertical gradient of the pixel corresponding to the channel;
其中,ΔH1i1,j1为水平梯度,ΔH2i1,j1为垂直梯度。Where ΔH1 i1, j1 is a horizontal gradient, ΔH2 i1, and j1 is a vertical gradient.
可选的,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的G通道的像素值,包括:Optionally, the pixel value of the G channel of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the obtained first horizontal interpolation result and the weighted average of the first vertical difference result, including:
按照公式重建图像中R通道/B通道对应的像素的重建的G通道的像素值。According to the formula Reconstruct the pixel values of the reconstructed G channel of the pixel corresponding to the R channel/B channel in the image.
与相关技术相比,本发明实施例的技术方案包括:获取图像中R通道/B通道对应的像素的第一水平插值结果和第一垂直插值结果;获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度;判断出获得的水平梯度和垂直梯度之间的差值的绝对值大于0且小于第一预设阈值,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的G通道的像素值;重建图像中G通道对应的像素的R通道/B通道的像素值;根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值。通过本发明实施例的方案,在获得的水平梯度和垂直梯度之间的差值的绝对值大于0且小于第一预设阈值时,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道或B通道对应的像素的G通道的像素值,减少了伪彩色和摩尔纹,从而提高了图像的视觉质量。
Compared with the related art, the technical solution of the embodiment of the present invention includes: acquiring a first horizontal interpolation result and a first vertical interpolation result of pixels corresponding to the R channel/B channel in the image; and acquiring pixels corresponding to the R channel/B channel in the image. a horizontal gradient and a vertical gradient; determining that the absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and smaller than the first predetermined threshold, according to the obtained first horizontal interpolation result and the first vertical difference result The pixel value of the G channel of the pixel corresponding to the R channel/B channel in the weighted average reconstructed image; the pixel value of the R channel/B channel of the pixel corresponding to the G channel in the reconstructed image; according to the pixel corresponding to the R channel and the B channel in the image The pixel value of the reconstructed G channel reconstructs the pixel value of the B channel of the pixel corresponding to the R channel in the image, and the pixel value of the R channel of the pixel corresponding to the B channel in the image. According to the solution of the embodiment of the present invention, when the absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than the first preset threshold, according to the obtained first horizontal interpolation result and the first vertical difference result The weighted average reconstructs the pixel values of the G channel of the pixel corresponding to the R channel or the B channel in the image, reducing the pseudo color and moiré, thereby improving the visual quality of the image.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF abstract
图1为实现本发明各个实施例的移动终端的硬件结构示意图;1 is a schematic structural diagram of hardware of a mobile terminal that implements various embodiments of the present invention;
图2为如图1所示的移动终端的无线通信***示意图;2 is a schematic diagram of a wireless communication system of the mobile terminal shown in FIG. 1;
图3为本发明实施例获取RGB数据的方法的流程图;3 is a flowchart of a method for acquiring RGB data according to an embodiment of the present invention;
图4为本发明实施例图像的示意图;4 is a schematic diagram of an image according to an embodiment of the present invention;
图5为本发明实施例获取RGB数据的装置的结构组成示意图。FIG. 5 is a schematic structural diagram of an apparatus for acquiring RGB data according to an embodiment of the present invention.
为了便于本领域技术人员的理解,下面结合附图对本发明作进一步的描述,并不能用来限制本发明的保护范围。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的各种方式可以相互组合。In order to facilitate the understanding of those skilled in the art, the present invention is further described below in conjunction with the accompanying drawings, and is not intended to limit the scope of the present invention. It should be noted that the embodiments in the present application and the various manners in the embodiments may be combined with each other without conflict.
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
现在将参考附图描述实现本发明各个实施例的移动终端。在后续的描述中,使用设置为表示元件的诸如“模块”、“部件”或“单元”的后缀仅为了有利于本发明实施例的说明,其本身并没有特定的意义。因此,"模块"与"部件"可以混合地使用。A mobile terminal embodying various embodiments of the present invention will now be described with reference to the accompanying drawings. In the following description, the use of suffixes such as "module", "component" or "unit" set to indicate an element is merely an explanation for facilitating embodiments of the present invention, and does not have a specific meaning per se. Therefore, "module" and "component" can be used in combination.
移动终端可以以各种形式来实施。例如,本发明实施例中描述的终端可以包括诸如移动电话、智能电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、导航装置等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。下面,假设终端是移动终端。然而,本领域技术人员将理解的是,除了特别用于移动目的的元件之外,根据本发明的实施方式的构造也能够应用于固定类型的终端。The mobile terminal can be implemented in various forms. For example, the terminal described in the embodiments of the present invention may include, for example, a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet), a PMP (Portable Multimedia Player), a navigation device Mobile terminals of the like and fixed terminals such as digital TVs, desktop computers, and the like. In the following, it is assumed that the terminal is a mobile terminal. However, those skilled in the art will appreciate that configurations in accordance with embodiments of the present invention can be applied to fixed type terminals in addition to components that are specifically for mobile purposes.
图1为实现本发明各个实施例的移动终端的硬件结构示意。FIG. 1 is a schematic diagram showing the hardware structure of a mobile terminal embodying various embodiments of the present invention.
移动终端100可以包括无线通信单元110、A/V(音频/视频)输入单元120、
用户输入单元130、感测单元140、输出单元150、存储器160、接口单元170、控制器180和电源单元190等等。图1示出了具有各种组件的移动终端,但是应理解的是,并不要求实施所有示出的组件。可以替代地实施更多或更少的组件。将在下面详细描述移动终端的元件。The mobile terminal 100 may include a wireless communication unit 110, an A/V (Audio/Video) input unit 120,
The user input unit 130, the sensing unit 140, the output unit 150, the memory 160, the interface unit 170, the controller 180, the power supply unit 190, and the like. Figure 1 illustrates a mobile terminal having various components, but it should be understood that not all illustrated components are required to be implemented. More or fewer components can be implemented instead. The elements of the mobile terminal will be described in detail below.
无线通信单元110通常包括一个或多个组件,其允许移动终端100与无线通信***或网络之间的无线电通信。例如,无线通信单元可以包括广播接收模块111、移动通信模块112、无线互联网模块113、短程通信模块114和位置信息模块115中的至少一个。 Wireless communication unit 110 typically includes one or more components that permit radio communication between mobile terminal 100 and a wireless communication system or network. For example, the wireless communication unit may include at least one of a broadcast receiving module 111, a mobile communication module 112, a wireless internet module 113, a short-range communication module 114, and a location information module 115.
广播接收模块111经由广播信道从外部广播管理服务器接收广播信号和/或广播相关信息。广播信道可以包括卫星信道和/或地面信道。广播管理服务器可以是生成并发送广播信号和/或广播相关信息的服务器或者接收之前生成的广播信号和/或广播相关信息并且将其发送给终端的服务器。广播信号可以包括TV广播信号、无线电广播信号、数据广播信号等等。而且,广播信号可以进一步包括与TV或无线电广播信号组合的广播信号。广播相关信息也可以经由移动通信网络提供,并且在该情况下,广播相关信息可以由移动通信模块112来接收。广播信号可以以各种形式存在,例如,其可以以数字多媒体广播(DMB)的电子节目指南(EPG)、数字视频广播手持(DVB-H)的电子服务指南(ESG)等等的形式而存在。广播接收模块111可以通过使用各种类型的广播***接收信号广播。特别地,广播接收模块111可以通过使用诸如多媒体广播-地面(DMB-T)、数字多媒体广播-卫星(DMB-S)、数字视频广播-手持(DVB-H),前向链路媒体(MediaFLO@)的数据广播***、地面数字广播综合服务(ISDB-T)等等的数字广播***接收数字广播。广播接收模块111可以被构造为适合提供广播信号的各种广播***以及上述数字广播***。经由广播接收模块111接收的广播信号和/或广播相关信息可以存储在存储器160(或者其它类型的存储介质)中。The broadcast receiving module 111 receives a broadcast signal and/or broadcast associated information from an external broadcast management server via a broadcast channel. The broadcast channel can include a satellite channel and/or a terrestrial channel. The broadcast management server may be a server that generates and transmits a broadcast signal and/or broadcast associated information or a server that receives a previously generated broadcast signal and/or broadcast associated information and transmits it to the terminal. The broadcast signal may include a TV broadcast signal, a radio broadcast signal, a data broadcast signal, and the like. Moreover, the broadcast signal may further include a broadcast signal combined with a TV or radio broadcast signal. The broadcast associated information may also be provided via a mobile communication network, and in this case, the broadcast associated information may be received by the mobile communication module 112. The broadcast signal may exist in various forms, for example, it may exist in the form of Digital Multimedia Broadcasting (DMB) Electronic Program Guide (EPG), Digital Video Broadcasting Handheld (DVB-H) Electronic Service Guide (ESG), and the like. . The broadcast receiving module 111 can receive a signal broadcast by using various types of broadcast systems. In particular, the broadcast receiving module 111 can use forward link media (MediaFLO) by using, for example, multimedia broadcast-terrestrial (DMB-T), digital multimedia broadcast-satellite (DMB-S), digital video broadcast-handheld (DVB-H) The digital broadcasting system of the @) data broadcasting system, the terrestrial digital broadcasting integrated service (ISDB-T), and the like receives digital broadcasting. The broadcast receiving module 111 can be constructed as various broadcast systems suitable for providing broadcast signals as well as the above-described digital broadcast system. The broadcast signal and/or broadcast associated information received via the broadcast receiving module 111 may be stored in the memory 160 (or other type of storage medium).
移动通信模块112将无线电信号发送到基站(例如,接入点、节点B等等)、外部终端以及服务器中的至少一个和/或从其接收无线电信号。这样的无线电信号可以包括语音通话信号、视频通话信号、或者根据文本和/或多媒体消息发送和/或接收的各种类型的数据。
The mobile communication module 112 transmits the radio signals to and/or receives radio signals from at least one of a base station (e.g., an access point, a Node B, etc.), an external terminal, and a server. Such radio signals may include voice call signals, video call signals, or various types of data transmitted and/or received in accordance with text and/or multimedia messages.
无线互联网模块113支持移动终端的无线互联网接入。该模块可以内部或外部地耦接到终端。该模块所涉及的无线互联网接入技术可以包括WLAN(无线LAN)(Wi-Fi)、Wibro(无线宽带)、Wimax(全球微波互联接入)、HSDPA(高速下行链路分组接入)等等。The wireless internet module 113 supports wireless internet access of the mobile terminal. The module can be internally or externally coupled to the terminal. The wireless Internet access technologies involved in the module may include WLAN (Wireless LAN) (Wi-Fi), Wibro (Wireless Broadband), Wimax (Worldwide Interoperability for Microwave Access), HSDPA (High Speed Downlink Packet Access), etc. .
短程通信模块114是设置为支持短程通信的模块。短程通信技术的一些示例包括蓝牙TM、射频识别(RFID)、红外数据协会(IrDA)、超宽带(UWB)、紫蜂TM等等。The short range communication module 114 is a module that is configured to support short range communication. Some examples of short-range communication technology include Bluetooth TM, a radio frequency identification (RFID), infrared data association (IrDA), ultra wideband (UWB), ZigBee, etc. TM.
位置信息模块115是设置为检查或获取移动终端的位置信息的模块。位置信息模块的典型示例是GPS(全球定位***)。根据当前的技术,GPS模块115计算来自三个或更多卫星的距离信息和准确的时间信息并且对于计算的信息应用三角测量法,从而根据经度、纬度和高度准确地计算三维当前位置信息。当前,用于计算位置和时间信息的方法使用三颗卫星并且通过使用另外的一颗卫星校正计算出的位置和时间信息的误差。此外,GPS模块115能够通过实时地连续计算当前位置信息来计算速度信息。The location information module 115 is a module configured to check or acquire location information of the mobile terminal. A typical example of a location information module is GPS (Global Positioning System). According to the current technology, the GPS module 115 calculates distance information and accurate time information from three or more satellites and applies triangulation to the calculated information to accurately calculate three-dimensional current position information based on longitude, latitude, and altitude. Currently, the method for calculating position and time information uses three satellites and corrects the calculated position and time information errors by using another satellite. Further, the GPS module 115 is capable of calculating speed information by continuously calculating current position information in real time.
A/V输入单元120设置为接收音频或视频信号。A/V输入单元120可以包括相机121和麦克风1220,相机121对在视频捕获模式或图像捕获模式中由图像捕获装置获得的静态图片或视频的图像数据进行处理。处理后的图像帧可以显示在显示单元151上。经相机121处理后的图像帧可以存储在存储器160(或其它存储介质)中或者经由无线通信单元110进行发送,可以根据移动终端的构造提供两个或更多相机1210。麦克风122可以在电话通话模式、记录模式、语音识别模式等等运行模式中经由麦克风接收声音(音频数据),并且能够将这样的声音处理为音频数据。处理后的音频(语音)数据可以在电话通话模式的情况下转换为可经由移动通信模块112发送到移动通信基站的格式输出。麦克风122可以实施各种类型的噪声消除(或抑制)算法以消除(或抑制)在接收和发送音频信号的过程中产生的噪声或者干扰。The A/V input unit 120 is arranged to receive an audio or video signal. The A/V input unit 120 may include a camera 121 and a microphone 1220 that processes image data of still pictures or video obtained by the image capturing device in a video capturing mode or an image capturing mode. The processed image frame can be displayed on the display unit 151. The image frames processed by the camera 121 may be stored in the memory 160 (or other storage medium) or transmitted via the wireless communication unit 110, and two or more cameras 1210 may be provided according to the configuration of the mobile terminal. The microphone 122 can receive sound (audio data) via a microphone in an operation mode of a telephone call mode, a recording mode, a voice recognition mode, and the like, and can process such sound as audio data. The processed audio (voice) data can be converted to a format output that can be transmitted to the mobile communication base station via the mobile communication module 112 in the case of a telephone call mode. The microphone 122 can implement various types of noise cancellation (or suppression) algorithms to cancel (or suppress) noise or interference generated during the process of receiving and transmitting audio signals.
用户输入单元130可以根据用户输入的命令生成键输入数据以控制移动终端的各种操作。用户输入单元130允许用户输入各种类型的信息,并且可以包括键盘、锅仔片、触摸板(例如,检测由于被接触而导致的电阻、压力、电容等等的变化的触敏组件)、滚轮、摇杆等等。特别地,当触摸板以层的形式
叠加在显示单元151上时,可以形成触摸屏。The user input unit 130 may generate key input data according to a command input by the user to control various operations of the mobile terminal. The user input unit 130 allows the user to input various types of information, and may include a keyboard, a pot, a touch pad (eg, a touch sensitive component that detects changes in resistance, pressure, capacitance, etc. due to contact), a scroll wheel , rocker, etc. In particular, when the touchpad is in the form of a layer
When superimposed on the display unit 151, a touch screen can be formed.
感测单元140检测移动终端100的当前状态,(例如,移动终端100的打开或关闭状态)、移动终端100的位置、用户对于移动终端100的接触(即,触摸输入)的有无、移动终端100的取向、移动终端100的加速或减速移动和方向等等,并且生成用于控制移动终端100的操作的命令或信号。例如,当移动终端100实施为滑动型移动电话时,感测单元140可以感测该滑动型电话是打开还是关闭。另外,感测单元140能够检测电源单元190是否提供电力或者接口单元170是否与外部装置耦接。感测单元140可以包括接近传感器1410将在下面结合触摸屏来对此进行描述。The sensing unit 140 detects the current state of the mobile terminal 100 (eg, the open or closed state of the mobile terminal 100), the location of the mobile terminal 100, the presence or absence of contact (ie, touch input) by the user with the mobile terminal 100, and the mobile terminal. The orientation of 100, the acceleration or deceleration movement and direction of the mobile terminal 100, and the like, and generates a command or signal for controlling the operation of the mobile terminal 100. For example, when the mobile terminal 100 is implemented as a slide type mobile phone, the sensing unit 140 can sense whether the slide type phone is turned on or off. In addition, the sensing unit 140 can detect whether the power supply unit 190 provides power or whether the interface unit 170 is coupled to an external device. Sensing unit 140 may include proximity sensor 1410 which will be described below in connection with a touch screen.
接口单元170用作至少一个外部装置与移动终端100连接可以通过的接口。例如,外部装置可以包括有线或无线头戴式耳机端口、外部电源(或电池充电器)端口、有线或无线数据端口、存储卡端口、用于连接具有识别模块的装置的端口、音频输入/输出(I/O)端口、视频I/O端口、耳机端口等等。识别模块可以是存储用于验证用户使用移动终端100的各种信息并且可以包括用户识别模块(UIM)、客户识别模块(SIM)、通用客户识别模块(USIM)等等。另外,具有识别模块的装置(下面称为"识别装置")可以采取智能卡的形式,因此,识别装置可以经由端口或其它连接装置与移动终端100连接。接口单元170可以设置为接收来自外部装置的输入(例如,数据信息、电力等等)并且将接收到的输入传输到移动终端100内的一个或多个元件或者可以用于在移动终端和外部装置之间传输数据。The interface unit 170 serves as an interface through which at least one external device can connect with the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, and an audio input/output. (I/O) port, video I/O port, headphone port, and more. The identification module may be stored to verify various information used by the user using the mobile terminal 100 and may include a User Identification Module (UIM), a Customer Identification Module (SIM), a Universal Customer Identity Module (USIM), and the like. In addition, the device having the identification module (hereinafter referred to as "identification device") may take the form of a smart card, and thus the identification device may be connected to the mobile terminal 100 via a port or other connection device. The interface unit 170 may be arranged to receive input from an external device (eg, data information, power, etc.) and transmit the received input to one or more components within the mobile terminal 100 or may be used at the mobile terminal and external device Transfer data between.
另外,当移动终端100与外部底座连接时,接口单元170可以用作允许通过其将电力从底座提供到移动终端100的路径或者可以用作允许从底座输入的各种命令信号通过其传输到移动终端的路径。从底座输入的各种命令信号或电力可以用作用于识别移动终端是否准确地安装在底座上的信号。输出单元150被构造为以视觉、音频和/或触觉方式提供输出信号(例如,音频信号、视频信号、警报信号、振动信号等等)。输出单元150可以包括显示单元151、音频输出模块152、警报单元153等等。In addition, when the mobile terminal 100 is connected to the external base, the interface unit 170 may function as a path through which power is supplied from the base to the mobile terminal 100 or may be used as a transmission of various command signals allowing input from the base to the mobile terminal 100 The path to the terminal. Various command signals or power input from the base can be used as signals for identifying whether the mobile terminal is accurately mounted on the base. Output unit 150 is configured to provide an output signal (eg, an audio signal, a video signal, an alarm signal, a vibration signal, etc.) in a visual, audio, and/or tactile manner. The output unit 150 may include a display unit 151, an audio output module 152, an alarm unit 153, and the like.
显示单元151可以显示在移动终端100中处理的信息。例如,当移动终端100处于电话通话模式时,显示单元151可以显示与通话或其它通信(例如,文
本消息收发、多媒体文件下载等等)相关的用户界面(UI)或图形用户界面(GUI)。当移动终端100处于视频通话模式或者图像捕获模式时,显示单元151可以显示捕获的图像和/或接收的图像、示出视频或图像以及相关功能的UI或GUI等等。The display unit 151 can display information processed in the mobile terminal 100. For example, when the mobile terminal 100 is in the phone call mode, the display unit 151 can display a call or other communication (eg, text)
This messaging, multimedia file download, etc.) related user interface (UI) or graphical user interface (GUI). When the mobile terminal 100 is in a video call mode or an image capturing mode, the display unit 151 may display a captured image and/or a received image, a UI or GUI showing a video or image and related functions, and the like.
同时,当显示单元151和触摸板以层的形式彼此叠加以形成触摸屏时,显示单元151可以用作输入装置和输出装置。显示单元151可以包括液晶显示器(LCD)、薄膜晶体管LCD(TFT-LCD)、有机发光二极管(OLED)显示器、柔性显示器、三维(3D)显示器等等中的至少一种。这些显示器中的一些可以被构造为透明状以允许用户从外部观看,这可以称为透明显示器,典型的透明显示器可以例如为TOLED(透明有机发光二极管)显示器等等。根据特定想要的实施方式,移动终端100可以包括两个或更多显示单元(或其它显示装置),例如,移动终端可以包括外部显示单元(未示出)和内部显示单元(未示出)。触摸屏可设置为检测触摸输入压力以及触摸输入位置和触摸输入面积。Meanwhile, when the display unit 151 and the touch panel are superposed on each other in the form of a layer to form a touch screen, the display unit 151 can function as an input device and an output device. The display unit 151 may include at least one of a liquid crystal display (LCD), a thin film transistor LCD (TFT-LCD), an organic light emitting diode (OLED) display, a flexible display, a three-dimensional (3D) display, and the like. Some of these displays may be configured to be transparent to allow a user to view from the outside, which may be referred to as a transparent display, and a typical transparent display may be, for example, a TOLED (Transparent Organic Light Emitting Diode) display or the like. According to a particular desired embodiment, the mobile terminal 100 may include two or more display units (or other display devices), for example, the mobile terminal may include an external display unit (not shown) and an internal display unit (not shown) . The touch screen can be set to detect touch input pressure as well as touch input position and touch input area.
音频输出模块152可以在移动终端处于呼叫信号接收模式、通话模式、记录模式、语音识别模式、广播接收模式等等模式下时,将无线通信单元110接收的或者在存储器160中存储的音频数据转换音频信号并且输出为声音。而且,音频输出模块152可以提供与移动终端100执行的特定功能相关的音频输出(例如,呼叫信号接收声音、消息接收声音等等)。音频输出模块152可以包括扬声器、蜂鸣器等等。The audio output module 152 may convert audio data received by the wireless communication unit 110 or stored in the memory 160 when the mobile terminal is in a call signal receiving mode, a call mode, a recording mode, a voice recognition mode, a broadcast receiving mode, and the like. The audio signal is output as sound. Moreover, the audio output module 152 can provide audio output (eg, call signal reception sound, message reception sound, etc.) associated with a particular function performed by the mobile terminal 100. The audio output module 152 can include a speaker, a buzzer, and the like.
警报单元153可以提供输出以将事件的发生通知给移动终端100。典型的事件可以包括呼叫接收、消息接收、键信号输入、触摸输入等等。除了音频或视频输出之外,警报单元153可以以不同的方式提供输出以通知事件的发生。例如,警报单元153可以以振动的形式提供输出,当接收到呼叫、消息或一些其它进入通信(incomingcommunication)时,警报单元153可以提供触觉输出(即,振动)以将其通知给用户。通过提供这样的触觉输出,即使在用户的移动电话处于用户的口袋中时,用户也能够识别出各种事件的发生。警报单元153也可以经由显示单元151或音频输出模块152提供通知事件的发生的输出。The alarm unit 153 can provide an output to notify the mobile terminal 100 of the occurrence of an event. Typical events may include call reception, message reception, key signal input, touch input, and the like. In addition to audio or video output, the alert unit 153 can provide an output in a different manner to notify of the occurrence of an event. For example, the alarm unit 153 can provide an output in the form of vibrations, and when a call, message, or some other incoming communication is received, the alarm unit 153 can provide a tactile output (ie, vibration) to notify the user of it. By providing such a tactile output, the user is able to recognize the occurrence of various events even when the user's mobile phone is in the user's pocket. The alarm unit 153 can also provide an output of the notification event occurrence via the display unit 151 or the audio output module 152.
存储器160可以存储由控制器180执行的处理和控制操作的软件程序等等,或者可以暂时地存储己经输出或将要输出的数据(例如,电话簿、消息、
静态图像、视频等等)。而且,存储器160可以存储关于当触摸施加到触摸屏时输出的各种方式的振动和音频信号的数据。The memory 160 may store a software program or the like that performs processing and control operations performed by the controller 180, or may temporarily store data that has been output or is to be output (for example, a phone book, a message,
Still images, videos, etc.). Moreover, the memory 160 can store data regarding vibrations and audio signals of various manners that are output when a touch is applied to the touch screen.
存储器160可以包括至少一种类型的存储介质,所述存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等等。而且,移动终端100可以与通过网络连接执行存储器160的存储功能的网络存储装置协作。The memory 160 may include at least one type of storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), a random access memory (RAM), a static random access memory ( SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like. Moreover, the mobile terminal 100 can cooperate with a network storage device that performs a storage function of the memory 160 through a network connection.
控制器180通常控制移动终端的总体操作。例如,控制器180执行与语音通话、数据通信、视频通话等等相关的控制和处理。另外,控制器180可以包括设置为再现(或回放)多媒体数据的多媒体模块1810,多媒体模块1810可以构造在控制器180内,或者可以构造为与控制器180分离。控制器180可以执行模式识别处理,以将在触摸屏上执行的手写输入或者图片绘制输入识别为字符或图像。The controller 180 typically controls the overall operation of the mobile terminal. For example, the controller 180 performs the control and processing associated with voice calls, data communications, video calls, and the like. Additionally, the controller 180 can include a multimedia module 1810 that is configured to reproduce (or play back) multimedia data, and the multimedia module 1810 can be constructed within the controller 180 or can be configured to be separate from the controller 180. The controller 180 may perform a pattern recognition process to recognize a handwriting input or a picture drawing input performed on the touch screen as a character or an image.
电源单元190在控制器180的控制下接收外部电力或内部电力并且提供操作各元件和组件所需的适当的电力。The power supply unit 190 receives external power or internal power under the control of the controller 180 and provides appropriate power required to operate the various components and components.
这里描述的各种实施方式可以以使用例如计算机软件、硬件或其任何组合的计算机可读介质来实施。对于硬件实施,这里描述的实施方式可以通过使用特定用途集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理装置(DSPD)、可编程逻辑装置(PLD)、现场可编程门阵列(FPGA)、处理器、控制器、微控制器、微处理器、被设计为执行这里描述的功能的电子单元中的至少一种来实施,在一些情况下,这样的实施方式可以在控制器180中实施。对于软件实施,诸如过程或功能的实施方式可以与允许执行至少一种功能或操作的单独的软件模块来实施。软件代码可以由以任何适当的编程语言编写的软件应用程序(或程序)来实施,软件代码可以存储在存储器160中并且由控制器180执行。The various embodiments described herein can be implemented in a computer readable medium using, for example, computer software, hardware, or any combination thereof. For hardware implementations, the embodiments described herein may be through the use of application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays ( An FPGA, a processor, a controller, a microcontroller, a microprocessor, at least one of the electronic units designed to perform the functions described herein, in some cases, such an embodiment may be at the controller 180 Implemented in the middle. For software implementations, implementations such as procedures or functions may be implemented with separate software modules that permit the execution of at least one function or operation. The software code can be implemented by a software application (or program) written in any suitable programming language, which can be stored in memory 160 and executed by controller 180.
至此,己经按照其功能描述了移动终端。下面,为了简要起见,将描述诸如折叠型、直板型、摆动型、滑动型移动终端等等的各种类型的移动终端中的滑动型移动终端作为示例。因此,本发明实施例能够应用于任何类型的
移动终端,并且不限于滑动型移动终端。So far, the mobile terminal has been described in terms of its function. Hereinafter, for the sake of brevity, a slide type mobile terminal among various types of mobile terminals such as a folding type, a bar type, a swing type, a slide type mobile terminal, and the like will be described as an example. Therefore, embodiments of the present invention can be applied to any type of
Mobile terminal, and is not limited to a slide type mobile terminal.
如图1中所示的移动终端100可以被构造为利用经由帧或分组发送数据的诸如有线和无线通信***以及基于卫星的通信***来操作。The mobile terminal 100 as shown in FIG. 1 may be configured to operate using a communication system such as a wired and wireless communication system and a satellite-based communication system that transmits data via frames or packets.
现在将参考图2描述其中根据本发明实施例的移动终端能够操作的通信***。A communication system in which a mobile terminal is operable according to an embodiment of the present invention will now be described with reference to FIG.
这样的通信***可以使用不同的空中接口和/或物理层。例如,由通信***使用的空中接口包括例如频分多址(FDMA)、时分多址(TDMA)、码分多址(CDMA)和通用移动通信***(UMTS)(特别地,长期演进(LTE))、全球移动通信***(GSM)等等。作为非限制性示例,下面的描述涉及CDMA通信***,但是这样的教导同样适用于其它类型的***。Such communication systems may use different air interfaces and/or physical layers. For example, air interfaces used by communication systems include, for example, Frequency Division Multiple Access (FDMA), Time Division Multiple Access (TDMA), Code Division Multiple Access (CDMA), and Universal Mobile Telecommunications System (UMTS) (in particular, Long Term Evolution (LTE)). ), Global System for Mobile Communications (GSM), etc. As a non-limiting example, the following description relates to a CDMA communication system, but such teachings are equally applicable to other types of systems.
参考图2,CDMA无线通信***可以包括多个移动终端100、多个基站(BS)270、基站控制器(BSC)275和移动交换中心(MSC)280。MSC280被构造为与公共电话交换网络(PSTN)290形成接口。MSC280还被构造为与可以经由回程线路耦接到基站270的BSC275形成接口。回程线路可以根据若干己知的接口中的任一种来构造,所述接口包括例如E1/T1、ATM,IP、PPP、帧中继、HDSL、ADSL或xDSL。将理解的是,如图2中所示的***可以包括多个BSC2750。Referring to FIG. 2, a CDMA wireless communication system can include a plurality of mobile terminals 100, a plurality of base stations (BS) 270, a base station controller (BSC) 275, and a mobile switching center (MSC) 280. The MSC 280 is configured to interface with a public switched telephone network (PSTN) 290. The MSC 280 is also configured to interface with a BSC 275 that can be coupled to the base station 270 via a backhaul line. The backhaul line can be constructed in accordance with any of a number of well known interfaces including, for example, E1/T1, ATM, IP, PPP, Frame Relay, HDSL, ADSL, or xDSL. It will be appreciated that the system as shown in FIG. 2 may include multiple BSC 2750s.
每个BS270可以服务一个或多个分区(或区域),由多向天线或指向特定方向的天线覆盖的每个分区放射状地远离BS270。或者,每个分区可以由设置为分集接收的两个或更多天线覆盖。每个BS270可以被构造为支持多个频率分配,并且每个频率分配具有特定频谱(例如,1.25MHz,5MHz等等)。Each BS 270 can serve one or more partitions (or regions), each of which is covered by a multi-directional antenna or an antenna directed to a particular direction radially away from the BS 270. Alternatively, each partition may be covered by two or more antennas that are set to receive diversity. Each BS 270 can be configured to support multiple frequency allocations, and each frequency allocation has a particular frequency spectrum (eg, 1.25 MHz, 5 MHz, etc.).
分区与频率分配的交叉可以被称为CDMA信道。BS270也可以被称为基站收发器子***(BTS)或者其它等效术语。在这样的情况下,术语"基站"可以用于笼统地表示单个BSC275和至少一个BS270。基站也可以被称为"蜂窝站"。或者,特定BS270的各分区可以被称为多个蜂窝站。The intersection of partitioning and frequency allocation can be referred to as a CDMA channel. BS 270 may also be referred to as a Base Transceiver Subsystem (BTS) or other equivalent terminology. In such a case, the term "base station" can be used to generally refer to a single BSC 275 and at least one BS 270. A base station can also be referred to as a "cell station." Alternatively, each partition of a particular BS 270 may be referred to as a plurality of cellular stations.
如图2中所示,广播发射器(BT)295将广播信号发送给在***内操作的移动终端100。如图1中所示的广播接收模块111被设置在移动终端100处以接收由BT295发送的广播信号。在图2中,示出了几个全球定位***(GPS)卫星300。
卫星300帮助定位多个移动终端100中的至少一个。As shown in FIG. 2, a broadcast transmitter (BT) 295 transmits a broadcast signal to the mobile terminal 100 operating within the system. A broadcast receiving module 111 as shown in FIG. 1 is provided at the mobile terminal 100 to receive a broadcast signal transmitted by the BT 295. In Figure 2, several Global Positioning System (GPS) satellites 300 are shown.
The satellite 300 helps locate at least one of the plurality of mobile terminals 100.
在图2中,描绘了多个卫星300,但是理解的是,可以利用任何数目的卫星获得有用的定位信息。如图1中所示的GPS模块115通常被构造为与卫星300配合以获得想要的定位信息。替代GPS跟踪技术或者在GPS跟踪技术之外,可以使用可以跟踪移动终端的位置的其它技术。另外,至少一个GPS卫星300可以选择性地或者额外地处理卫星DMB传输。In Figure 2, a plurality of satellites 300 are depicted, but it is understood that useful positioning information can be obtained using any number of satellites. The GPS module 115 as shown in Figure 1 is typically configured to cooperate with the satellite 300 to obtain desired positioning information. Instead of GPS tracking technology or in addition to GPS tracking technology, other techniques that can track the location of the mobile terminal can be used. Additionally, at least one GPS satellite 300 can selectively or additionally process satellite DMB transmissions.
作为无线通信***的一个典型操作,BS270接收来自各种移动终端100的反向链路信号。移动终端100通常参与通话、消息收发和其它类型的通信。特定基站270接收的每个反向链路信号被在特定BS270内进行处理。获得的数据被转发给相关的BSC275。BSC提供通话资源分配和包括BS270之间的软切换过程的协调的移动管理功能。BSC275还将接收到的数据路由到MSC280,其提供用于与PSTN290形成接口的额外的路由服务。类似地,PSTN290与MSC280形成接口,MSC与BSC275形成接口,并且BSC275相应地控制BS270以将正向链路信号发送到移动终端100。As a typical operation of a wireless communication system, BS 270 receives reverse link signals from various mobile terminals 100. Mobile terminal 100 typically participates in calls, messaging, and other types of communications. Each reverse link signal received by a particular base station 270 is processed within a particular BS 270. The obtained data is forwarded to the relevant BSC 275. The BSC provides call resource allocation and coordinated mobility management functions including a soft handoff procedure between the BSs 270. The BSC 275 also routes the received data to the MSC 280, which provides additional routing services for interfacing with the PSTN 290. Similarly, PSTN 290 interfaces with MSC 280, which forms an interface with BSC 275, and BSC 275 controls BS 270 accordingly to transmit forward link signals to mobile terminal 100.
基于上述移动终端硬件结构以及通信***,提出本发明方法各个实施例。Based on the above-described mobile terminal hardware structure and communication system, various embodiments of the method of the present invention are proposed.
如图3所示,本发明第一实施例提出一种获取RGB数据的方法,包括:As shown in FIG. 3, a first embodiment of the present invention provides a method for acquiring RGB data, including:
步骤300、获取图像中R通道/B通道对应的像素的第一水平插值结果和第一垂直插值结果;获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度。Step 300: Acquire a first horizontal interpolation result of the pixel corresponding to the R channel/B channel in the image and a first vertical interpolation result; and obtain a horizontal gradient and a vertical gradient of the pixel corresponding to the R channel/B channel in the image.
本文中,“/”表示可替换的,也就是说重建图像中R通道对应的像素的G通道的像素值和重建图像中B通道对应的像素的G通道的像素值的过程是一样的。Herein, "/" means replaceable, that is, the process of reconstructing the pixel value of the G channel of the pixel corresponding to the R channel in the reconstructed image and the pixel value of the G channel of the pixel corresponding to the B channel in the reconstructed image are the same.
本步骤中,图像是指获取得到的未经处理的原始图像。图4为图像的示意图。如图4所示,图像中的奇数行的格式为RGRG……,偶数行的格式为GBGB……。图4仅仅是图像的一种示意图,并不能代表本发明实施例所能处理的图像的格式,只要是bayer格式的图像均能采用本发明实施例的方法进行插值。In this step, the image refers to the acquired unprocessed original image. Figure 4 is a schematic illustration of an image. As shown in FIG. 4, the format of the odd lines in the image is RGRG..., and the format of the even lines is GBGB. FIG. 4 is only a schematic diagram of an image, and does not represent the format of an image that can be processed by the embodiment of the present invention. Any image in the bayer format can be interpolated by the method of the embodiment of the present invention.
本步骤中,获取图像中R通道/B通道对应的像素的第一水平插值结果和
第一垂直插值结果包括:In this step, the first horizontal interpolation result of the pixel corresponding to the R channel/B channel in the image is obtained.
The first vertical interpolation result includes:
按照公式计算图像中R通道/B通道对应的像素的第一水平插值结果;According to the formula Calculating a first horizontal interpolation result of pixels corresponding to the R channel/B channel in the image;
按照公式计算图像中R通道/B通道对应的像素的第一垂直插值结果;According to the formula Calculating a first vertical interpolation result of pixels corresponding to the R channel/B channel in the image;
其中,g1i1,j1为第一水平插值结果,g2i1,j1为第一垂直插值结果,Gi1,j1-1为图像中第i1行第(j1-1)列的像素的G通道的像素值,Gi1,j1+1为图像中第i1行第(j1+1)列的像素的G通道的像素值,Ai1,j1为图像中第i1行第j1列的像素的R通道/B通道的像素值,Ai1,j1-2为图像中第i1行第(j1-2)列的像素的R通道/B通道的像素值,Ai1,j1+2为图像中第i1行第(j1+2)列的像素的R通道/B通道的像素值;Gi1-1,j1为图像中第(i1-1)行第j1列的像素的G通道的像素值,Gi1+1,j1为图像中第(i1+1)行第j1列的像素的G通道的像素值,Ai1-2,j1为图像中第(i1-2)行第j1列的像素的R通道/B通道的像素值,Ai1+2,j1为图像中第(i1+2)行第j1列的像素的R通道/B通道的像素值。Where g1 i1, j1 are the first horizontal interpolation result, g2 i1, j1 is the first vertical interpolation result, and G i1, j1-1 are the pixels of the G channel of the pixel of the (i1-1)th column (j1-1) column in the image. The value, G i1, j1+1 is the pixel value of the G channel of the pixel in the (i1+1)th column of the i1th row in the image, and A i1, j1 is the R channel/B of the pixel of the i1th row and the j1th column in the image. The pixel value of the channel, A i1, j1-2 is the pixel value of the R channel/B channel of the pixel of the (i1-2)th column in the i1th row of the image, and A i1, j1+2 is the i1th row of the image ( J1+2) the pixel value of the R channel/B channel of the pixel of the column; G i1-1, j1 is the pixel value of the G channel of the pixel of the (j1)th row and the j1th column of the image, G i1+1, J1 is the pixel value of the G channel of the pixel of the j1th column of the (i1+1)th row in the image, and A i1-2, j1 is the R channel/B channel of the pixel of the (j1)th row of the (i1-2)th row in the image. The pixel value, A i1+2, j1 is the pixel value of the R channel/B channel of the pixel of the j1th column of the (i1+2)th row in the image.
本步骤中,获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度包括:In this step, obtaining horizontal and vertical gradients of pixels corresponding to the R channel/B channel in the image includes:
按照公式ΔH1i1,j1=|Gi1-1,j1-Gi1+1,j1|+|2Ai1,j1-Gi1-1,j1-Gi1+1,j1|计算图像中R通道/B通道对应的像素的水平梯度;Calculate the R channel/B in the image according to the formula ΔH1 i1,j1 =|G i1-1,j1 -G i1+1,j1 |+|2A i1,j1 -G i1-1,j1 -G i1+1,j1 | The horizontal gradient of the pixel corresponding to the channel;
按照公式ΔH2i1,j1=|Gi1,j1-1-Gi1,j1+1|+|2Ai1,j1-Gi1,j1-1-Gi1,j1+1|计算图像中R通道/B通道对应的像素的垂直梯度;Calculate the R channel/B in the image according to the formula ΔH2 i1,j1 =|G i1,j1-1 -G i1,j1+1 |+|2A i1,j1 -G i1,j1-1 -G i1,j1+1 | The vertical gradient of the pixel corresponding to the channel;
其中,ΔH1i1,j1为水平梯度,ΔH2i1,j1为垂直梯度。Where ΔH1 i1, j1 is a horizontal gradient, ΔH2 i1, and j1 is a vertical gradient.
步骤301、判断出获得的水平梯度和垂直梯度之间的差值的绝对值大于0且小于第一预设阈值,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的G通道的像素值。Step 301: Determine that the absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than the first preset threshold, and reconstruct the image according to the obtained first horizontal interpolation result and the weighted average of the first vertical difference result. The pixel value of the G channel of the pixel corresponding to the R channel/B channel.
本步骤中,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的G通道的像素值包括:
In this step, the pixel values of the G channel of the pixel corresponding to the R channel/B channel in the weighted average reconstructed image according to the obtained first horizontal interpolation result and the first vertical difference result include:
按照公式重建图像中R通道/B通道对应的像素的重建的G通道的像素值;According to the formula Reconstructing the pixel value of the reconstructed G channel of the pixel corresponding to the R channel/B channel in the image;
其中,gi1,j1为图像中R通道/B通道对应的像素的重建的G通道的像素值。Where g i1, j1 is the pixel value of the reconstructed G channel of the pixel corresponding to the R channel/B channel in the image.
本步骤中,当判断出水平梯度和垂直梯度之间的差值的绝对值等于0时,根据第一水平插值结果和第一垂直差值结果的平均值重建图像中R通道/B通道对应的像素的G通道的像素值。In this step, when it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is equal to 0, the R channel/B channel corresponding to the image is reconstructed according to the average of the first horizontal interpolation result and the first vertical difference result. The pixel value of the G channel of the pixel.
其中,根据第一水平插值结果和第一垂直差值结果的平均值重建图像中R通道/B通道对应的像素的G通道的像素值包括:The pixel values of the G channel of the pixel corresponding to the R channel/B channel in the image are reconstructed according to the average of the first horizontal interpolation result and the first vertical difference result, including:
按照公式重建图像中R通道/B通道对应的像素的G通道的像素值。According to the formula Reconstruct the pixel value of the G channel of the pixel corresponding to the R channel/B channel in the image.
本步骤中,当判断出水平梯度和垂直梯度之间的差值的绝对值大于第一预设阈值,且水平梯度小于垂直梯度时,根据第一水平插值结果重建图像中R通道/B通道对应的像素的G通道的像素值。也就是说,将第一水平插值结果直接作为重建的G通道的像素值。In this step, when it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is smaller than the vertical gradient, the R channel/B channel corresponding to the image is reconstructed according to the first horizontal interpolation result. The pixel value of the G channel of the pixel. That is to say, the first horizontal interpolation result is directly taken as the pixel value of the reconstructed G channel.
本步骤中,当判断出水平梯度和垂直梯度之间的差值的绝对值大于第一预设阈值,且水平梯度大于垂直梯度时,根据第一垂直插值结果重建图像中R通道/B通道对应的像素的G通道的像素值。也就是说,将第一垂直插值结果直接作为重建的G通道的像素值。In this step, when it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is greater than the vertical gradient, the R channel/B channel corresponding to the image is reconstructed according to the first vertical interpolation result. The pixel value of the G channel of the pixel. That is to say, the first vertical interpolation result is directly taken as the pixel value of the reconstructed G channel.
本步骤中,由于在水平梯度和垂直梯度相差不大的时候,例如水平梯度为10,而垂直梯度为13,此时如果能准确的判定这两个梯度是绝对准确的,就可以梯度小的方向(即边缘方向)的插值结果作为最终的插值结果,这样插值结果是最准确的。现在的问题就是,由于噪声(主要因素,噪声是时时存在的)等其他因素的影响,如果仍用计算得到的边缘方向插值结果作为最终结果,不能保证插值结果的准确,这样结果图片中就会出现大量的摩尔纹,严重影响图像视觉质量(实际结果也如此);当两个方向梯度相差比较小的时候,既然不能判断哪个方向作为最终的结果方向(即不能判断当前
边缘为实际的边缘),就将两个方向的插值结果进行加权平均(经实验能大大的减少摩尔纹的产生);而当两个梯度相差比较大的时候,例如:水平梯度为10,垂直梯度为130,这样即便有噪声的影响,可以认为此时能很准确的找准了边缘方向,可以运用此边缘方向的插值结果作为最终结果,而如果此时仍然用两个方向的插值结果进行加权平均,反而使图像质量下降(经实验结果也是如此),故在梯度相差很大时,采用梯度小(即边缘方向)方向结果作为最终的插值结果。In this step, since the horizontal gradient and the vertical gradient are not much different, for example, the horizontal gradient is 10, and the vertical gradient is 13, at this time, if the two gradients can be accurately determined to be absolutely accurate, the gradient can be small. The interpolation result in the direction (ie, the edge direction) is used as the final interpolation result, so that the interpolation result is the most accurate. The problem now is that, due to other factors such as noise (main factor, noise is always present), if the calculated edge direction interpolation result is still used as the final result, the interpolation result cannot be guaranteed, so the result will be in the picture. A large number of moiré appears, which seriously affects the visual quality of the image (the actual result is also the same); when the gradient difference between the two directions is relatively small, since it is impossible to determine which direction is the final result direction (ie, the current direction cannot be judged)
The edge is the actual edge), the weighted average of the interpolation results in both directions (experiment can greatly reduce the generation of moiré); and when the two gradients are relatively large, for example: horizontal gradient is 10, vertical The gradient is 130, so that even if there is noise, it can be considered that the edge direction can be accurately determined at this time, and the interpolation result of the edge direction can be used as the final result, and if the interpolation result in both directions is still used at this time, The weighted average, on the other hand, degrades the image quality (as well as the experimental results), so when the gradients are very different, the result of the small gradient (ie, the edge direction) is used as the final interpolation result.
步骤302、重建图像中G通道对应的像素的R通道/B通道的像素值。Step 302: reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image.
本步骤可以在任意一个步骤之前或之后执行,不受其他步骤的执行顺序影响。This step can be performed before or after any step, and is not affected by the order of execution of the other steps.
本步骤中,重建图像中G通道对应的像素的R通道/B通道的像素值包括:In this step, the pixel values of the R channel/B channel of the pixel corresponding to the G channel in the reconstructed image include:
获取图像中G通道对应的像素的第二水平插值结果或第二垂直插值结果,根据第二水平插值结果或第二垂直插值结果重建图像中G通道对应的像素的R通道/B通道的像素值。Obtaining a second horizontal interpolation result or a second vertical interpolation result of the pixel corresponding to the G channel in the image, and reconstructing a pixel value of the R channel/B channel of the pixel corresponding to the G channel in the image according to the second horizontal interpolation result or the second vertical interpolation result .
其中,获取图像中G通道对应的像素的第二水平插值结果或第二垂直插值结果包括:The second horizontal interpolation result or the second vertical interpolation result of the pixel corresponding to the G channel in the image is:
按照公式计算图像中G通道对应的像素的第二水平插值结果;According to the formula Calculating a second horizontal interpolation result of the pixel corresponding to the G channel in the image;
或按照公式计算图像中G通道对应的像素的第二垂直插值结果;Or according to the formula Calculating a second vertical interpolation result of the pixel corresponding to the G channel in the image;
其中,a1i2,j2为第二水平插值结果,a2i2,j2为第二垂直插值结果,Ai2-1,j2为图像中第(i2-1)行第j2列的像素的R通道/B通道的像素值,Ai2+1,j2为图像中第(i2+1)行第j2列的像素的R通道/B通道的像素值,Gi2,j2为图像中第i2行第j2列的像素的G通道的像素值,Gi2-2,j2为图像中第(i2-2)行第j2列的像素的G通道的像素值,Gi2+2,j2为图像中第(i2+2)行第j2列的像素的G通道的像素值,Ai2,j2-1为图像中第i2行第(j2-1)列的像素的R通道/B通道的像素值,Ai2,j2+1为图像中第i2行第(j2+1)列的像素的R通道/B
通道的像素值,Gi2,j2-2为图像中第i2行第(j2-2)列的像素的G通道的像素值,Gi2,j2+2为图像中第i2行第(j2+2)列的像素的G通道的像素值。Where a1 i2, j2 is the second horizontal interpolation result, a2 i2, j2 is the second vertical interpolation result, and A i2-1, j2 is the R channel/B of the pixel of the (j2-1)th row j2 column in the image. The pixel value of the channel, A i2+1, j2 is the pixel value of the R channel/B channel of the pixel of the ( j2 +1)th row and the j2th column in the image, and G i2, j2 is the i2th row and the j2th column in the image. The pixel value of the G channel of the pixel, G i2-2, j2 is the pixel value of the G channel of the pixel of the (j2-2)th row and the j2th column in the image, and G i2+2, j2 is the image (i2+2) The pixel value of the G channel of the pixel of the j2th column, A i2, j2-1 is the pixel value of the R channel/B channel of the pixel of the (i2-1)th column of the i2th row in the image, A i2, j2+ 1 is the pixel value of the R channel/B channel of the pixel of the (i2th)th column of the i2th row in the image, and G i2, j2-2 is the G channel of the pixel of the (i2th)th column of the i2th row in the image. The pixel value, G i2, j2+2 is the pixel value of the G channel of the pixel of the (i2+2)th column of the i2th row in the image.
步骤303、根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值。Step 303: reconstruct, according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, the pixel value of the B channel of the pixel corresponding to the R channel in the image, and the pixel of the R channel of the pixel corresponding to the B channel in the image. value.
本步骤中,根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道/B通道对应的像素的B通道/R通道的像素值包括:In this step, the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image are reconstructed according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, including:
根据图像中R通道和B通道对应的像素的重建的G通道的像素值计算图像中R通道/B通道对应的像素的45度插值结果和135度插值结果,并计算图像中B通道/R通道对应的像素的45度梯度和135度梯度;判断出45度梯度和135度梯度之间的差值的绝对值大于0且小于第二预设阈值,根据45度插值结果和135度插值结果的加权平均重建图像中R通道/B通道对应的像素的B通道/R通道的像素值。Calculate the 45-degree interpolation result and the 135-degree interpolation result of the pixel corresponding to the R channel/B channel in the image according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, and calculate the B channel/R channel in the image. a 45-degree gradient and a 135-degree gradient of the corresponding pixel; determining that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than 0 and less than the second predetermined threshold, according to the 45-degree interpolation result and the 135-degree interpolation result The weighted average reconstructed pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
其中,根据图像中R通道和B通道对应的像素的重建的G通道的像素值计算图像中R通道/B通道对应的像素的45度插值结果和135度插值结果包括:The 45-degree interpolation result and the 135-degree interpolation result of the pixel corresponding to the R channel/B channel in the image are calculated according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, and the 135 degree interpolation result includes:
按照公式计算图像中R通道/B通道对应的像素的45度插值结果;按照公式计算图像中R通道/B通道对应的像素的135度插值结果;According to the formula Calculate the 45-degree interpolation result of the pixel corresponding to the R channel/B channel in the image; Calculating a 135-degree interpolation result of pixels corresponding to the R channel/B channel in the image;
其中,a1i3,j3为45度插值结果,a2i3,j3为135度插值结果,Ai3-1,j3+1为图像中第(i3-1)行第(j3+1)列的像素的R通道/B通道的像素值,Ai3+1,j3
-1为图像中第(i3+1)行第(j3-1)列的像素的R通道/B通道的像素值,gi3,j3为图像中第i3行第j3列的像素的重建的G通道的像素值,gi3-1,j3+1为图像中第(i3-1)行第(j3+1)列的像素的重建的G通道的像素值,gi3+1,j3-1为图像中第(i3+1)行第(j3-1)列的像素的重建的G通道的像素值,Ai3-1,
j3-1为图像中第(i3-1)行第(j3-1)列的像素的R通道/B通道的像素值,Ai3+1,j3+1为图像中第(i3+1)行第(j3+1)列的像素的R通道/B通道的像素
值,gi3-1,j3-1为图像中第(i3-1)行第(j3-1)列的像素的重建的G通道的像素值,gi3+1,j3+1为图像中第(i3+1)行第(j3+1)列的像素的重建的G通道的像素值。Where a1 i3, j3 are 45-degree interpolation results, a2 i3, j3 are 135-degree interpolation results, and A i3-1, j3+1 are pixels of the (i3-1)th row (j3+1) column in the image. The pixel value of the R channel/B channel, A i3+1, j3 -1 is the pixel value of the R channel/B channel of the pixel of the (i3+1)th row (j3-1) column in the image, g i3, j3 The pixel value of the reconstructed G channel of the pixel of the i3th row and the j3th column in the image, g i3-1, j3+1 is the reconstructed pixel of the (j3+1)th column of the (i3-1)th row in the image. The pixel value of the G channel, g i3+1, j3-1 is the pixel value of the reconstructed G channel of the pixel of the (i3+1)th row (j3-1) column in the image, A i3-1, j3-1 The pixel value of the R channel/B channel of the pixel in the (j3-1)th column of the (i3-1)th line in the image, A i3+1, j3+1 is the (i3+1)th row in the image (j3 +1) the pixel value of the R channel/B channel of the pixel of the column, g i3-1, j3-1 is the pixel of the reconstructed G channel of the pixel of the (i3-1)th row (j3-1) column in the image The value, g i3+1, j3+1 is the pixel value of the reconstructed G channel of the pixel of the (j3+1)th column of the (i3+1)th row in the image.
其中,计算图像中B通道/R通道对应的像素的45度梯度和135度梯度包括:Wherein, calculating a 45 degree gradient and a 135 degree gradient of the pixel corresponding to the B channel/R channel in the image include:
按照公式D45(i3,j3)=|Ai3-1,j3+1-Ai3+1,j3-1|+|2Ci3,j3-Ai3-1,j3+1-Ai3+1,j3-1|计算图像中B通道/R通道对应的像素的45度梯度;按照公式D135(i3,j3)=|Ai3-1,j3-1-Ai3+1,j3+1|+|2Ci3,j3-Ai3-1,j3-1-Ai3+1,j3+1|计算图像中B通道/R通道对应的像素的135度梯度;According to the formula D 45 (i3,j3)=|A i3-1,j3+1 -A i3+1,j3-1 |+|2C i3,j3 -A i3-1,j3+1 -A i3+1, J3-1 | Calculate the 45-degree gradient of the pixel corresponding to the B channel/R channel in the image; according to the formula D 135 (i3,j3)=|A i3-1,j3-1 -A i3+1,j3+1 |+ |2C i3,j3 -A i3-1,j3-1 -A i3+1,j3+1 | Calculate the 135-degree gradient of the pixel corresponding to the B channel/R channel in the image;
其中,D45(i3,j3)为45度梯度,D135(i3,j3)为135度梯度,Ci3,j3为图像中第i3行第j3列的像素的B通道/R通道的像素值。Where D 45 (i3, j3) is a 45 degree gradient, D 135 (i3, j3) is a 135 degree gradient, and C i3, j3 are the pixel values of the B channel/R channel of the pixel of the i3th row and the j3th column in the image. .
其中,根据45度插值结果和135度插值结果的加权平均重建图像中R通道/B通道对应的像素的B通道/R通道的像素值包括:The pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the weighted average reconstructed image according to the 45 degree interpolation result and the 135 degree interpolation result include:
按照公式重建图像中R通道/B通道对应的像素的B通道/R通道的像素值;According to the formula Reconstructing the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image;
其中,ai3,j3为图像中R通道/B通道对应的像素的重建的B通道/R通道的像素值。Where a i3, j3 are the pixel values of the reconstructed B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
其中,当判断出45度梯度和135度梯度之间的差值的绝对值等于0时,根据45度插值结果和135度插值结果的平均值重建图像中R通道/B通道对应的像素的B通道/R通道的像素值。Wherein, when it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is equal to 0, the B of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the average of the 45-degree interpolation result and the 135-degree interpolation result. The pixel value of the channel/R channel.
其中,根据45度插值结果和135度插值结果的平均值重建图像中R通道/B通道对应的像素的B通道/R通道的像素值包括:The pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image are reconstructed according to the 45-degree interpolation result and the average value of the 135-degree interpolation result, including:
按照公式重建图像中R通道/B通道对应的像素的B通道/R通道的像素值;其中,ai3,j3为图像中R通道/B通道对应的像素的重建的B通道/R通道的像素值,a1i3,j3为45度插值结果,a2i3,j3为135度插值结果。According to the formula Reconstructing the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image; wherein a i3, j3 are the pixel values of the reconstructed B channel/R channel of the pixel corresponding to the R channel/B channel in the image, A1 i3, j3 is a 45-degree interpolation result, a2 i3, and j3 are 135-degree interpolation results.
当判断出45度梯度和135度梯度之间的差值的绝对值大于第二预设阈值,且45度梯度小于135度梯度时,根据45度插值结果重建图像中R通道
/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45 degree gradient and the 135 degree gradient is greater than the second predetermined threshold, and the 45 degree gradient is less than the 135 degree gradient, the R channel in the image is reconstructed according to the 45 degree interpolation result
The pixel value of the B channel/R channel of the pixel corresponding to the /B channel.
当判断出45度梯度和135度梯度之间的差值的绝对值大于第二预设阈值,且45度梯度大于135度梯度时,根据135度插值结果重建图像中R通道/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than the second predetermined threshold, and the 45-degree gradient is greater than the 135-degree gradient, the corresponding R channel/B channel in the image is reconstructed according to the 135-degree interpolation result. The pixel value of the B channel/R channel of the pixel.
步骤302中,“/”表示可替换的,也就是说重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值的过程是相类似的。In step 302, "/" means replaceable, that is, the process of reconstructing the pixel value of the B channel of the pixel corresponding to the R channel in the image, and the pixel value of the R channel of the pixel corresponding to the B channel in the image is similar. .
本步骤中,由于在45度梯度和135度梯度相差不大的时候,例如45度梯度为10,而135度梯度为13,此时如果能准确的判定这两个梯度是绝对准确的,就可以梯度小的方向(即边缘方向)的插值结果作为最终的插值结果,这样插值结果是最准确的。现在的问题就是,由于噪声(主要因素,噪声是时时存在的)等其他因素的影响,如果仍用计算得到的边缘方向插值结果作为最终结果,不能保证插值结果的准确,这样结果图片中就会出现大量的摩尔纹,严重影响图像视觉质量(实际结果也如此);当两个方向梯度相差比较小的时候,既然不能判断哪个方向作为最终的结果方向(即不能判断当前边缘为实际的边缘),就将两个方向的插值结果进行加权平均(经实验能大大的减少摩尔纹的产生);而当两个梯度相差比较大的时候,例如:45度梯度为10,135度梯度为130,这样即便有噪声的影响,可以认为此时能很准确的找准了边缘方向,可以运用此边缘方向的插值结果作为最终结果,而如果此时仍然用两个方向的插值结果进行加权平均,反而使图像质量下降(经实验结果也是如此),故在梯度相差很大时,采用梯度小(即边缘方向)方向结果作为最终的插值结果。In this step, since the gradient between the 45-degree gradient and the 135-degree gradient is not large, for example, the gradient of 45 degrees is 10, and the gradient of 135 degrees is 13, if the two gradients can be accurately determined, it is absolutely accurate. The interpolation result in the direction in which the gradient is small (ie, the edge direction) can be used as the final interpolation result, so that the interpolation result is the most accurate. The problem now is that, due to other factors such as noise (main factor, noise is always present), if the calculated edge direction interpolation result is still used as the final result, the interpolation result cannot be guaranteed, so the result will be in the picture. A large number of moiré appears, which seriously affects the visual quality of the image (the actual result is also the same); when the gradient difference between the two directions is relatively small, since it is impossible to determine which direction is the final result direction (ie, the current edge cannot be judged as the actual edge) The weighted average of the interpolation results in both directions (the experiment can greatly reduce the generation of moiré); and when the two gradients are relatively large, for example, the gradient of 45 degrees is 10, and the gradient of 135 degrees is 130. Thus, even if there is noise, it can be considered that the edge direction can be accurately determined at this time, and the interpolation result of the edge direction can be used as the final result, and if the interpolation result of the two directions is still used for the weighted average, Decreased image quality (as well as experimental results), so gradients are used when the gradients are very different (I.e., the edge direction) as a result of the final interpolation result.
通过本发明实施例的方案,在获得的水平梯度和垂直梯度之间的差值的绝对值大于0且小于第一预设阈值时,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道或B通道对应的像素的G通道的像素值,减少了伪彩色和摩尔纹,从而提高了图像的视觉质量。According to the solution of the embodiment of the present invention, when the absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than the first preset threshold, according to the obtained first horizontal interpolation result and the first vertical difference result The weighted average reconstructs the pixel values of the G channel of the pixel corresponding to the R channel or the B channel in the image, reducing the pseudo color and moiré, thereby improving the visual quality of the image.
参照图5,本发明第二实施例还提出了一种获取RGB数据的装置,包括:Referring to FIG. 5, a second embodiment of the present invention further provides an apparatus for acquiring RGB data, including:
获取模块,设置为获取图像中R通道/B通道对应的像素的第一水平插值结果和第一垂直插值结果;获取图像中R通道/B通道对应的像素的水平梯度
和垂直梯度;Obtaining a module, configured to acquire a first horizontal interpolation result and a first vertical interpolation result of pixels corresponding to the R channel/B channel in the image; and obtain a horizontal gradient of the pixel corresponding to the R channel/B channel in the image
And vertical gradients;
第一重建模块,设置为判断出获得的水平梯度和垂直梯度之间的差值的绝对值大于0且小于第一预设阈值,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的G通道的像素值;a first reconstruction module, configured to determine that an absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than a first preset threshold, according to the obtained first horizontal interpolation result and the first vertical difference result Weighted average reconstructed image pixel values of G channels of pixels corresponding to R channels/B channels;
第二重建模块,设置为重建图像中G通道对应的像素的R通道/B通道的像素值;根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值。a second reconstruction module, configured to reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image; and reconstructing an R channel corresponding to the pixel value of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image The pixel value of the B channel of the pixel, and the pixel value of the R channel of the pixel corresponding to the B channel in the image.
本发明实施例的装置中,第一重建模块还设置为:In the apparatus of the embodiment of the present invention, the first reconstruction module is further configured to:
当判断出水平梯度和垂直梯度之间的差值的绝对值等于0时,根据第一水平插值结果和第一垂直差值结果的平均值重建图像中R通道/B通道对应的像素的G通道的像素值。When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is equal to 0, the G channel of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the average of the first horizontal interpolation result and the first vertical difference result The pixel value.
本发明实施例的装置中,第一重建模块还设置为:In the apparatus of the embodiment of the present invention, the first reconstruction module is further configured to:
当判断出水平梯度和垂直梯度之间的差值的绝对值大于第一预设阈值,且水平梯度小于垂直梯度时,根据第一水平插值结果重建图像中R通道/B通道对应的像素的G通道的像素值。When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is smaller than the vertical gradient, reconstructing the G of the pixel corresponding to the R channel/B channel in the image according to the first horizontal interpolation result The pixel value of the channel.
本发明实施例的装置中,第一重建模块还设置为:In the apparatus of the embodiment of the present invention, the first reconstruction module is further configured to:
当判断出水平梯度和垂直梯度之间的差值的绝对值大于第一预设阈值,且水平梯度大于垂直梯度时,根据第一垂直插值结果重建图像中R通道/B通道对应的像素的G通道的像素值。When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is greater than the vertical gradient, reconstructing the G of the pixel corresponding to the R channel/B channel in the image according to the first vertical interpolation result The pixel value of the channel.
本发明实施例的装置中,第二重建模块是设置为:In the apparatus of the embodiment of the present invention, the second reconstruction module is configured to:
获取图像中G通道对应的像素的第二水平插值结果或第二垂直插值结果,根据第二水平插值结果或第二垂直插值结果重建图像中G通道对应的像素的R通道/B通道的像素值;Obtaining a second horizontal interpolation result or a second vertical interpolation result of the pixel corresponding to the G channel in the image, and reconstructing a pixel value of the R channel/B channel of the pixel corresponding to the G channel in the image according to the second horizontal interpolation result or the second vertical interpolation result ;
根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值。
The pixel value of the B channel of the pixel corresponding to the R channel in the image and the pixel value of the R channel of the pixel corresponding to the B channel in the image are reconstructed according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image.
本发明实施例的装置中,第二重建模块是设置为:In the apparatus of the embodiment of the present invention, the second reconstruction module is configured to:
重建图像中G通道对应的像素的R通道/B通道的像素值;Reconstructing the pixel values of the R channel/B channel of the pixel corresponding to the G channel in the image;
根据图像中R通道和B通道对应的像素的重建的G通道的像素值计算图像中R通道/B通道对应的像素的45度插值结果和135度插值结果,并计算图像中B通道/R通道对应的像素的45度梯度和135度梯度;Calculate the 45-degree interpolation result and the 135-degree interpolation result of the pixel corresponding to the R channel/B channel in the image according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, and calculate the B channel/R channel in the image. a 45 degree gradient and a 135 degree gradient of the corresponding pixel;
判断出45度梯度和135度梯度之间的差值的绝对值大于0且小于第二预设阈值,根据45度插值结果和135度插值结果的加权平均重建图像中R通道/B通道对应的像素的B通道/R通道的像素值。Determining that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than 0 and less than the second predetermined threshold, and corresponding to the R channel/B channel in the weighted average reconstructed image according to the 45-degree interpolation result and the 135-degree interpolation result The pixel value of the B channel/R channel of the pixel.
本发明实施例的装置中,第二重建模块还设置为:In the apparatus of the embodiment of the present invention, the second reconstruction module is further configured to:
当判断出45度梯度和135度梯度之间的差值的绝对值等于0时,根据45度插值结果和135度插值结果的平均值重建图像中R通道/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is equal to 0, the B channel of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the 45-degree interpolation result and the average value of the 135-degree interpolation result. The pixel value of the R channel.
本发明实施例的装置中,第二重建模块还设置为:In the apparatus of the embodiment of the present invention, the second reconstruction module is further configured to:
当判断出45度梯度和135度梯度之间的差值的绝对值大于第二预设阈值,且45度梯度小于135度梯度时,根据45度插值结果重建图像中R通道/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than the second predetermined threshold, and the 45-degree gradient is less than the 135-degree gradient, the corresponding R channel/B channel in the image is reconstructed according to the 45-degree interpolation result. The pixel value of the B channel/R channel of the pixel.
本发明实施例的装置中,第二重建模块还设置为:In the apparatus of the embodiment of the present invention, the second reconstruction module is further configured to:
当判断出45度梯度和135度梯度之间的差值的绝对值大于第二预设阈值,且45度梯度大于135度梯度时,根据135度插值结果重建图像中R通道/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than the second predetermined threshold, and the 45-degree gradient is greater than the 135-degree gradient, the corresponding R channel/B channel in the image is reconstructed according to the 135-degree interpolation result. The pixel value of the B channel/R channel of the pixel.
其中,获取模块、第一重建模块和第二重建模块均可以设置在图1的控制器中。The acquisition module, the first reconstruction module, and the second reconstruction module may all be disposed in the controller of FIG. 1.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
It is to be understood that the term "comprises", "comprising", or any other variants thereof, is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes those elements. It also includes other elements that are not explicitly listed, or elements that are inherent to such a process, method, article, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better. Implementation. Based on such understanding, the technical solution of the present invention in essence or the contribution to the related art can be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, CD-ROM). The instructions include a number of instructions for causing a terminal device (which may be a cell phone, computer, server, air conditioner, or network device, etc.) to perform the methods described in various embodiments of the present invention.
以上仅为本发明的可选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above is only an alternative embodiment of the present invention, and thus does not limit the scope of the invention, and the equivalent structure or equivalent process transformation made by using the specification and the drawings of the present invention, or directly or indirectly applied to other related technologies. The fields are all included in the scope of patent protection of the present invention.
上述技术方案减少了伪彩色和摩尔纹,从而提高了图像的视觉质量。
The above technical solution reduces false color and moiré, thereby improving the visual quality of the image.
Claims (20)
- 一种获取红绿蓝RGB数据的装置,包括:A device for obtaining red, green and blue RGB data, comprising:获取模块,设置为获取图像中红R通道/蓝B通道对应的像素的第一水平插值结果和第一垂直插值结果;获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度;Obtaining a module, configured to acquire a first horizontal interpolation result and a first vertical interpolation result of pixels corresponding to a red R channel/blue B channel in the image; and obtain a horizontal gradient and a vertical gradient of pixels corresponding to the R channel/B channel in the image;第一重建模块,设置为判断出获得的水平梯度和垂直梯度之间的差值的绝对值大于0且小于第一预设阈值,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的绿G通道的像素值;a first reconstruction module, configured to determine that an absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and less than a first preset threshold, according to the obtained first horizontal interpolation result and the first vertical difference result Weighted average reconstructed image pixel values of the green G channel of the pixel corresponding to the R channel/B channel;第二重建模块,设置为重建图像中G通道对应的像素的R通道/B通道的像素值;根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值。a second reconstruction module, configured to reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image; and reconstructing an R channel corresponding to the pixel value of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image The pixel value of the B channel of the pixel, and the pixel value of the R channel of the pixel corresponding to the B channel in the image.
- 根据权利要求1所述的装置,The device of claim 1所述第一重建模块,还设置为当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值等于0时,根据所述第一水平插值结果和所述第一垂直差值结果的平均值重建所述图像中R通道/B通道对应的像素的G通道的像素值。The first reconstruction module is further configured to: when determining that an absolute value of a difference between the horizontal gradient and the vertical gradient is equal to 0, according to the first horizontal interpolation result and the first vertical difference The average of the results reconstructs the pixel values of the G channels of the pixels corresponding to the R channel/B channel in the image.
- 根据权利要求1所述的装置,The device of claim 1所述第一重建模块,还设置为当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值大于所述第一预设阈值,且所述水平梯度小于所述垂直梯度时,根据所述第一水平插值结果重建所述图像中R通道/B通道对应的像素的G通道的像素值;The first reconstruction module is further configured to: when it is determined that an absolute value of a difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is smaller than the vertical gradient And reconstructing, according to the first horizontal interpolation result, a pixel value of a G channel of a pixel corresponding to the R channel/B channel in the image;当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值大于所述第一预设阈值,且所述水平梯度大于所述垂直梯度时,根据所述第一垂直插值结果重建所述图像中R通道/B通道对应的像素的G通道的像素值。When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is greater than the vertical gradient, reconstructing according to the first vertical interpolation result The pixel value of the G channel of the pixel corresponding to the R channel/B channel in the image.
- 根据权利要求1或2或3所述的装置,其中,The device according to claim 1 or 2 or 3, wherein所述第二重建模块,是设置为获取所述图像中G通道对应的像素的第二 水平插值结果或第二垂直插值结果,根据所述第二水平插值结果或所述第二垂直插值结果重建所述图像中G通道对应的像素的R通道/B通道的像素值;The second reconstruction module is configured to acquire a second pixel corresponding to the G channel in the image. a horizontal interpolation result or a second vertical interpolation result, and reconstructing, according to the second horizontal interpolation result or the second vertical interpolation result, a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image;根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值。The pixel value of the B channel of the pixel corresponding to the R channel in the image and the pixel value of the R channel of the pixel corresponding to the B channel in the image are reconstructed according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image.
- 根据权利要求1所述的装置,其中,The device according to claim 1, wherein所述第二重建模块,是设置为重建图像中G通道对应的像素的R通道/B通道的像素值;The second reconstruction module is configured to reconstruct a pixel value of an R channel/B channel of a pixel corresponding to the G channel in the image;根据所述图像中R通道和B通道对应的像素的重建的G通道的像素值计算所述图像中R通道/B通道对应的像素的45度插值结果和135度插值结果,并计算所述图像中B通道/R通道对应的像素的45度梯度和135度梯度;Calculating a 45-degree interpolation result and a 135-degree interpolation result of the pixel corresponding to the R channel/B channel in the image according to pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, and calculating the image a 45 degree gradient and a 135 degree gradient of pixels corresponding to the B channel/R channel;判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于0且小于第二预设阈值,根据所述45度插值结果和所述135度插值结果的加权平均重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。Determining that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than 0 and less than a second predetermined threshold, according to the 45-degree interpolation result and the weighted average reconstruction of the 135-degree interpolation result The pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- 根据权利要求5所述的装置,The device according to claim 5,所述第二重建模块,还设置为当判断出所述45度梯度和所述135度梯度之间的差值的绝对值等于0时,根据所述45度插值结果和所述135度插值结果的平均值重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。The second reconstruction module is further configured to: when determining that the absolute value of the difference between the 45 degree gradient and the 135 degree gradient is equal to 0, according to the 45 degree interpolation result and the 135 degree interpolation result The average value reconstructs the pixel values of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- 根据权利要求5所述的装置,The device according to claim 5,所述第二重建模块,还设置为当判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于所述第二预设阈值,且所述45度梯度小于所述135度梯度时,根据所述45度插值结果重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值;The second reconstruction module is further configured to: when it is determined that an absolute value of a difference between the 45 degree gradient and the 135 degree gradient is greater than the second preset threshold, and the 45 degree gradient is smaller than the a 135 degree gradient, reconstructing a pixel value of a B channel/R channel of a pixel corresponding to the R channel/B channel in the image according to the 45 degree interpolation result;当判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于所述第二预设阈值,且所述45度梯度大于所述135度梯度时,根据所述135度插值结果重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than the second predetermined threshold, and the 45-degree gradient is greater than the 135-degree gradient, according to the 135 degrees The interpolation result reconstructs the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- 根据权利要求1所述的装置,其中,获取模块,是设置为通过如下方 式实现获取图像中红R通道/蓝B通道对应的像素的第一水平插值结果和第一垂直插值结果:The apparatus according to claim 1, wherein the acquisition module is set to pass the following The first horizontal interpolation result and the first vertical interpolation result of the pixel corresponding to the red R channel/blue B channel in the image are obtained:按照公式计算图像中R通道/B通道对应的像素的第一水平插值结果;According to the formula Calculating a first horizontal interpolation result of pixels corresponding to the R channel/B channel in the image;按照公式计算图像中R通道/B通道对应的像素的第一垂直插值结果;According to the formula Calculating a first vertical interpolation result of pixels corresponding to the R channel/B channel in the image;其中,g1i1,j1为第一水平插值结果,g2i1,j1为第一垂直插值结果,Gi1,j1-1为图像中第i1行第(j1-1)列的像素的G通道的像素值,Gi1,j1+1为图像中第i1行第(j1+1)列的像素的G通道的像素值,Ai1,j1为图像中第i1行第j1列的像素的R通道/B通道的像素值,Ai1,j1-2为图像中第i1行第(j1-2)列的像素的R通道/B通道的像素值,Ai1,j1+2为图像中第i1行第(j1+2)列的像素的R通道/B通道的像素值;Gi1-1,j1为图像中第(i1-1)行第j1列的像素的G通道的像素值,Gi1+1,j1为图像中第(i1+1)行第j1列的像素的G通道的像素值,Ai1-2,j1为图像中第(i1-2)行第j1列的像素的R通道/B通道的像素值,Ai1+2,j1为图像中第(i1+2)行第j1列的像素的R通道/B通道的像素值。Where g1 i1, j1 are the first horizontal interpolation result, g2 i1, j1 is the first vertical interpolation result, and G i1, j1-1 are the pixels of the G channel of the pixel of the (i1-1)th column (j1-1) column in the image. The value, G i1, j1+1 is the pixel value of the G channel of the pixel in the (i1+1)th column of the i1th row in the image, and A i1, j1 is the R channel/B of the pixel of the i1th row and the j1th column in the image. The pixel value of the channel, A i1, j1-2 is the pixel value of the R channel/B channel of the pixel of the (i1-2)th column in the i1th row of the image, and A i1, j1+2 is the i1th row of the image ( J1+2) the pixel value of the R channel/B channel of the pixel of the column; G i1-1, j1 is the pixel value of the G channel of the pixel of the (j1)th row and the j1th column of the image, G i1+1, J1 is the pixel value of the G channel of the pixel of the j1th column of the (i1+1)th row in the image, and A i1-2, j1 is the R channel/B channel of the pixel of the (j1)th row of the (i1-2)th row in the image. The pixel value, A i1+2, j1 is the pixel value of the R channel/B channel of the pixel of the j1th column of the (i1+2)th row in the image.
- 根据权利要求8所述的装置,其中,获取模块,是设置为通过如下方式实现获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度:The apparatus according to claim 8, wherein the obtaining module is configured to obtain a horizontal gradient and a vertical gradient of pixels corresponding to the R channel/B channel in the image by:按照公式ΔH1i1,j1=|Gi1-1,j1-Gi1+1,j1|+|2Ai1,j1-Gi1-1,j1-Gi1+1,j1|计算图像中R通道/B通道对应的像素的水平梯度;Calculate the R channel/B in the image according to the formula ΔH1 i1,j1 =|G i1-1,j1 -G i1+1,j1 |+|2A i1,j1 -G i1-1,j1 -G i1+1,j1 | The horizontal gradient of the pixel corresponding to the channel;按照公式ΔH2i1,j1=|Gi1,j1-1-Gi1,j1+1|+|2Ai1,j1-Gi1,j1-1-Gi1,j1+1|计算图像中R通道/B通道对应的像素的垂直梯度;Calculate the R channel/B in the image according to the formula ΔH2 i1,j1 =|G i1,j1-1 -G i1,j1+1 |+|2A i1,j1 -G i1,j1-1 -G i1,j1+1 | The vertical gradient of the pixel corresponding to the channel;其中,ΔH1i1,j1为水平梯度,ΔH2i1,j1为垂直梯度。Where ΔH1 i1, j1 is a horizontal gradient, ΔH2 i1, and j1 is a vertical gradient.
- 根据权利要求9所述的装置,其中,第一重建模块是设置为通过如下方式实现根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的绿G通道的像素值:The apparatus according to claim 9, wherein the first reconstruction module is configured to implement the R channel/B channel corresponding to the weighted average reconstructed image according to the obtained first horizontal interpolation result and the first vertical difference result by: The pixel value of the green G channel of the pixel:
- 一种获取红绿蓝RGB数据的方法,包括:A method for obtaining red, green and blue RGB data, comprising:获取图像中红R通道/蓝B通道对应的像素的第一水平插值结果和第一垂直插值结果;获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度;Obtaining a first horizontal interpolation result and a first vertical interpolation result of the pixel corresponding to the red R channel/blue B channel in the image; acquiring a horizontal gradient and a vertical gradient of the pixel corresponding to the R channel/B channel in the image;判断出获得的水平梯度和垂直梯度之间的差值的绝对值大于0且小于第一预设阈值,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的G通道的像素值;Determining that the absolute value of the difference between the obtained horizontal gradient and the vertical gradient is greater than 0 and smaller than the first preset threshold, and reconstructing the R channel in the image according to the obtained first horizontal interpolation result and the weighted average of the first vertical difference result The pixel value of the G channel of the pixel corresponding to the /B channel;重建图像中G通道对应的像素的R通道/B通道的像素值;Reconstructing the pixel values of the R channel/B channel of the pixel corresponding to the G channel in the image;根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道对应的像素的B通道的像素值,以及图像中B通道对应的像素的R通道的像素值。The pixel value of the B channel of the pixel corresponding to the R channel in the image and the pixel value of the R channel of the pixel corresponding to the B channel in the image are reconstructed according to the pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image.
- 根据权利要求11所述的方法,该方法还包括:The method of claim 11 further comprising:当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值等于0时,根据所述第一水平插值结果和所述第一垂直差值结果的平均值重建所述图像中R通道/B通道对应的像素的G通道的像素值。When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is equal to 0, reconstructing R in the image according to the average of the first horizontal interpolation result and the first vertical difference result The pixel value of the G channel of the pixel corresponding to the channel/B channel.
- 根据权利要求11所述的方法,该方法还包括:The method of claim 11 further comprising:当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值大于所述第一预设阈值,且所述水平梯度小于所述垂直梯度时,根据所述第一水平插值结果重建所述图像中R通道/B通道对应的像素的G通道的像素值;When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is smaller than the vertical gradient, reconstructing according to the first horizontal interpolation result a pixel value of a G channel of a pixel corresponding to the R channel/B channel in the image;当判断出所述水平梯度和所述垂直梯度之间的差值的绝对值大于所述第一预设阈值,且所述水平梯度大于所述垂直梯度时,根据所述第一垂直插值结果重建所述图像中R通道/B通道对应的像素的G通道的像素值。When it is determined that the absolute value of the difference between the horizontal gradient and the vertical gradient is greater than the first preset threshold, and the horizontal gradient is greater than the vertical gradient, reconstructing according to the first vertical interpolation result The pixel value of the G channel of the pixel corresponding to the R channel/B channel in the image.
- 根据权利要求11或12或13所述的方法,其中,所述重建图像中G通道对应的像素的R通道/B通道的像素值包括:The method according to claim 11 or 12 or 13, wherein the pixel values of the R channel/B channel of the pixel corresponding to the G channel in the reconstructed image comprise:获取所述图像中G通道对应的像素的第二水平插值结果或第二垂直插值结果,根据所述第二水平插值结果或所述第二垂直插值结果重建所述图像中G通道对应的像素的R通道/B通道的像素值。Obtaining a second horizontal interpolation result or a second vertical interpolation result of the pixel corresponding to the G channel in the image, and reconstructing a pixel corresponding to the G channel in the image according to the second horizontal interpolation result or the second vertical interpolation result The pixel value of the R channel/B channel.
- 根据权利要求11所述的方法,其中,所述根据图像中R通道和B通道对应的像素的重建的G通道的像素值重建图像中R通道/B通道对应的像 素的B通道/R通道的像素值包括:The method according to claim 11, wherein the image corresponding to the R channel/B channel in the image is reconstructed according to the pixel value of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image. The pixel values of the B channel/R channel include:根据所述图像中R通道和B通道对应的像素的重建的G通道的像素值计算所述图像中R通道/B通道对应的像素的45度插值结果和135度插值结果,并计算所述图像中B通道/R通道对应的像素的45度梯度和135度梯度;Calculating a 45-degree interpolation result and a 135-degree interpolation result of the pixel corresponding to the R channel/B channel in the image according to pixel values of the reconstructed G channel of the pixel corresponding to the R channel and the B channel in the image, and calculating the image a 45 degree gradient and a 135 degree gradient of pixels corresponding to the B channel/R channel;判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于0且小于第二预设阈值,根据所述45度插值结果和所述135度插值结果的加权平均重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。Determining that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than 0 and less than a second predetermined threshold, according to the 45-degree interpolation result and the weighted average reconstruction of the 135-degree interpolation result The pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- 根据权利要求15所述的方法,所述根据图像中G通道对应的像素的像素值和重建的G通道的像素值重建图像中R通道/B通道对应的像素的B通道/R通道的像素值还包括:The method according to claim 15, wherein the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the pixel value of the pixel corresponding to the G channel in the image and the pixel value of the reconstructed G channel. Also includes:当判断出所述45度梯度和所述135度梯度之间的差值的绝对值等于0时,根据所述45度插值结果和所述135度插值结果的平均值重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is equal to 0, reconstructing the R channel in the image according to the 45-degree interpolation result and the average value of the 135-degree interpolation result The pixel value of the B channel/R channel of the pixel corresponding to the /B channel.
- 根据权利要求15所述的方法,所述根据图像中G通道对应的像素的像素值和重建的G通道的像素值重建图像中R通道/B通道对应的像素的B通道/R通道的像素值还包括:The method according to claim 15, wherein the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the pixel value of the pixel corresponding to the G channel in the image and the pixel value of the reconstructed G channel. Also includes:当判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于所述第二预设阈值,且所述45度梯度小于所述135度梯度时,根据所述45度插值结果重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值;When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than the second predetermined threshold, and the 45-degree gradient is smaller than the 135-degree gradient, according to the 45 degrees Interpolating results reconstructing pixel values of B channels/R channels of pixels corresponding to R channels/B channels in the image;当判断出所述45度梯度和所述135度梯度之间的差值的绝对值大于所述第二预设阈值,且所述45度梯度大于所述135度梯度时,根据所述135度插值结果重建所述图像中R通道/B通道对应的像素的B通道/R通道的像素值。When it is determined that the absolute value of the difference between the 45-degree gradient and the 135-degree gradient is greater than the second predetermined threshold, and the 45-degree gradient is greater than the 135-degree gradient, according to the 135 degrees The interpolation result reconstructs the pixel value of the B channel/R channel of the pixel corresponding to the R channel/B channel in the image.
- 根据权利要求11所述的方法,其中,获取图像中红R通道/蓝B通道对应的像素的第一水平插值结果和第一垂直插值结果,包括:The method according to claim 11, wherein the obtaining the first horizontal interpolation result and the first vertical interpolation result of the pixel corresponding to the red R channel/blue B channel in the image comprises:按照公式计算图像中R通道/B通道对应的像素的第一水平插值结果;According to the formula Calculating a first horizontal interpolation result of pixels corresponding to the R channel/B channel in the image;按照公式计算图像中R通道/B 通道对应的像素的第一垂直插值结果;According to the formula Calculating a first vertical interpolation result of pixels corresponding to the R channel/B channel in the image;其中,g1i1,j1为第一水平插值结果,g2i1,j1为第一垂直插值结果,Gi1,j1-1为图像中第i1行第(j1-1)列的像素的G通道的像素值,Gi1,j1+1为图像中第i1行第(j1+1)列的像素的G通道的像素值,Ai1,j1为图像中第i1行第j1列的像素的R通道/B通道的像素值,Ai1,j1-2为图像中第i1行第(j1-2)列的像素的R通道/B通道的像素值,Ai1,j1+2为图像中第i1行第(j1+2)列的像素的R通道/B通道的像素值;Gi1-1,j1为图像中第(i1-1)行第j1列的像素的G通道的像素值,Gi1+1,j1为图像中第(i1+1)行第j1列的像素的G通道的像素值,Ai1-2,j1为图像中第(i1-2)行第j1列的像素的R通道/B通道的像素值,Ai1+2,j1为图像中第(i1+2)行第j1列的像素的R通道/B通道的像素值。Where g1 i1, j1 are the first horizontal interpolation result, g2 i1, j1 is the first vertical interpolation result, and G i1, j1-1 are the pixels of the G channel of the pixel of the (i1-1)th column (j1-1) column in the image. The value, G i1, j1+1 is the pixel value of the G channel of the pixel in the (i1+1)th column of the i1th row in the image, and A i1, j1 is the R channel/B of the pixel of the i1th row and the j1th column in the image. The pixel value of the channel, A i1, j1-2 is the pixel value of the R channel/B channel of the pixel of the (i1-2)th column in the i1th row of the image, and A i1, j1+2 is the i1th row of the image ( J1+2) the pixel value of the R channel/B channel of the pixel of the column; G i1-1, j1 is the pixel value of the G channel of the pixel of the (j1)th row and the j1th column of the image, G i1+1, J1 is the pixel value of the G channel of the pixel of the j1th column of the (i1+1)th row in the image, and A i1-2, j1 is the R channel/B channel of the pixel of the (j1)th row of the (i1-2)th row in the image. The pixel value, A i1+2, j1 is the pixel value of the R channel/B channel of the pixel of the j1th column of the (i1+2)th row in the image.
- 根据权利要求18所述的方法,其中,The method of claim 18, wherein获取图像中R通道/B通道对应的像素的水平梯度和垂直梯度包括:Obtaining the horizontal and vertical gradients of the pixels corresponding to the R channel/B channel in the image includes:按照公式ΔH1i1,j1=|Gi1-1,j1-Gi1+1,j1|+|2Ai1,j1-Gi1-1,j1-Gi1+1,j1|计算图像中R通道/B通道对应的像素的水平梯度;Calculate the R channel/B in the image according to the formula ΔH 1i1,j1 =|G i1-1,j1 -G i1+1,j1 |+|2A i1,j1 -G i1-1,j1 -G i1+1,j1 | The horizontal gradient of the pixel corresponding to the channel;按照公式ΔH2i1,j1=|Gi1,j1-1-Gi1,j1+1|+|2Ai1,j1-Gi1,j1-1-Gi1,j1+1|计算图像中R通道/B通道对应的像素的垂直梯度;Calculate the R channel/B in the image according to the formula ΔH 2i1,j1 =|G i1,j1-1 -G i1,j1+1 |+|2A i1,j1 -G i1,j1-1 -G i1,j1+1 | The vertical gradient of the pixel corresponding to the channel;其中,ΔH1i1,j1为水平梯度,ΔH2i1,j1为垂直梯度。Where ΔH1 i1, j1 is a horizontal gradient, ΔH2 i1, and j1 is a vertical gradient.
- 根据权利要求19所述的方法,其中,根据获得的第一水平插值结果和第一垂直差值结果的加权平均重建图像中R通道/B通道对应的像素的G通道的像素值,包括:The method according to claim 19, wherein the pixel value of the G channel of the pixel corresponding to the R channel/B channel in the image is reconstructed according to the obtained first horizontal interpolation result and the weighted average of the first vertical difference result, including:
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510562752.1A CN105160628B (en) | 2015-09-07 | 2015-09-07 | A kind of method and apparatus obtaining RGB data |
CN201510562752.1 | 2015-09-07 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017041714A1 true WO2017041714A1 (en) | 2017-03-16 |
Family
ID=54801471
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/098318 WO2017041714A1 (en) | 2015-09-07 | 2016-09-07 | Method and device for acquiring rgb data |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105160628B (en) |
WO (1) | WO2017041714A1 (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105160628B (en) * | 2015-09-07 | 2018-09-14 | 努比亚技术有限公司 | A kind of method and apparatus obtaining RGB data |
CN105578160A (en) * | 2015-12-23 | 2016-05-11 | 天津天地伟业数码科技有限公司 | Fine definition demosaicking interpolation method based on FPGA platform |
CN108615227B (en) * | 2018-05-08 | 2021-02-26 | 浙江大华技术股份有限公司 | Image moire inhibition method and device |
CN112218062B (en) * | 2020-10-12 | 2022-04-22 | Oppo广东移动通信有限公司 | Image scaling device, electronic device, image scaling method and image processing chip |
CN112712467B (en) * | 2021-01-11 | 2022-11-11 | 郑州科技学院 | Image processing method based on computer vision and color filter array |
CN113259635B (en) * | 2021-06-15 | 2021-10-01 | 珠海亿智电子科技有限公司 | Demosaicing method, demosaicing device, demosaicing equipment and storage medium |
CN113242413B (en) * | 2021-07-12 | 2021-09-21 | 深圳市艾为智能有限公司 | Interpolation calculation method and system for anti-sawtooth RCCB filter array |
CN114004769B (en) * | 2021-12-30 | 2022-03-15 | 江苏游隼微电子有限公司 | Discrete weight-based Bayer denoising color interpolation method |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090066821A1 (en) * | 2007-09-07 | 2009-03-12 | Jeffrey Matthew Achong | Method And Apparatus For Interpolating Missing Colors In A Color Filter Array |
US20100182466A1 (en) * | 2009-01-16 | 2010-07-22 | Samsung Digital Imaging Co., Ltd. | Image interpolation method and apparatus using pattern characteristics of color filter array |
CN104240182A (en) * | 2013-06-06 | 2014-12-24 | 富士通株式会社 | Image processing device, image processing method and electronic equipment |
CN104732561A (en) * | 2013-12-18 | 2015-06-24 | 展讯通信(上海)有限公司 | Image interpolation method and device |
CN105160628A (en) * | 2015-09-07 | 2015-12-16 | 努比亚技术有限公司 | Method and device for acquiring RGB data |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5603676B2 (en) * | 2010-06-29 | 2014-10-08 | オリンパス株式会社 | Image processing apparatus and program |
CN102630019B (en) * | 2012-03-27 | 2014-09-10 | 上海算芯微电子有限公司 | Demosaicking method and device |
CN103561255B (en) * | 2013-10-24 | 2016-01-27 | 洪丹 | A kind of Nakedness-yet stereoscopic display method |
-
2015
- 2015-09-07 CN CN201510562752.1A patent/CN105160628B/en active Active
-
2016
- 2016-09-07 WO PCT/CN2016/098318 patent/WO2017041714A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090066821A1 (en) * | 2007-09-07 | 2009-03-12 | Jeffrey Matthew Achong | Method And Apparatus For Interpolating Missing Colors In A Color Filter Array |
US20100182466A1 (en) * | 2009-01-16 | 2010-07-22 | Samsung Digital Imaging Co., Ltd. | Image interpolation method and apparatus using pattern characteristics of color filter array |
CN104240182A (en) * | 2013-06-06 | 2014-12-24 | 富士通株式会社 | Image processing device, image processing method and electronic equipment |
CN104732561A (en) * | 2013-12-18 | 2015-06-24 | 展讯通信(上海)有限公司 | Image interpolation method and device |
CN105160628A (en) * | 2015-09-07 | 2015-12-16 | 努比亚技术有限公司 | Method and device for acquiring RGB data |
Also Published As
Publication number | Publication date |
---|---|
CN105160628B (en) | 2018-09-14 |
CN105160628A (en) | 2015-12-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017041714A1 (en) | Method and device for acquiring rgb data | |
WO2018019124A1 (en) | Image processing method and electronic device and storage medium | |
WO2017050115A1 (en) | Image synthesis method | |
WO2017020836A1 (en) | Device and method for processing depth image by blurring | |
US8780258B2 (en) | Mobile terminal and method for generating an out-of-focus image | |
WO2017067526A1 (en) | Image enhancement method and mobile terminal | |
WO2016180325A1 (en) | Image processing method and device | |
WO2016058458A1 (en) | Method for managing electric quantity of battery, mobile terminal and computer storage medium | |
WO2018019128A1 (en) | Method for processing night scene image and mobile terminal | |
WO2017071500A1 (en) | Antenna and mobile terminal | |
WO2017071481A1 (en) | Mobile terminal and split-screen implementation method | |
WO2017088629A1 (en) | Method and apparatus for removing image colour noise, mobile terminal, and storage medium | |
WO2017143855A1 (en) | Device with screen capturing function and screen capturing method | |
WO2017071542A1 (en) | Image processing method and apparatus | |
WO2017185865A1 (en) | Antenna, mobile terminal and control method therefor, and storage medium | |
WO2018076938A1 (en) | Method and device for processing image, and computer storage medium | |
WO2017008722A1 (en) | Intranet-extranet separation-based communication method, server and system | |
WO2017071476A1 (en) | Image synthesis method and device, and storage medium | |
WO2017071475A1 (en) | Image processing method, and terminal and storage medium | |
WO2016070681A1 (en) | Method and device for adjusting color temperature of screen, and computer storage medium | |
CN106534693B (en) | A kind of photo processing method, device and terminal | |
WO2017067523A1 (en) | Image processing method, device and mobile terminal | |
WO2017143854A1 (en) | Mobile terminal, volume control method therefor, and computer-readable storage medium | |
CN105430258B (en) | A kind of method and apparatus of self-timer group photo | |
WO2017071592A1 (en) | Method and apparatus for focusing, method and apparatus for photographing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16843652 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 23.07.2018) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16843652 Country of ref document: EP Kind code of ref document: A1 |