WO2017088662A1 - Focusing method and device - Google Patents

Focusing method and device Download PDF

Info

Publication number
WO2017088662A1
WO2017088662A1 PCT/CN2016/105179 CN2016105179W WO2017088662A1 WO 2017088662 A1 WO2017088662 A1 WO 2017088662A1 CN 2016105179 W CN2016105179 W CN 2016105179W WO 2017088662 A1 WO2017088662 A1 WO 2017088662A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
preset
focus
value
area
Prior art date
Application number
PCT/CN2016/105179
Other languages
French (fr)
Chinese (zh)
Inventor
姬向东
Original Assignee
努比亚技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 努比亚技术有限公司 filed Critical 努比亚技术有限公司
Publication of WO2017088662A1 publication Critical patent/WO2017088662A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • H04N23/673Focus control based on electronic image sensor signals based on contrast or high frequency components of image signals, e.g. hill climbing method

Definitions

  • This document relates to, but is not limited to, the field of photographing technology, and in particular to a focusing method and apparatus.
  • the image distance is often adjusted to obtain an image with the largest contrast value, and the image with the largest contrast value is used as the in-focus image, but the above method has a difference between the center area of the image and the surrounding area. , the focus may be focused on the surrounding area of the image, resulting in inaccurate image focus.
  • Embodiments of the present invention provide a focusing method and apparatus, which can achieve accurate focusing.
  • Embodiments of the present invention provide a focusing apparatus, where the focusing apparatus includes:
  • control module configured to adjust an image distance of the image acquisition according to a preset direction
  • the image acquisition module is configured to collect an image at each preset image distance during the adjustment of the image distance
  • a calculation module configured to calculate a contrast value of the plurality of preset focus areas in the collected image, wherein the plurality of preset focus areas are sequentially nested according to the size of the area;
  • a processing module configured to: when the image distance is adjusted to a preset value, a preset focus area having a smallest deviation value between the maximum contrast value and the minimum contrast value in a focus area of the preset interval is used as a to-focus area, where The deviation value is located in a preset interval, where a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value is less than a first preset threshold, or a maximum value of a contrast value of the preset focus area a second ratio to the minimum value is greater than a second predetermined threshold;
  • the focusing module is configured to acquire a maximum contrast value corresponding to the to-be-focused area, and use the acquired image corresponding to the maximum contrast value as the in-focus image.
  • the processing module includes:
  • the first calculating unit is configured to sequentially calculate the deviation value of each of the preset focus areas according to the area of the focus area from small to large; and receive the notification of the processing unit to stop continuing to calculate the deviation of the preset focus area Value, or continue to calculate the deviation value of the preset focus area until the deviation value of all the preset focus areas is calculated;
  • a determining unit configured to determine a deviation value of each preset focus area, and determine whether the deviation value is in a preset interval
  • the processing unit is configured to, when the deviation value is located in the preset interval, use the preset focus area corresponding to the deviation value as the to-be-focused area, and notify the first calculation unit to stop calculating the location of the other focus area Deviating the value; and when the deviation value exceeds the preset interval, notifying the first calculating unit to continue to calculate the deviation value of the next predetermined focus area.
  • the focusing module is further configured to set a default image distance in each of the preset image distances when the deviation values corresponding to each of the preset focus areas exceed the preset interval.
  • the image captured at the location is used as the in-focus image.
  • the calculating module includes:
  • An obtaining unit configured to respectively acquire all pixel information of the image in each focus area in the image
  • the second calculating unit is configured to respectively sum the contrast values of all the pixels in each preset focus area according to the pixel information to obtain a contrast value of each of the preset focus areas.
  • the second calculating unit comprises:
  • the calculation subunit is configured to sum the contrast values of all the pixels of each of the in-focus areas to obtain a contrast value of each of the in-focus areas.
  • the preset direction includes from far to near, or from near to far.
  • the image acquisition module is configured to acquire an image at each preset image distance during the adjustment of the image distance by:
  • Image acquisition is performed by adjusting the image distance of each preset by the image distance
  • image acquisition is performed when the image distance reaches a preset image distance.
  • the contrast value refers to a focus value of the image for embodying the intensity of the image edge information.
  • the obtaining subunit is configured to perform high-pass filtering on each pixel in the image in each of the in-focus regions to obtain a contrast value of each pixel point by:
  • the images in each focus area are sequentially sent to the same high-pass filter for high-pass filtering to obtain the contrast value of each pixel.
  • the calculation module is further configured to store the contrast value of each focus area in association with the focus area.
  • an embodiment of the present invention further provides a focusing method, where the focusing method includes the following steps:
  • an image is acquired at each preset image distance, and the contrast value of the plurality of preset focus areas in the collected image is calculated, wherein the plurality of preset focus areas are sequentially arranged according to the area size Nested
  • a preset focus area having a smallest deviation value between the maximum contrast value and the minimum contrast value in a focus area of the preset interval is used as a to-focus area, wherein the deviation value is located
  • the preset interval is that the first ratio of the minimum value of the contrast value of the preset focus area to the maximum value is smaller than a first preset threshold, or the contrast value of the preset focus area is the most a second ratio of the large value to the minimum value is greater than a second predetermined threshold;
  • the step of using the offset value of the maximum contrast value and the minimum contrast value to be the smallest focus area in the focus area of the preset interval as the to-be-focused area includes:
  • the preset focus area corresponding to the deviation value is currently calculated as the to-be-focused area, and the calculation of the deviation value of the other focus area is stopped;
  • the deviation value of the next predetermined focus area is continuously calculated until the deviation value of all the preset focus areas is calculated.
  • the step of focusing the method further includes:
  • each of the images collected at the default image distance in the preset image distance is taken as the in-focus image.
  • the step of calculating the contrast value of the plurality of preset focus areas in the collected image includes:
  • the step of summing the contrast values of all the pixels in each preset focus area according to the pixel information to obtain the contrast value of each of the preset focus areas includes:
  • the preset direction includes from far to near, or from near to far.
  • acquiring images at each preset image distance includes:
  • Image acquisition is performed by adjusting the image distance of each preset by the image distance
  • image acquisition is performed when the image distance reaches a preset image distance.
  • the contrast value refers to a focus value of the image for embodying the intensity of the image edge information.
  • performing high-pass filtering on each pixel in each image in the focus area to obtain a contrast value of each pixel including:
  • the images in each focus area are sequentially sent to the same high-pass filter for high-pass filtering to obtain the contrast value of each pixel.
  • the method further includes:
  • the contrast value of each focus area is stored in association with the focus area.
  • the focusing method and device controls the focusing motor to move the lens according to a preset direction to adjust the image distance of the image acquisition.
  • the image is acquired at each preset image distance, and the image is calculated and collected.
  • the contrast value of the plurality of preset focus areas in the image wherein the plurality of preset focus areas are sequentially nested according to the area size, and when the lens moves to the preset position, the maximum contrast value and the minimum contrast value deviation are obtained.
  • the smallest focus area of the smallest focus area is used as the to-be-focused area, and the maximum contrast value corresponding to the to-be-focused area is obtained, and the obtained image corresponding to the maximum contrast value is used as the in-focus image to ensure the acquired to-be-focused area.
  • FIG. 1 is a schematic structural diagram of hardware of a mobile terminal that implements various embodiments of the present invention
  • Figure 2 is a block diagram showing the electrical structure of the camera of Figure 1;
  • FIG. 3 is a schematic diagram of functional modules of an optional embodiment of a focusing device according to the present invention.
  • FIG. 5 is a schematic diagram of a refinement function module of a calculation module in a focus device according to an embodiment of the present invention
  • FIG. 6 is a schematic diagram of a refinement function module of a processing module in a focusing device according to an embodiment of the present invention
  • FIG. 7 is a schematic flow chart of an alternative embodiment of a focusing method according to the present invention.
  • FIG. 8 is a schematic diagram of a refinement process for calculating a contrast value of each preset focus area in the collected image in an optional embodiment of the focusing method 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 an optional 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, a user input unit 130, a sensing unit 140, an output unit 150, a memory 160, an interface unit 170, a controller 180, and a power supply unit 190. and many more.
  • 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 device or network.
  • the wireless communication unit may include at least one of a broadcast receiving module 111, a mobile communication module 112, and a wireless internet module 113.
  • 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 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. .
  • DMB Digital Multimedia Broadcasting
  • EPG Digital Video Broadcasting Handheld
  • ESG Electronic Service Guide
  • the broadcast receiving module 111 can receive a signal broadcast by using various types of broadcast apparatuses.
  • 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 device of the @) data broadcasting device, the terrestrial digital broadcasting integrated service (ISDB-T), or the like receives the digital broadcasting.
  • the broadcast receiving module 111 can be constructed as various broadcast apparatuses suitable for providing broadcast signals as well as the above-described digital broadcast apparatuses.
  • 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).
  • 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 technology 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), and the like.
  • 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 122 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 can be displayed on the display unit 151.
  • the image 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 121 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 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, and a connection with an identification module
  • 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.
  • UIM User Identification Module
  • SIM Customer Identification Module
  • USB Universal Customer Identity Module
  • 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 (eg, data information, power, etc.) from an external device and transmit the received input to one or more components within the mobile terminal 100 or may be configured to be 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 a phone call mode, the display unit 151 can display a user interface (UI) or a graphical user interface (GUI) related to a call or other communication (eg, text messaging, multimedia file download, etc.), For example, the camera's viewfinder interface or the camera's control interface can be displayed. 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.
  • 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 pickup, a buzzer, and the like.
  • the memory 160 may store a software program or the like for processing and control operations performed by the controller 180, or may temporarily store data (for example, a phone book, a message, a still image, a video, etc.) that has been output or is to be output. 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.
  • the controller 180 may include a multimedia module 181 configured to reproduce (or play back) multimedia data, which may be constructed within the controller 180 or may 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 ( FPGA), processor, control
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable gate arrays
  • controller microcontroller, microprocessor, at least one of the electronic units designed to perform the functions described herein are implemented, and in some cases, such an implementation may be implemented in the controller 180.
  • 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
  • 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, the embodiment of the present invention can be applied to any type of mobile terminal, and is not limited to a slide type mobile terminal.
  • FIG. 2 is a block diagram of the electrical structure of the camera of FIG. 1.
  • the photographic lens 1211 is composed of a plurality of optical lenses provided to form a subject image, and is a single focus lens or a zoom lens.
  • the photographic lens 1211 is movable in the optical axis direction under the control of the lens driver 1221, and the lens driver 1221 controls the focus position of the photographic lens 1211 in accordance with a control signal from the lens driving control circuit 1222, and can also be controlled in the case of the zoom lens. Focus distance.
  • the lens drive control circuit 1222 performs drive control of the lens driver 1221 in accordance with a control command from the microcomputer 1217.
  • An imaging element 1212 is disposed on the optical axis of the photographic lens 1211 near the position of the subject image formed by the photographic lens 1211.
  • the imaging element 1212 is provided to image the subject image and acquire captured image data.
  • Photodiodes constituting each pixel are arranged two-dimensionally and in a matrix on the imaging element 1212. Each photodiode generates a photoelectric conversion current corresponding to the amount of received light, and the photoelectric conversion current is charged by a capacitor connected to each photodiode.
  • the front surface of each pixel is provided with a Bayer array of RGB color filters.
  • the imaging element 1212 is connected to the imaging circuit 1213.
  • the imaging circuit 1213 performs charge accumulation control and image signal readout control in the imaging element 1212, and performs waveform shaping after reducing the reset noise of the read image signal (analog image signal). Further, gain improvement or the like is performed to obtain an appropriate signal level.
  • the imaging circuit 1213 is connected to the A/D converter 1214, and the A/D converter 1214 is connected to the analog image.
  • the image signal is subjected to analog-to-digital conversion, and a digital image signal (hereinafter referred to as image data) is output to the bus 1227.
  • the bus 1227 is a transmission path set to transfer various data read or generated inside the camera.
  • the A/D converter 1214 is connected to the bus 1227, and an image processor 1215, a JPEG processor 1216, a microcomputer 1217, a SDRAM (Synchronous Dynamic Random Access Memory) 1218, and a memory interface are also connected. (hereinafter referred to as memory I/F) 1219, LCD (Liquid Crystal Display) driver 1220.
  • memory I/F memory I/F
  • LCD Liquid Crystal Display
  • the image processor 1215 is configured to perform OB subtraction processing, white balance adjustment, color matrix calculation, gamma conversion, color difference signal processing, noise removal processing, simultaneous processing, edge processing, and the like on the image data based on the output of the imaging element 1212. Image processing.
  • the JPEG processor 1216 compresses the image data read out from the SDRAM 1218 in accordance with the JPEG compression method when the image data is recorded on the recording medium 1225. Further, the JPEG processor 1216 performs decompression of JPEG image data for image reproduction display.
  • the file recorded on the recording medium 1225 is read, and after the compression processing is performed in the JPEG processor 1216, the decompressed image data is temporarily stored in the SDRAM 1218 and displayed on the LCD 1226.
  • the JPEG method is adopted as the image compression/decompression method.
  • the compression/decompression method is not limited thereto, and other compression/decompression methods such as MPEG, TIFF, and H.264 may be used.
  • the microcomputer 1217 functions as a control unit of the entire camera, and collectively controls various processing sequences of the camera.
  • the microcomputer 1217 is connected to the operation unit 1223 and the flash memory 1224.
  • the operating unit 1223 includes, but is not limited to, a physical button or a virtual button, and the entity or virtual button may be a power button, a camera button, an edit button, a dynamic image button, a reproduction button, a menu button, a cross button, an OK button, a delete button, an enlarge button
  • the operation controls such as various input buttons and various input keys detect the operational state of these operation controls.
  • the detection result is output to the microcomputer 1217. Further, a touch panel is provided on the front surface of the LCD 1226 as a display, and the touch position of the user is detected, and the touch position is output to the microcomputer 1217.
  • the microcomputer 1217 executes various processing sequences corresponding to the user's operation in accordance with the detection result from the operation position of the operation unit 1223.
  • the flash memory 1224 stores programs for executing various processing sequences of the microcomputer 1217.
  • the microcomputer 1217 performs overall control of the camera in accordance with the program. Further, the flash memory 1224 stores various adjustment values of the camera, and the microcomputer 1217 reads out the adjustment value, and performs control of the camera in accordance with the adjustment value.
  • the SDRAM 1218 is an electrically rewriteable volatile that is set to temporarily store image data or the like. Memory.
  • the SDRAM 1218 temporarily stores image data output from the A/D converter 1214 and image data processed in the image processor 1215, the JPEG processor 1216, and the like.
  • the memory interface 1219 is connected to the recording medium 1225, and performs control for writing image data and a file header attached to the image data to the recording medium 1225 and reading out from the recording medium 1225.
  • the recording medium 1225 is, for example, a recording medium such as a memory card that can be detachably attached to the camera body.
  • the recording medium 1225 is not limited thereto, and may be a hard disk or the like built in the camera body.
  • the LCD driver 1210 is connected to the LCD 1226, and stores image data processed by the image processor 1215 in the SDRAM 1218.
  • the image data stored in the SDRAM 1218 is read and displayed on the LCD 1226, or the image data stored in the JPEG processor 1216 is compressed.
  • the JPEG processor 1216 reads the compressed image data of the SDRAM 1218, decompresses it, and displays the decompressed image data through the LCD 1226.
  • the LCD 1226 is configured to display an image on the back of the camera body.
  • the LCD 716 is provided with a touch panel that detects a user's touch operation.
  • the liquid crystal display panel (LCD 1226) is disposed in the present embodiment.
  • the present invention is not limited thereto, and various display panels such as an organic EL panel may be employed.
  • a focus area is taken in the center of the image, and the contrast value of the image in the focus area is calculated, and the image with the largest contrast value is used as the focus image, but the solution requires a certain central area of the image.
  • Edge features if the center area does not have enough edge features and other areas have edge features, it will result in inability to focus to the exact location of the edge features, resulting in inaccurate focus.
  • FIG. 3 is a schematic diagram of functional modules of an optional embodiment of the focusing device of the present invention.
  • the embodiment provides a focusing device, and the focusing device includes:
  • the control module 10 is configured to adjust an image distance of the image acquisition according to a preset direction
  • the preset direction may be from far to near or from near to far, that is, the image distance is from small to large or small to large, and the image distance can be adjusted by adjusting the lens or adjusting the sensor, and the image distance refers to the lens. The distance from the sensor.
  • the image acquisition module 20 is configured to collect an image at each preset image distance during the adjustment of the image distance;
  • the image may be acquired according to a preset image distance interval, the image distance is adjusted every time, or the image capturing operation is performed when the image distance reaches the preset image distance during the image distance adjustment process.
  • the calculating module 30 is configured to calculate a contrast value of the plurality of preset focus areas in each of the collected images, wherein the plurality of preset focus areas are sequentially nested according to the area size;
  • the contrast value refers to the focus value of the image, which mainly reflects the intensity of the edge information, which can be obtained by high-pass filter filtering. There may be multiple contrast values for each preset focus area.
  • a plurality of preset focus areas are sequentially nested according to the size of the area as shown in FIG. 4, the focus area is a Region Of Interest (ROI) in which the camera focuses, and the areas of the focus areas A1, A2, and A3 are sequentially increased, and the A1 is embedded.
  • ROI Region Of Interest
  • Set in A2, A2 is nested in A3.
  • the size of each focus area can be set by the user according to the needs.
  • the number of focus areas can also be adjusted according to the requirements of focus accuracy.
  • the contrast value of each focus area is the sum of the contrast values of all the pixels in each focus area. Referring specifically to FIG. 5, the calculation module 30 includes:
  • the obtaining unit 31 is configured to respectively acquire all pixel information of the image in each focus area in the image;
  • the second calculating unit 32 is configured to respectively sum the contrast values of all the pixel points in each preset focus area according to the pixel information to obtain a contrast value of each of the preset focus areas.
  • the contrast value of each pixel can be obtained by a high pass filter, and the second calculating unit 32 includes:
  • the calculation subunit is configured to sum the contrast values of all the pixels in each of the preset focus areas to obtain the contrast value of each of the preset focus areas.
  • a high-pass filter can be set for each focus area, and images in each focus area are respectively sent to a high-pass filter corresponding to each focus area to calculate a contrast value, which is respectively performed for each pixel point in the focus area during filtering. Filtering, it can be understood that the images in each region can also be sequentially transmitted to the same filter to calculate the contrast value of each focus region.
  • the calculation module is further configured to store the contrast value of each focus area in association with the focus area, and respectively allocate different buffer areas for each focus area to realize the associated storage of the contrast value and the focus area, that is, focus will be
  • the contrast value of the area is stored in the buffer area corresponding to the focus area; or a data saving table of the contrast value may be set for each focus area, and the data storage table is used to realize the association storage of the contrast value and the focus area.
  • the processing module 40 is configured to set, as the to-focus area, a preset focus area with the smallest deviation value between the maximum contrast value and the minimum contrast value in the focus area of the preset interval when the image distance is adjusted to a preset value, where The deviation value is located in a preset interval, where a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value is smaller than a first preset threshold, or a maximum contrast value of the preset focus area a second ratio of the value to the minimum value is greater than a second predetermined threshold;
  • the deviation value is a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value, or a second ratio of the maximum value of the contrast value of the focus area to the minimum value, and the to-be-focused area is the maximum contrast value and
  • the deviation value of the minimum contrast value is located in the preset focus area with the smallest area in the focus area of the preset interval.
  • the acquisition process is as shown in FIG. 6.
  • the processing module 40 includes:
  • the first calculating unit 41 is configured to sequentially calculate the deviation values of each of the preset focus areas according to the area of the focus area from small to large; and receive the notification of the processing unit to stop continuing to calculate the preset focus area. Deviation value, or continue to calculate the deviation value of the preset focus area until the deviation value of all the preset focus areas is calculated;
  • the determining unit 42 is configured to determine whether the deviation value is located in a preset interval every time a deviation value of a preset focus area is acquired;
  • the processing unit 43 is configured to notify the first calculating unit to stop calculating the other focus areas by using the preset focus area corresponding to the deviation value as the to-be-focused area when the deviation value is in the preset interval. The deviation value; and when the deviation value exceeds the preset interval, notifying the first calculation unit to continue to calculate the deviation value of the next predetermined focus area.
  • the focus ratio includes A1, A2, and A3, and the deviation value is taken as an example.
  • the contrast value corresponding to A1 is (K1, K2, K3, ... Kn), and the contrast value corresponding to A2 is (L1).
  • the contrast value corresponding to A3 is (M1, M2, M3...Mn)
  • D1 is less than the first preset threshold
  • A1 is used as the to-be-focused area, and when D1 is greater than or equal to the first preset threshold, the minimum of the contrast value corresponding to A2 is continuously calculated.
  • the first ratio of the value to the maximum value if the calculated first ratio is D2, it is determined whether D2 is smaller than the first preset threshold, and when D2 is smaller than the first preset threshold, A2 is regarded as the to-be-focused region, and D2 is greater than Or equal to the first preset threshold, continue to calculate the first ratio of the minimum value and the maximum value of the contrast values corresponding to A3. If the calculated first ratio is D3, determine whether D3 is less than the first preset threshold, at D3. When it is smaller than the first preset threshold, A3 is regarded as the to-be-focused area, and is greater than D3. Or equal to the first preset threshold, the image corresponding to the preset image distance is taken as the in-focus image. When the deviation value is the second ratio, the process is similar and will not be described here.
  • the contrast values of each focus area can be sorted in order of large to small or small to large to obtain the maximum value and the minimum value. Value; or compare the contrast values in pairs to get the maximum and minimum values.
  • first ratios D1, D2, and D3 corresponding to A1, A2, and A3 can also be calculated at the same time, and the contrast values smaller than the first preset threshold in D1, D2, and D3 are obtained, for example, less than the first preset threshold.
  • the contrast values are D2 and D3, and A2 is used as the area to be focused.
  • the focusing module 50 is configured to acquire a maximum contrast value corresponding to the to-be-focused area, and use the acquired image corresponding to the maximum contrast value as the in-focus image.
  • the maximum contrast value corresponds to an image obtained by the image as the focused image, and the image obtained by the maximum contrast value, and the image corresponding to the maximum contrast value is used as the focused image, that is, the image corresponding to the maximum contrast value is displayed in the finder frame. And obtaining the image corresponding to the maximum contrast value as the image image of the image corresponding to the acquired maximum contrast value, and displaying the image corresponding to the obtained maximum contrast value in the finder frame.
  • the image at the preset image distance can be selected as the focus.
  • the image that is, the focusing module 40, is further configured to: when the deviation value corresponding to each of the preset focus areas exceeds the preset interval, the default image in each of the preset image distances The image acquired from the distance is used as the in-focus image.
  • the focusing device of the embodiment controls the focusing motor to move the lens according to a preset direction to adjust the image distance of the image acquisition.
  • the image is acquired at each preset image distance, and the collected image is calculated.
  • the contrast value of the plurality of preset focus areas in the image wherein the plurality of preset focus areas are sequentially nested according to the size of the area, and when the lens moves to the preset position, the focus with the smallest deviation between the maximum contrast value and the minimum contrast value is obtained.
  • the smallest focus area in the area is used as the to-be-focused area, and the maximum contrast value corresponding to the to-be-focused area is obtained, and the obtained image corresponding to the maximum contrast value is used as the in-focus image to ensure that there is enough in the obtained to-be-focused area.
  • the edge feature while having sufficient edge features in the center region, does not deviate from the edge of the value, making the focus more accurate.
  • the embodiment of the invention further provides a focusing method of the mobile terminal.
  • FIG. 7 is a schematic flowchart of an alternative embodiment of a focusing method according to the present invention.
  • This embodiment provides a focusing method, and the focusing method includes the following steps:
  • Step S10 adjusting the image distance of the image acquisition according to a preset direction
  • the preset direction may be from far to near or from near to far, that is, the image distance is from small to large or small to large, and the image distance can be adjusted by adjusting the lens or adjusting the sensor, and the image distance refers to the lens. The distance from the sensor.
  • Step S20 in the process of adjusting the image distance, acquiring an image at each preset image distance, and calculating a contrast value of the plurality of preset focus areas in the collected image, wherein the plurality of preset focus areas are in accordance with The size of the area is nested in turn;
  • the image may be acquired every time the image distance is adjusted according to the preset image distance interval, or the image capturing operation may be performed when the image distance reaches the preset image distance during the image distance adjustment process.
  • the contrast value refers to the focus value of the image, which mainly reflects the intensity of the edge information, which can be obtained by filtering through a high-pass filter.
  • a plurality of preset focus areas are sequentially nested according to the size of the area as shown in FIG. 4, and the focus areas A1 and A2 are And the area of A3 increases in turn, A1 is nested in A2, A2 is nested in A3, the size of each focus area can be set by the user according to needs, and the number of focus areas can also be adjusted according to the requirements of focus precision.
  • the contrast value of each focus area is the sum of the contrast values of each pixel in each focus area. Referring specifically to FIG. 8, the step S20 includes:
  • Step S21 respectively acquiring all pixel information of the image in each focus area in the image
  • Step S22 summing the contrast values of all the pixel points in each preset focus area according to the pixel information to obtain a contrast value of each of the preset focus areas.
  • the contrast value of each pixel point can be obtained by a high-pass filter, and the step S22 includes:
  • Contrast values of all the pixels in each of the preset focus areas are respectively summed to obtain a contrast value of each of the preset focus areas.
  • a high-pass filter can be set for each focus area, and images in each focus area are respectively sent to a high-pass filter corresponding to each focus area to calculate a contrast value, which is respectively performed for each pixel point in the focus area during filtering. Filtering, it can be understood that the images in each region can also be sequentially transmitted to the same filter to calculate the contrast value of each focus region.
  • the contrast value of each focus area can be stored in association with the focus area, and different buffer areas can be allocated for each focus area to realize the associated storage of the contrast value and the focus area, that is, the contrast value of the focus area is stored in the focus.
  • the buffer area corresponding to the area; or a data saving table for setting a contrast value for each focus area, and the data storage table is used to realize the association storage of the contrast value and the focus area.
  • Step S30 when the image distance is adjusted to a preset value, the preset focus area having the smallest deviation area of the maximum contrast value and the minimum contrast value in the focus area of the preset interval is used as the to-be-focused area, wherein The deviation value is located in a preset interval, where a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value is less than a first preset threshold, or a maximum value of a contrast value of the preset focus area The second ratio of the minimum value is greater than the second predetermined threshold;
  • the second preset threshold is greater than the first preset threshold, and the offset value is the minimum of the contrast value of the focus area a first ratio of the value to the maximum value, or a second ratio of the maximum value of the contrast value of the in-focus area to the minimum value, and the deviation of the maximum contrast value and the minimum contrast value in the to-be-focused area is in a preset interval
  • the preset focus area with the smallest area in the area, that is, step S30 includes:
  • the preset focus area corresponding to the deviation value is currently calculated as the to-be-focused area, and the calculation of the deviation value of the other focus area is stopped;
  • the deviation value of the next predetermined focus area is continuously calculated until the deviation value of all the preset focus areas is calculated.
  • the focus ratio includes A1, A2, and A3, and the deviation value is taken as an example.
  • the contrast value corresponding to A1 is (K1, K2, K3, ... Kn), and the contrast value corresponding to A2 is (L1).
  • the contrast value corresponding to A3 is (M1, M2, M3...Mn)
  • D1 is less than the first preset threshold
  • A1 is used as the to-be-focused area, and when D1 is greater than or equal to the first preset threshold, the minimum of the contrast value corresponding to A2 is continuously calculated.
  • the first ratio of the value to the maximum value if the calculated first ratio is D2, it is determined whether D2 is smaller than the first preset threshold, and when D2 is smaller than the first preset threshold, A2 is regarded as the to-be-focused region, and D2 is greater than Or equal to the first preset threshold, continue to calculate the first ratio of the minimum value and the maximum value of the contrast values corresponding to A3. If the calculated first ratio is D3, determine whether D3 is less than the first preset threshold, at D3. When it is smaller than the first preset threshold, A3 is regarded as the to-be-focused area, and is greater than D3. Or equal to the first preset threshold, the image corresponding to the preset image distance is taken as the in-focus image. When the deviation value is the second ratio, the process is similar to that of the above.
  • the contrast values of each focus area can be sorted in order of large to small or small to large to obtain the maximum value and the minimum value. Value; or compare the contrast values in pairs to get the maximum and minimum values.
  • first ratios D1, D2, and D3 corresponding to A1, A2, and A3 can also be calculated at the same time, and the contrast values smaller than the first preset threshold in D1, D2, and D3 are obtained, for example, less than the first preset threshold.
  • the contrast values are D2 and D3, and A2 is used as the area to be focused.
  • Step S40 Acquire a maximum contrast value corresponding to the to-be-focused area, and use the acquired image corresponding to the maximum contrast value as the in-focus image.
  • the maximum contrast value corresponds to an image obtained by the image as the focused image, and the image obtained by the maximum contrast value, and the image corresponding to the maximum contrast value is used as the focused image, that is, the image corresponding to the maximum contrast value is displayed in the finder frame.
  • the image at the preset image distance can be selected as the in-focus image, that is, the The method further includes: when the deviation value corresponding to each of the preset focus areas exceeds the preset interval, using the image captured by each of the default image distances in the preset image distance as a focus image.
  • the focus motor is controlled to move the lens according to a preset direction to adjust the image distance of the image acquisition, and during the moving process, the image is acquired at each preset image distance, and the collected image is calculated.
  • the contrast value of the plurality of preset focus areas in the image wherein the plurality of preset focus areas are sequentially nested according to the size of the area, and when the lens moves to the preset position, the focus with the smallest deviation between the maximum contrast value and the minimum contrast value is obtained.
  • the smallest focus area in the area is used as the to-be-focused area, and the maximum contrast value corresponding to the to-be-focused area is obtained, and the obtained image corresponding to the maximum contrast value is used as the in-focus image to ensure that there is enough in the obtained to-be-focused area.
  • the edge feature while having sufficient edge features in the center region, does not deviate from the edge of the value, making the focus more accurate.
  • the embodiment of the present invention further provides a mobile terminal, where the mobile terminal includes the focusing device according to any of the above embodiments.
  • the embodiment method can be implemented by means of software plus a necessary general hardware platform, of course, also through hardware, but in many cases the former is a better implementation.
  • 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 technical solution can ensure that there are enough edge features in the acquired to-be-focused area, and when there are enough edge features in the central area, the focus point does not deviate from the value edge area, so that the focus is more accurate.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • Automatic Focus Adjustment (AREA)

Abstract

A focusing device comprises: a control module configured to adjust, according to a predefined direction, an image distance configured to sample an image; an image acquisition module configured to acquire, in a process of adjusting an image distance, the image at each of predefined image distances; a computing module configured to compute contrast values with respect to a plurality of predefined focus areas in the image, wherein the plurality of predefined focus areas are sequentially nested in one another according to area sizes; a processing module configured to set as a focusing area a predefined focus area having a smallest area and having a deviation value between a maximum contrast value and a minimum contrast value thereof within a predefined interval; and a focus module configured to obtain a maximum contrast value corresponding to the focusing area, and set an image corresponding to the maximum contrast to be a focused image. The technical solution prevents a focus point from deviating to a fringe area when a center area contains a sufficient edge property, increasing an accuracy of focusing.

Description

对焦方法和装置Focus method and device 技术领域Technical field
本文涉及但不限于拍照技术领域,尤其涉及一种对焦方法和装置。This document relates to, but is not limited to, the field of photographing technology, and in particular to a focusing method and apparatus.
背景技术Background technique
当前的相机或者相机应用进行自动对焦时,往往通过调整像距,以获取对比度值最大的图像,将对比度值最大的图像作为对焦图像,但上述方式在图像的中心区域以及周围区域前后有落差时,可能会将焦点聚焦至图像的周围区域,导致图像对焦不够准确。When the current camera or camera application performs autofocus, the image distance is often adjusted to obtain an image with the largest contrast value, and the image with the largest contrast value is used as the in-focus image, but the above method has a difference between the center area of the image and the surrounding area. , the focus may be focused on the surrounding area of the image, resulting in inaccurate image focus.
发明内容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.
本发明实施例提供一种对焦方法和装置,能够实现准确对焦。Embodiments of the present invention provide a focusing method and apparatus, which can achieve accurate focusing.
本发明实施例提供一种对焦装置,所述对焦装置包括:Embodiments of the present invention provide a focusing apparatus, where the focusing apparatus includes:
控制模块,设置为按照预设的方向调节图像采集的像距;a control module, configured to adjust an image distance of the image acquisition according to a preset direction;
图像采集模块,设置为在调节像距的过程中,在每个预设像距处采集图像;The image acquisition module is configured to collect an image at each preset image distance during the adjustment of the image distance;
计算模块,设置为计算采集到的所述图像中多个预设对焦区域的对比度值,其中,多个预设对焦区域按照面积大小依次嵌套;a calculation module, configured to calculate a contrast value of the plurality of preset focus areas in the collected image, wherein the plurality of preset focus areas are sequentially nested according to the size of the area;
处理模块,设置为在所述像距调节至预设值时,将最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域作为待对焦区域,其中,所述偏差值位于预设区间为所述预设对焦区域的对比度值的最小值与所述最大值的第一比值小于第一预设阈值,或者所述预设对焦区域的对比度值的最大值与所述最小值的第二比值大于第二预设阈值; a processing module, configured to: when the image distance is adjusted to a preset value, a preset focus area having a smallest deviation value between the maximum contrast value and the minimum contrast value in a focus area of the preset interval is used as a to-focus area, where The deviation value is located in a preset interval, where a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value is less than a first preset threshold, or a maximum value of a contrast value of the preset focus area a second ratio to the minimum value is greater than a second predetermined threshold;
对焦模块,设置为获取所述待对焦区域对应的最大对比度值,将获取的所述最大对比度值对应的图像作为对焦图像。The focusing module is configured to acquire a maximum contrast value corresponding to the to-be-focused area, and use the acquired image corresponding to the maximum contrast value as the in-focus image.
可选地,所述处理模块包括:Optionally, the processing module includes:
第一计算单元,设置为按照对焦区域面积由小到大的顺序依次计算获取每个所述预设对焦区域的所述偏差值;以及接收处理单元的通知,停止继续计算预设对焦区域的偏差值,或继续计算预设对焦区域的偏差值,直至计算完所有所述预设对焦区域的所述偏差值;The first calculating unit is configured to sequentially calculate the deviation value of each of the preset focus areas according to the area of the focus area from small to large; and receive the notification of the processing unit to stop continuing to calculate the deviation of the preset focus area Value, or continue to calculate the deviation value of the preset focus area until the deviation value of all the preset focus areas is calculated;
判断单元,设置为每获取一个预设对焦区域的偏差值,判断在所述偏差值是否位于预设区间;a determining unit, configured to determine a deviation value of each preset focus area, and determine whether the deviation value is in a preset interval;
处理单元,设置为在所述偏差值位于预设区间时,将当前计算所述偏差值对应的所述预设对焦区域作为待对焦区域,通知第一计算单元停止计算所述其它对焦区域的所述偏差值;以及在所述偏差值超出所述预设区间时,通知第一计算单元继续计算下一所述预设对焦区域的所述偏差值。The processing unit is configured to, when the deviation value is located in the preset interval, use the preset focus area corresponding to the deviation value as the to-be-focused area, and notify the first calculation unit to stop calculating the location of the other focus area Deviating the value; and when the deviation value exceeds the preset interval, notifying the first calculating unit to continue to calculate the deviation value of the next predetermined focus area.
可选地,所述对焦模块还设置为在每个所述预设对焦区域对应的所述偏差值均超出所述预设区间时,将每个所述将预设像距中的默认像距处采集到的图像作为对焦图像。Optionally, the focusing module is further configured to set a default image distance in each of the preset image distances when the deviation values corresponding to each of the preset focus areas exceed the preset interval. The image captured at the location is used as the in-focus image.
可选地,所述计算模块包括:Optionally, the calculating module includes:
获取单元,设置为分别获取所述图像中每个对焦区域内中的所述图像的所有像素信息;An obtaining unit configured to respectively acquire all pixel information of the image in each focus area in the image;
第二计算单元,设置为根据所述像素信息分别对每个预设对焦区域内的所有像素点的对比度值进行求和得到每个所述预设对焦区域的对比度值。The second calculating unit is configured to respectively sum the contrast values of all the pixels in each preset focus area according to the pixel information to obtain a contrast value of each of the preset focus areas.
可选地,第二计算单元包括:Optionally, the second calculating unit comprises:
获取子单元,设置为对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值;Obtaining a subunit, configured to perform high-pass filtering on each pixel in each image in the focus area to obtain a contrast value of each pixel;
计算子单元,设置为将分别对每个所述对焦区域的所有像素点的对比度值进行求和得到每个所述对焦区域的对比度值。The calculation subunit is configured to sum the contrast values of all the pixels of each of the in-focus areas to obtain a contrast value of each of the in-focus areas.
可选地,预设方向包括由远及近、或由近及远。 Optionally, the preset direction includes from far to near, or from near to far.
可选地,图像采集模块是设置为通过如下方式实现在调节像距的过程中,在每个预设像距处采集图像:Optionally, the image acquisition module is configured to acquire an image at each preset image distance during the adjustment of the image distance by:
将像距每调节预设的像距间隔,进行图像采集;Image acquisition is performed by adjusting the image distance of each preset by the image distance;
or
在像距调节过程中,在像距到达预设像距时进行图像采集。In the image distance adjustment process, image acquisition is performed when the image distance reaches a preset image distance.
可选地,所述对比度值指图像的聚焦值,用于体现图像边缘信息的强度。Optionally, the contrast value refers to a focus value of the image for embodying the intensity of the image edge information.
可选地,获取子单元是设置为通过如下方式实现对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值:Optionally, the obtaining subunit is configured to perform high-pass filtering on each pixel in the image in each of the in-focus regions to obtain a contrast value of each pixel point by:
对每个对焦区域设置高通滤波器,将每个对焦区域内的图像分别发送至与每个对焦区域对应的高通滤波器中进行高通滤波得到每个像素点的对比度值;Setting a high-pass filter for each focus area, and transmitting an image in each focus area to a high-pass filter corresponding to each focus area for high-pass filtering to obtain a contrast value of each pixel;
or
将每个对焦区域内的图像依次发送至同一高通滤波器进行高通滤波得到每个像素点的对比度值。The images in each focus area are sequentially sent to the same high-pass filter for high-pass filtering to obtain the contrast value of each pixel.
可选地,所述计算模块,还设置为将每个对焦区域的对比度值与对焦区域关联存储。Optionally, the calculation module is further configured to store the contrast value of each focus area in association with the focus area.
此外,本发明实施例还提供了一种对焦方法,所述对焦方法包括以下步骤:In addition, an embodiment of the present invention further provides a focusing method, where the focusing method includes the following steps:
按照预设的方向调节图像采集的像距;Adjust the image distance of the image acquisition according to the preset direction;
在调节像距的过程中,在每个预设像距处采集图像,并计算采集到的所述图像中多个预设对焦区域的对比度值,其中,多个预设对焦区域按照面积大小依次嵌套;In the process of adjusting the image distance, an image is acquired at each preset image distance, and the contrast value of the plurality of preset focus areas in the collected image is calculated, wherein the plurality of preset focus areas are sequentially arranged according to the area size Nested
在所述像距调节至预设值时,将最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域作为待对焦区域,其中,所述偏差值位于预设区间为所述预设对焦区域的对比度值的最小值与所述最大值的第一比值小于第一预设阈值,或者所述预设对焦区域的对比度值的最 大值与所述最小值的第二比值大于第二预设阈值;When the image distance is adjusted to a preset value, a preset focus area having a smallest deviation value between the maximum contrast value and the minimum contrast value in a focus area of the preset interval is used as a to-focus area, wherein the deviation value is located The preset interval is that the first ratio of the minimum value of the contrast value of the preset focus area to the maximum value is smaller than a first preset threshold, or the contrast value of the preset focus area is the most a second ratio of the large value to the minimum value is greater than a second predetermined threshold;
获取所述待对焦区域对应的最大对比度值,将获取的所述最大对比度值对应的图像作为对焦图像。Obtaining a maximum contrast value corresponding to the to-be-focused area, and using the acquired image corresponding to the maximum contrast value as the in-focus image.
可选地,所述将最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域作为待对焦区域的步骤包括:Optionally, the step of using the offset value of the maximum contrast value and the minimum contrast value to be the smallest focus area in the focus area of the preset interval as the to-be-focused area includes:
按照对焦区域面积由小到大的顺序依次计算获取每个所述预设对焦区域的所述偏差值;And obtaining the deviation value of each of the preset focus areas in order according to an area of the focus area being small to large;
为每获取一个预设对焦区域的偏差值,判断在所述偏差值是否位于预设区间;Determining whether the deviation value is in a preset interval for each deviation value of a preset focus area;
在所述偏差值位于预设区间时,将当前计算所述偏差值对应的所述预设对焦区域作为待对焦区域,并停止计算所述其它对焦区域的所述偏差值;When the deviation value is in the preset interval, the preset focus area corresponding to the deviation value is currently calculated as the to-be-focused area, and the calculation of the deviation value of the other focus area is stopped;
在所述偏差值超出所述预设区间时,继续计算下一所述预设对焦区域的所述偏差值,直至计算完所有所述预设对焦区域的所述偏差值。When the deviation value exceeds the preset interval, the deviation value of the next predetermined focus area is continuously calculated until the deviation value of all the preset focus areas is calculated.
可选地,所述计算采集到的所述图像中多个预设对焦区域的对比度值的步骤之后,所述对焦方法步骤还包括:Optionally, after the step of calculating the contrast value of the plurality of preset focus areas in the collected image, the step of focusing the method further includes:
在每个所述预设对焦区域对应的所述偏差值均超出所述预设区间时,将每个所述将预设像距中的默认像距处采集到的图像作为对焦图像。When the deviation value corresponding to each of the preset focus areas exceeds the preset interval, each of the images collected at the default image distance in the preset image distance is taken as the in-focus image.
可选地,所述计算采集到的所述图像中多个预设对焦区域的对比度值的步骤包括:Optionally, the step of calculating the contrast value of the plurality of preset focus areas in the collected image includes:
分别获取所述图像中每个对焦区域内中的所述图像的所有像素信息;Acquiring all pixel information of the image in each focus area in the image, respectively;
根据所述像素信息分别对每个预设对焦区域内的所有像素点的对比度值进行求和得到每个所述预设对焦区域的对比度值。And comparing the contrast values of all the pixels in each preset focus area according to the pixel information to obtain a contrast value of each of the preset focus areas.
可选地,所述根据所述像素信息分别对每个预设对焦区域内的所有像素点的对比度值进行求和得到每个所述预设对焦区域的对比度值的步骤包括:Optionally, the step of summing the contrast values of all the pixels in each preset focus area according to the pixel information to obtain the contrast value of each of the preset focus areas includes:
对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值;Performing high-pass filtering on each pixel in each image in the in-focus area to obtain a contrast value of each pixel;
分别对每个所述对焦区域的所有像素点的对比度值进行求和得到每个所 述对焦区域的对比度值。Separating the contrast values of all the pixels of each of the in-focus areas to obtain each The contrast value of the focus area.
可选地,预设方向包括由远及近、或由近及远。Optionally, the preset direction includes from far to near, or from near to far.
可选地,在调节像距的过程中,在每个预设像距处采集图像包括:Optionally, in the process of adjusting the image distance, acquiring images at each preset image distance includes:
将像距每调节预设的像距间隔,进行图像采集;Image acquisition is performed by adjusting the image distance of each preset by the image distance;
or
在像距调节过程中,在像距到达预设像距时进行图像采集。In the image distance adjustment process, image acquisition is performed when the image distance reaches a preset image distance.
可选地,所述对比度值指图像的聚焦值,用于体现图像边缘信息的强度。Optionally, the contrast value refers to a focus value of the image for embodying the intensity of the image edge information.
可选地,对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值,包括:Optionally, performing high-pass filtering on each pixel in each image in the focus area to obtain a contrast value of each pixel, including:
对每个对焦区域设置高通滤波器,将每个对焦区域内的图像分别发送至与每个对焦区域对应的高通滤波器中进行高通滤波得到每个像素点的对比度值;Setting a high-pass filter for each focus area, and transmitting an image in each focus area to a high-pass filter corresponding to each focus area for high-pass filtering to obtain a contrast value of each pixel;
or
将每个对焦区域内的图像依次发送至同一高通滤波器进行高通滤波得到每个像素点的对比度值。The images in each focus area are sequentially sent to the same high-pass filter for high-pass filtering to obtain the contrast value of each pixel.
可选地,所述方法还包括:Optionally, the method further includes:
在计算采集到的所述图像中多个预设对焦区域的对比度值后,将每个对焦区域的对比度值与对焦区域关联存储。After calculating the contrast values of the plurality of preset focus areas in the acquired image, the contrast value of each focus area is stored in association with the focus area.
本发明实施例提出的对焦方法和装置,控制调焦马达按照预设的方向移动镜头,以调节图像采集的像距,在移动过程中,在每个预设像距采集图像,并计算采集到的所述图像中多个预设对焦区域的对比度值,其中,多个预设对焦区域按照面积大小依次嵌套,在所述镜头移动至预设位置时,获取最大对比度值与最小对比度值偏差最小的对焦区域中最小的对焦区域作为待对焦区域,并获取所述待对焦区域对应的最大对比度值,将获取的所述最大对比度值对应的图像作为对焦图像,以保证获取到的待对焦区域中有足够的边缘特征,同时在中心区域中有足够边缘特征时,对焦点不会偏离值边缘区域, 使得对焦更加准确。The focusing method and device provided by the embodiment of the invention controls the focusing motor to move the lens according to a preset direction to adjust the image distance of the image acquisition. During the moving process, the image is acquired at each preset image distance, and the image is calculated and collected. The contrast value of the plurality of preset focus areas in the image, wherein the plurality of preset focus areas are sequentially nested according to the area size, and when the lens moves to the preset position, the maximum contrast value and the minimum contrast value deviation are obtained. The smallest focus area of the smallest focus area is used as the to-be-focused area, and the maximum contrast value corresponding to the to-be-focused area is obtained, and the obtained image corresponding to the maximum contrast value is used as the in-focus image to ensure the acquired to-be-focused area. There are enough edge features in the middle, and when there are enough edge features in the center area, the focus point does not deviate from the value edge area. Make the focus more accurate.
在阅读并理解了附图和详细描述后,可以明白其他方面。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中相机的电气结构框图;Figure 2 is a block diagram showing the electrical structure of the camera of Figure 1;
图3为本发明对焦装置可选实施例的功能模块示意图;3 is a schematic diagram of functional modules of an optional embodiment of a focusing device according to the present invention;
图4为对焦区域的示意图;4 is a schematic view of a focus area;
图5为本发明实施例对焦装置中计算模块的细化功能模块示意图;5 is a schematic diagram of a refinement function module of a calculation module in a focus device according to an embodiment of the present invention;
图6为本发明实施例对焦装置中处理模块的细化功能模块示意图;6 is a schematic diagram of a refinement function module of a processing module in a focusing device according to an embodiment of the present invention;
图7为本发明对焦方法可选实施例的流程示意图;7 is a schematic flow chart of an alternative embodiment of a focusing method according to the present invention;
图8为本发明对焦方法可选实施例中计算采集到的所述图像中各个预设对焦区域的对比度值的细化流程示意图。FIG. 8 is a schematic diagram of a refinement process for calculating a contrast value of each preset focus area in the collected image in an optional embodiment of the focusing method of the present invention.
本发明的实施方式Embodiments of the invention
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。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为实现本发明各个实施例的一个可选的移动终端的硬件结构示意。1 is a schematic diagram showing the hardware structure of an optional 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, a user input unit 130, a sensing unit 140, an output unit 150, a memory 160, an interface unit 170, a controller 180, and a power supply unit 190. and many more. 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中的至少一个。 Wireless communication unit 110 typically includes one or more components that permit radio communication between mobile terminal 100 and a wireless communication device or network. For example, the wireless communication unit may include at least one of a broadcast receiving module 111, a mobile communication module 112, and a wireless internet module 113.
广播接收模块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 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 apparatuses. 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 device of the @) data broadcasting device, the terrestrial digital broadcasting integrated service (ISDB-T), or the like receives the digital broadcasting. The broadcast receiving module 111 can be constructed as various broadcast apparatuses suitable for providing broadcast signals as well as the above-described digital broadcast apparatuses. 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 technology 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), and the like.
A/V输入单元120设置为接收音频或视频信号。A/V输入单元120可以包括相机121和麦克风122,相机121对在视频捕获模式或图像捕获模式中由图像捕获装置获得的静态图片或视频的图像数据进行处理。处理后的图像可以显示在显示单元151上。经相机121处理后的图像可以存储在存储器160(或其它存储介质)中或者经由无线通信单元110进行发送,可以根据移动终端的构造提供两个或更多相机121。麦克风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 122 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 can be displayed on the display unit 151. The image 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 121 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 touch panel is superimposed on the display unit 151 in the form of a layer, 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 of the mobile terminal 100 or the speed of movement and direction, 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, and a connection with an identification module The device's port, 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 (eg, data information, power, etc.) from an external device and transmit the received input to one or more components within the mobile terminal 100 or may be configured to be 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 a phone call mode, the display unit 151 can display a user interface (UI) or a graphical user interface (GUI) related to a call or other communication (eg, text messaging, multimedia file download, etc.), For example, the camera's viewfinder interface or the camera's control interface can be displayed. 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.
音频输出模块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 pickup, a buzzer, and the like.
存储器160可以存储由控制器180执行的处理和控制操作的软件程序等等,或者可以暂时地存储己经输出或将要输出的数据(例如,电话簿、消息、静态图像、视频等等)。而且,存储器160可以存储关于当触摸施加到触摸屏时输出的各种方式的振动和音频信号的数据。The memory 160 may store a software program or the like for processing and control operations performed by the controller 180, or may temporarily store data (for example, a phone book, a message, a still image, a video, etc.) that has been output or is to be output. 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可以包括设置为再现(或回放)多媒体数据的多媒体模块181,多媒体模块181可以构造在控制器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. In addition, the controller 180 may include a multimedia module 181 configured to reproduce (or play back) multimedia data, which may be constructed within the controller 180 or may 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 ( FPGA), processor, control The controller, microcontroller, microprocessor, at least one of the electronic units designed to perform the functions described herein are implemented, and in some cases, such an implementation may be implemented in the controller 180. 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, the embodiment of the present invention can be applied to any type of mobile terminal, and is not limited to a slide type mobile terminal.
参照图2,图2为图1中相机的电气结构框图。2, FIG. 2 is a block diagram of the electrical structure of the camera of FIG. 1.
摄影镜头1211由设置为形成被摄体像的多个光学镜头构成,为单焦点镜头或变焦镜头。摄影镜头1211在镜头驱动器1221的控制下能够在光轴方向上移动,镜头驱动器1221根据来自镜头驱动控制电路1222的控制信号,控制摄影镜头1211的焦点位置,在变焦镜头的情况下,也可控制焦点距离。镜头驱动控制电路1222按照来自微型计算机1217的控制命令进行镜头驱动器1221的驱动控制。The photographic lens 1211 is composed of a plurality of optical lenses provided to form a subject image, and is a single focus lens or a zoom lens. The photographic lens 1211 is movable in the optical axis direction under the control of the lens driver 1221, and the lens driver 1221 controls the focus position of the photographic lens 1211 in accordance with a control signal from the lens driving control circuit 1222, and can also be controlled in the case of the zoom lens. Focus distance. The lens drive control circuit 1222 performs drive control of the lens driver 1221 in accordance with a control command from the microcomputer 1217.
在摄影镜头1211的光轴上、由摄影镜头1211形成的被摄体像的位置附近配置有摄像元件1212。摄像元件1212设置为对被摄体像摄像并取得摄像图像数据。在摄像元件1212上二维且呈矩阵状配置有构成各像素的光电二极管。各光电二极管产生与受光量对应的光电转换电流,该光电转换电流由与各光电二极管连接的电容器进行电荷蓄积。各像素的前表面配置有拜耳排列的RGB滤色器。An imaging element 1212 is disposed on the optical axis of the photographic lens 1211 near the position of the subject image formed by the photographic lens 1211. The imaging element 1212 is provided to image the subject image and acquire captured image data. Photodiodes constituting each pixel are arranged two-dimensionally and in a matrix on the imaging element 1212. Each photodiode generates a photoelectric conversion current corresponding to the amount of received light, and the photoelectric conversion current is charged by a capacitor connected to each photodiode. The front surface of each pixel is provided with a Bayer array of RGB color filters.
摄像元件1212与摄像电路1213连接,该摄像电路1213在摄像元件1212中进行电荷蓄积控制和图像信号读出控制,对该读出的图像信号(模拟图像信号)降低重置噪声后进行波形整形,进而进行增益提高等以成为适当的信号电平。The imaging element 1212 is connected to the imaging circuit 1213. The imaging circuit 1213 performs charge accumulation control and image signal readout control in the imaging element 1212, and performs waveform shaping after reducing the reset noise of the read image signal (analog image signal). Further, gain improvement or the like is performed to obtain an appropriate signal level.
摄像电路1213与A/D转换器1214连接,该A/D转换器1214对模拟图 像信号进行模数转换,向总线1227输出数字图像信号(以下称之为图像数据)。The imaging circuit 1213 is connected to the A/D converter 1214, and the A/D converter 1214 is connected to the analog image. The image signal is subjected to analog-to-digital conversion, and a digital image signal (hereinafter referred to as image data) is output to the bus 1227.
总线1227是设置为传送在相机的内部读出或生成的各种数据的传送路径。在总线1227连接着上述A/D转换器1214,此外还连接着图像处理器1215、JPEG处理器1216、微型计算机1217、SDRAM(Synchronous Dynamic random access memory,同步动态随机存取内存)1218、存储器接口(以下称之为存储器I/F)1219、LCD(Liquid Crystal Display,液晶显示器)驱动器1220。The bus 1227 is a transmission path set to transfer various data read or generated inside the camera. The A/D converter 1214 is connected to the bus 1227, and an image processor 1215, a JPEG processor 1216, a microcomputer 1217, a SDRAM (Synchronous Dynamic Random Access Memory) 1218, and a memory interface are also connected. (hereinafter referred to as memory I/F) 1219, LCD (Liquid Crystal Display) driver 1220.
图像处理器1215设置为对基于摄像元件1212的输出的图像数据进行OB相减处理、白平衡调整、颜色矩阵运算、伽马转换、色差信号处理、噪声去除处理、同时化处理、边缘处理等各种图像处理。JPEG处理器1216在将图像数据记录于记录介质1225时,按照JPEG压缩方式压缩从SDRAM1218读出的图像数据。此外,JPEG处理器1216为了进行图像再现显示而进行JPEG图像数据的解压缩。进行解压缩时,读出记录在记录介质1225中的文件,在JPEG处理器1216中实施了解压缩处理后,将解压缩的图像数据暂时存储于SDRAM1218中并在LCD1226上进行显示。另外,在本实施方式中,作为图像压缩解压缩方式采用的是JPEG方式,然而压缩解压缩方式不限于此,当然可以采用MPEG、TIFF、H.264等其他的压缩解压缩方式。The image processor 1215 is configured to perform OB subtraction processing, white balance adjustment, color matrix calculation, gamma conversion, color difference signal processing, noise removal processing, simultaneous processing, edge processing, and the like on the image data based on the output of the imaging element 1212. Image processing. The JPEG processor 1216 compresses the image data read out from the SDRAM 1218 in accordance with the JPEG compression method when the image data is recorded on the recording medium 1225. Further, the JPEG processor 1216 performs decompression of JPEG image data for image reproduction display. At the time of decompression, the file recorded on the recording medium 1225 is read, and after the compression processing is performed in the JPEG processor 1216, the decompressed image data is temporarily stored in the SDRAM 1218 and displayed on the LCD 1226. Further, in the present embodiment, the JPEG method is adopted as the image compression/decompression method. However, the compression/decompression method is not limited thereto, and other compression/decompression methods such as MPEG, TIFF, and H.264 may be used.
微型计算机1217发挥作为该相机整体的控制部的功能,统一控制相机的各种处理序列。微型计算机1217连接着操作单元1223和闪存1224。The microcomputer 1217 functions as a control unit of the entire camera, and collectively controls various processing sequences of the camera. The microcomputer 1217 is connected to the operation unit 1223 and the flash memory 1224.
操作单元1223包括但不限于实体按键或者虚拟按键,该实体或虚拟按键可以为电源按钮、拍照键、编辑按键、动态图像按钮、再现按钮、菜单按钮、十字键、OK按钮、删除按钮、放大按钮等各种输入按钮和各种输入键等操作控件,检测这些操作控件的操作状态。The operating unit 1223 includes, but is not limited to, a physical button or a virtual button, and the entity or virtual button may be a power button, a camera button, an edit button, a dynamic image button, a reproduction button, a menu button, a cross button, an OK button, a delete button, an enlarge button The operation controls such as various input buttons and various input keys detect the operational state of these operation controls.
将检测结果向微型计算机1217输出。此外,在作为显示器的LCD1226的前表面设有触摸面板,检测用户的触摸位置,将该触摸位置向微型计算机1217输出。微型计算机1217根据来自操作单元1223的操作位置的检测结果,执行与用户的操作对应的各种处理序列。The detection result is output to the microcomputer 1217. Further, a touch panel is provided on the front surface of the LCD 1226 as a display, and the touch position of the user is detected, and the touch position is output to the microcomputer 1217. The microcomputer 1217 executes various processing sequences corresponding to the user's operation in accordance with the detection result from the operation position of the operation unit 1223.
闪存1224存储用于执行微型计算机1217的各种处理序列的程序。微型计算机1217根据该程序进行相机整体的控制。此外,闪存1224存储相机的各种调整值,微型计算机1217读出调整值,按照该调整值进行相机的控制。The flash memory 1224 stores programs for executing various processing sequences of the microcomputer 1217. The microcomputer 1217 performs overall control of the camera in accordance with the program. Further, the flash memory 1224 stores various adjustment values of the camera, and the microcomputer 1217 reads out the adjustment value, and performs control of the camera in accordance with the adjustment value.
SDRAM1218是设置为对图像数据等进行暂时存储的可电改写的易失性 存储器。该SDRAM1218暂时存储从A/D转换器1214输出的图像数据和在图像处理器1215、JPEG处理器1216等中进行了处理后的图像数据。The SDRAM 1218 is an electrically rewriteable volatile that is set to temporarily store image data or the like. Memory. The SDRAM 1218 temporarily stores image data output from the A/D converter 1214 and image data processed in the image processor 1215, the JPEG processor 1216, and the like.
存储器接口1219与记录介质1225连接,进行将图像数据和附加在图像数据中的文件头等数据写入记录介质1225和从记录介质1225中读出的控制。记录介质1225例如为能够在相机主体上自由拆装的存储器卡等记录介质,然而不限于此,也可以是内置在相机主体中的硬盘等。The memory interface 1219 is connected to the recording medium 1225, and performs control for writing image data and a file header attached to the image data to the recording medium 1225 and reading out from the recording medium 1225. The recording medium 1225 is, for example, a recording medium such as a memory card that can be detachably attached to the camera body. However, the recording medium 1225 is not limited thereto, and may be a hard disk or the like built in the camera body.
LCD驱动器1210与LCD1226连接,将由图像处理器1215处理后的图像数据存储于SDRAM1218,需要显示时,读取SDRAM1218存储的图像数据并在LCD1226上显示,或者,JPEG处理器1216压缩过的图像数据存储于SDRAM1218,在需要显示时,JPEG处理器1216读取SDRAM1218的压缩过的图像数据,再进行解压缩,将解压缩后的图像数据通过LCD1226进行显示。The LCD driver 1210 is connected to the LCD 1226, and stores image data processed by the image processor 1215 in the SDRAM 1218. When display is required, the image data stored in the SDRAM 1218 is read and displayed on the LCD 1226, or the image data stored in the JPEG processor 1216 is compressed. In the SDRAM 1218, when display is required, the JPEG processor 1216 reads the compressed image data of the SDRAM 1218, decompresses it, and displays the decompressed image data through the LCD 1226.
LCD1226配置在相机主体的背面进行图像显示。该LCD716设有检测用户的触摸操作的触摸面板。另外,作为显示部,在本实施例中配置的是液晶表示面板(LCD1226),然而不限于此,也可以采用有机EL面板等各种显示面板。The LCD 1226 is configured to display an image on the back of the camera body. The LCD 716 is provided with a touch panel that detects a user's touch operation. Further, as the display portion, the liquid crystal display panel (LCD 1226) is disposed in the present embodiment. However, the present invention is not limited thereto, and various display panels such as an organic EL panel may be employed.
基于上述移动终端硬件结构以及相机的电气结构示意图,提出本发明方法各个实施例。Based on the hardware structure of the above mobile terminal and the electrical structure diagram of the camera, various embodiments of the method of the present invention are proposed.
一种可选方式中,在图像中心取一对焦区域,并计算该对焦区域内图像的对比度值,将计算得到的对比度值最大的图像作为对焦图像,但该方案要求图像的中心区域有一定的边缘特征,如果中心区域没有足够的边缘特征而其他区域有边缘特征,则会导致不能对焦至边缘特征准确的位置,导致对焦不准确。In an optional manner, a focus area is taken in the center of the image, and the contrast value of the image in the focus area is calculated, and the image with the largest contrast value is used as the focus image, but the solution requires a certain central area of the image. Edge features, if the center area does not have enough edge features and other areas have edge features, it will result in inability to focus to the exact location of the edge features, resulting in inaccurate focus.
其他方式,如图3所示,图3为本发明对焦装置可选实施例的功能模块示意图。Other manners, as shown in FIG. 3, FIG. 3 is a schematic diagram of functional modules of an optional embodiment of the focusing device of the present invention.
本实施例提出一种对焦装置,所述对焦装置包括:The embodiment provides a focusing device, and the focusing device includes:
控制模块10,设置为按照预设的方向调节图像采集的像距; The control module 10 is configured to adjust an image distance of the image acquisition according to a preset direction;
在本实施例中,该预设方向可为由远及近或者由近及远,即像距由小到达或者由大到小,可通过调节镜头或者调节传感器调节像距,像距是指镜头与传感器之间的距离。In this embodiment, the preset direction may be from far to near or from near to far, that is, the image distance is from small to large or small to large, and the image distance can be adjusted by adjusting the lens or adjusting the sensor, and the image distance refers to the lens. The distance from the sensor.
图像采集模块20,设置为在调节像距的过程中,在每个预设像距处采集图像;The image acquisition module 20 is configured to collect an image at each preset image distance during the adjustment of the image distance;
在本实施例中,可按照预设的像距间隔,像距每调节一定距离,则采集图像,或者在像距调节过程中在像距到达预设像距时进行图像采集的操作。In this embodiment, the image may be acquired according to a preset image distance interval, the image distance is adjusted every time, or the image capturing operation is performed when the image distance reaches the preset image distance during the image distance adjustment process.
计算模块30,设置为计算采集到的每个图像中多个预设对焦区域的对比度值,其中,多个预设对焦区域按照面积大小依次嵌套;The calculating module 30 is configured to calculate a contrast value of the plurality of preset focus areas in each of the collected images, wherein the plurality of preset focus areas are sequentially nested according to the area size;
对比度值是指图像的聚焦值focus value,主要体现的是边缘信息的强度,可通过高通滤波器滤波得到,每个预设对焦区域的对比度值可以有多个。The contrast value refers to the focus value of the image, which mainly reflects the intensity of the edge information, which can be obtained by high-pass filter filtering. There may be multiple contrast values for each preset focus area.
多个预设对焦区域按照面积大小依次嵌套如图4所示,对焦区域为相机对焦的感兴趣区域(Region Of Interest,ROI),对焦区域A1、A2以及A3的面积依次增大,A1嵌套在A2内,A2嵌套在A3内,每个对焦区域的大小可由用户根据需要进行设置,对焦区域的数量也可根据对焦精度的需求进行调整。每个对焦区域的对比度值为每个对焦区域内的所有像素点的对比度值之和,具体参照图5,所述计算模块30包括:A plurality of preset focus areas are sequentially nested according to the size of the area as shown in FIG. 4, the focus area is a Region Of Interest (ROI) in which the camera focuses, and the areas of the focus areas A1, A2, and A3 are sequentially increased, and the A1 is embedded. Set in A2, A2 is nested in A3. The size of each focus area can be set by the user according to the needs. The number of focus areas can also be adjusted according to the requirements of focus accuracy. The contrast value of each focus area is the sum of the contrast values of all the pixels in each focus area. Referring specifically to FIG. 5, the calculation module 30 includes:
获取单元31,设置为分别获取所述图像中每个对焦区域内中的所述图像的所有像素信息;The obtaining unit 31 is configured to respectively acquire all pixel information of the image in each focus area in the image;
第二计算单元32,设置为根据所述像素信息分别对每个预设对焦区域内的所有所述像素点的对比度值进行求和得到每个所述预设对焦区域的对比度值。The second calculating unit 32 is configured to respectively sum the contrast values of all the pixel points in each preset focus area according to the pixel information to obtain a contrast value of each of the preset focus areas.
每个像素点的对比度值可由高通滤波器得到,所述第二计算单元32包括:The contrast value of each pixel can be obtained by a high pass filter, and the second calculating unit 32 includes:
获取子单元,设置为对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值;Obtaining a subunit, configured to perform high-pass filtering on each pixel in each image in the focus area to obtain a contrast value of each pixel;
计算子单元,设置为将分别对每个预设对焦区域内的所有像素点的对比度值进行求和得到每个所述预设对焦区域的对比度值。 The calculation subunit is configured to sum the contrast values of all the pixels in each of the preset focus areas to obtain the contrast value of each of the preset focus areas.
可针对每个对焦区域设置高通滤波器,每个对焦区域内的图像分别发送至每个对焦区域对应的高通滤波器中以计算对比度值,在滤波时分别针对对焦区域中的每个像素点进行滤波,可以理解的是,也可将每个区域内的图像依次发送至同一滤波器以计算每个对焦区域的对比度值。A high-pass filter can be set for each focus area, and images in each focus area are respectively sent to a high-pass filter corresponding to each focus area to calculate a contrast value, which is respectively performed for each pixel point in the focus area during filtering. Filtering, it can be understood that the images in each region can also be sequentially transmitted to the same filter to calculate the contrast value of each focus region.
所述计算模块,还设置为将每个对焦区域的对比度值与该对焦区域关联存储,可针对每个对焦区域分别分配不同的缓存区域来实现对比度值与对焦区域的关联存储,即,将对焦区域的对比度值存储于该对焦区域对应的缓存区域内;或者可针对每个对焦区域设置对比度值的数据保存表,通过该数据保存表来实现对比度值与对焦区域的关联存储。The calculation module is further configured to store the contrast value of each focus area in association with the focus area, and respectively allocate different buffer areas for each focus area to realize the associated storage of the contrast value and the focus area, that is, focus will be The contrast value of the area is stored in the buffer area corresponding to the focus area; or a data saving table of the contrast value may be set for each focus area, and the data storage table is used to realize the association storage of the contrast value and the focus area.
处理模块40,设置为在所述像距调节至预设值时,将最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域作为待对焦区域,其中,所述偏差值位于预设区间为所述预设对焦区域的对比度值的最小值与所述最大值的第一比值小于第一预设阈值,或者所述预设对焦区域的对比度值的最大值与所述最小值的第二比值大于第二预设阈值;The processing module 40 is configured to set, as the to-focus area, a preset focus area with the smallest deviation value between the maximum contrast value and the minimum contrast value in the focus area of the preset interval when the image distance is adjusted to a preset value, where The deviation value is located in a preset interval, where a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value is smaller than a first preset threshold, or a maximum contrast value of the preset focus area a second ratio of the value to the minimum value is greater than a second predetermined threshold;
偏差值为预设对焦区域的对比度值的最小值与所述最大值的第一比值,或者对焦区域的对比度值的最大值与所述最小值的第二比值,待对焦区域为最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域,获取过程参照图6,所述处理模块40包括:The deviation value is a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value, or a second ratio of the maximum value of the contrast value of the focus area to the minimum value, and the to-be-focused area is the maximum contrast value and The deviation value of the minimum contrast value is located in the preset focus area with the smallest area in the focus area of the preset interval. The acquisition process is as shown in FIG. 6. The processing module 40 includes:
第一计算单元41,设置为按照对焦区域面积由小到大的顺序依次计算获取每个所述预设对焦区域的所述偏差值;以及接收处理单元的通知,停止继续计算预设对焦区域的偏差值,或继续计算预设对焦区域的偏差值,直至计算完所有所述预设对焦区域的所述偏差值;The first calculating unit 41 is configured to sequentially calculate the deviation values of each of the preset focus areas according to the area of the focus area from small to large; and receive the notification of the processing unit to stop continuing to calculate the preset focus area. Deviation value, or continue to calculate the deviation value of the preset focus area until the deviation value of all the preset focus areas is calculated;
判断单元42,设置为每获取一个预设对焦区域的偏差值,判断在所述偏差值是否位于预设区间;The determining unit 42 is configured to determine whether the deviation value is located in a preset interval every time a deviation value of a preset focus area is acquired;
处理单元43,设置为在所述偏差值位于预设区间时,将当前计算所述偏差值对应的所述预设对焦区域作为待对焦区域,通知第一计算单元停止计算所述其它对焦区域的所述偏差值;以及在所述偏差值超出所述预设区间时,通知第一计算单元继续计算下一所述预设对焦区域的所述偏差值。 The processing unit 43 is configured to notify the first calculating unit to stop calculating the other focus areas by using the preset focus area corresponding to the deviation value as the to-be-focused area when the deviation value is in the preset interval. The deviation value; and when the deviation value exceeds the preset interval, notifying the first calculation unit to continue to calculate the deviation value of the next predetermined focus area.
参照图4,以对焦区域包括A1、A2以及A3以及偏差值为第一比值为例进行说明,A1对应的对比度值为(K1、K2、K3…Kn),A2对应的对比度值为(L1、L2、L3…Ln),A3对应的对比度值为(M1、M2、M3…Mn),先计算A1对应的对比度值中最小值与最大值的第一比值,若计算出的第一比值为D1,则判断D1是否小于第一预设阈值,在D1小于第一预设阈值时,将A1作为待对焦区域,在D1大于或等于第一预设阈值时,继续计算A2对应的对比度值中最小值与最大值的第一比值,若计算出的第一比值为D2,则判断D2是否小于第一预设阈值,在D2小于第一预设阈值时,将A2作为待对焦区域,在D2大于或等于第一预设阈值时,继续计算A3对应的对比度值中最小值与最大值的第一比值,若计算出的第一比值为D3,则判断D3是否小于第一预设阈值,在D3小于第一预设阈值时,将A3作为待对焦区域,在D3大于或等于第一预设阈值时,将预设像距对应的图像作为对焦图像。该偏差值为第二比值时,过程类似在此不再赘述。Referring to FIG. 4, the focus ratio includes A1, A2, and A3, and the deviation value is taken as an example. The contrast value corresponding to A1 is (K1, K2, K3, ... Kn), and the contrast value corresponding to A2 is (L1). L2, L3...Ln), the contrast value corresponding to A3 is (M1, M2, M3...Mn), first calculate the first ratio of the minimum value and the maximum value of the contrast value corresponding to A1, and if the calculated first ratio is D1 And determining whether D1 is smaller than the first preset threshold. When D1 is less than the first preset threshold, A1 is used as the to-be-focused area, and when D1 is greater than or equal to the first preset threshold, the minimum of the contrast value corresponding to A2 is continuously calculated. The first ratio of the value to the maximum value, if the calculated first ratio is D2, it is determined whether D2 is smaller than the first preset threshold, and when D2 is smaller than the first preset threshold, A2 is regarded as the to-be-focused region, and D2 is greater than Or equal to the first preset threshold, continue to calculate the first ratio of the minimum value and the maximum value of the contrast values corresponding to A3. If the calculated first ratio is D3, determine whether D3 is less than the first preset threshold, at D3. When it is smaller than the first preset threshold, A3 is regarded as the to-be-focused area, and is greater than D3. Or equal to the first preset threshold, the image corresponding to the preset image distance is taken as the in-focus image. When the deviation value is the second ratio, the process is similar and will not be described here.
在上述获取每个对焦区域中的对比度值最大值以及对比度值最小值时,可对每个对焦区域的对比度值按照由大到小或者由小到大的顺序进行排序,以获取最大值以及最小值;或者将对比度值进行两两比对以获取最大值以及最小值。When the maximum value of the contrast value and the minimum value of the contrast value in each focus area are obtained as described above, the contrast values of each focus area can be sorted in order of large to small or small to large to obtain the maximum value and the minimum value. Value; or compare the contrast values in pairs to get the maximum and minimum values.
可以理解的是,也可同时计算A1、A2以及A3对应的第一比值D1、D2以及D3,并获取D1、D2以及D3中小于第一预设阈值的对比度值,例如小于第一预设阈值的对比度值为D2和D3,则将A2作为待对焦区域。It can be understood that the first ratios D1, D2, and D3 corresponding to A1, A2, and A3 can also be calculated at the same time, and the contrast values smaller than the first preset threshold in D1, D2, and D3 are obtained, for example, less than the first preset threshold. The contrast values are D2 and D3, and A2 is used as the area to be focused.
对焦模块50,设置为获取所述待对焦区域对应的最大对比度值,将获取的所述最大对比度值对应的图像作为对焦图像。The focusing module 50 is configured to acquire a maximum contrast value corresponding to the to-be-focused area, and use the acquired image corresponding to the maximum contrast value as the in-focus image.
最大对比度值对应图像作为对焦图像为,最大对比度值对应的像距时获取到的图像,将最大对比度值对应的图像作为对焦图像即在取景框显示该最大对比度值对应的图像。将获取的所述最大对比度值对应的图像作为对焦图像即将像距调节为获取的所述最大对比度值对应的图像的像距,并在取景框中显示获取的所述最大对比度值对应的图像。The maximum contrast value corresponds to an image obtained by the image as the focused image, and the image obtained by the maximum contrast value, and the image corresponding to the maximum contrast value is used as the focused image, that is, the image corresponding to the maximum contrast value is displayed in the finder frame. And obtaining the image corresponding to the maximum contrast value as the image image of the image corresponding to the acquired maximum contrast value, and displaying the image corresponding to the obtained maximum contrast value in the finder frame.
可以理解的是,在每个对焦区域的对比度值偏差值均超出预设区间时,说明每个对焦区域的对焦效果均较差,则可选取预设像距处的图像作为对焦 图像,即所述对焦模块40,还设置为在每个所述预设对焦区域对应的所述偏差值均超出所述预设区间时,将每个所述将预设像距中的默认像距处采集到的图像作为对焦图像。It can be understood that when the contrast value deviation value of each focus area exceeds the preset interval, indicating that the focus effect of each focus area is poor, the image at the preset image distance can be selected as the focus. The image, that is, the focusing module 40, is further configured to: when the deviation value corresponding to each of the preset focus areas exceeds the preset interval, the default image in each of the preset image distances The image acquired from the distance is used as the in-focus image.
本实施例提出的对焦装置,控制调焦马达按照预设的方向移动镜头,以调节图像采集的像距,在移动过程中,在每个预设像距采集图像,并计算采集到的所述图像中多个预设对焦区域的对比度值,其中,多个预设对焦区域按照面积大小依次嵌套,在所述镜头移动至预设位置时,获取最大对比度值与最小对比度值偏差最小的对焦区域中最小的对焦区域作为待对焦区域,并获取所述待对焦区域对应的最大对比度值,将获取的所述最大对比度值对应的图像作为对焦图像,以保证获取到的待对焦区域中有足够的边缘特征,同时在中心区域中有足够边缘特征时,对焦点不会偏离值边缘区域,使得对焦更加准确。The focusing device of the embodiment controls the focusing motor to move the lens according to a preset direction to adjust the image distance of the image acquisition. During the moving process, the image is acquired at each preset image distance, and the collected image is calculated. The contrast value of the plurality of preset focus areas in the image, wherein the plurality of preset focus areas are sequentially nested according to the size of the area, and when the lens moves to the preset position, the focus with the smallest deviation between the maximum contrast value and the minimum contrast value is obtained. The smallest focus area in the area is used as the to-be-focused area, and the maximum contrast value corresponding to the to-be-focused area is obtained, and the obtained image corresponding to the maximum contrast value is used as the in-focus image to ensure that there is enough in the obtained to-be-focused area. The edge feature, while having sufficient edge features in the center region, does not deviate from the edge of the value, making the focus more accurate.
本发明实施例还提供一种移动终端的对焦方法。The embodiment of the invention further provides a focusing method of the mobile terminal.
如图7所示,图7为本发明对焦方法可选实施例的流程示意图。As shown in FIG. 7, FIG. 7 is a schematic flowchart of an alternative embodiment of a focusing method according to the present invention.
本实施例提出一种对焦方法,所述对焦方法包括以下步骤:This embodiment provides a focusing method, and the focusing method includes the following steps:
步骤S10,按照预设的方向调节图像采集的像距;Step S10, adjusting the image distance of the image acquisition according to a preset direction;
在本实施例中,该预设方向可为由远及近或者由近及远,即像距由小到达或者由大到小,可通过调节镜头或者调节传感器调节像距,像距是指镜头与传感器之间的距离。In this embodiment, the preset direction may be from far to near or from near to far, that is, the image distance is from small to large or small to large, and the image distance can be adjusted by adjusting the lens or adjusting the sensor, and the image distance refers to the lens. The distance from the sensor.
步骤S20,在调节像距的过程中,在每个预设像距处采集图像,并计算采集到的所述图像中多个预设对焦区域的对比度值,其中,多个预设对焦区域按照面积大小依次嵌套;Step S20, in the process of adjusting the image distance, acquiring an image at each preset image distance, and calculating a contrast value of the plurality of preset focus areas in the collected image, wherein the plurality of preset focus areas are in accordance with The size of the area is nested in turn;
在本实施例中,可按照预设的像距间隔像距每调节一定距离,则采集图像,或者在像距调节过程中在像距到达预设像距时进行图像采集的操作。In this embodiment, the image may be acquired every time the image distance is adjusted according to the preset image distance interval, or the image capturing operation may be performed when the image distance reaches the preset image distance during the image distance adjustment process.
对比度值是指图像的聚焦值focus value,主要体现的是边缘信息的强度,可通过高通滤波器滤波得到。The contrast value refers to the focus value of the image, which mainly reflects the intensity of the edge information, which can be obtained by filtering through a high-pass filter.
多个预设对焦区域按照面积大小依次嵌套如图4所示,对焦区域A1、A2 以及A3的面积依次增大,A1嵌套在A2内,A2嵌套在A3内,每个对焦区域的大小可由用户根据需要进行设置,对焦区域的数量也可根据对焦精度的需求进行调整。每个对焦区域的对比度值为每个对焦区域内的每个像素点的对比度值之和,具体参照图8,所述步骤S20包括:A plurality of preset focus areas are sequentially nested according to the size of the area as shown in FIG. 4, and the focus areas A1 and A2 are And the area of A3 increases in turn, A1 is nested in A2, A2 is nested in A3, the size of each focus area can be set by the user according to needs, and the number of focus areas can also be adjusted according to the requirements of focus precision. The contrast value of each focus area is the sum of the contrast values of each pixel in each focus area. Referring specifically to FIG. 8, the step S20 includes:
步骤S21,分别获取所述图像中每个对焦区域内中的所述图像的所有像素信息;Step S21, respectively acquiring all pixel information of the image in each focus area in the image;
步骤S22,根据所述像素信息分别对每个预设对焦区域内的所有像素点的对比度值进行求和得到每个所述预设对焦区域的对比度值。Step S22, summing the contrast values of all the pixel points in each preset focus area according to the pixel information to obtain a contrast value of each of the preset focus areas.
每个像素点的对比度值可由高通滤波器得到,所述步骤S22包括:The contrast value of each pixel point can be obtained by a high-pass filter, and the step S22 includes:
对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值;Performing high-pass filtering on each pixel in each image in the in-focus area to obtain a contrast value of each pixel;
分别对每个所述预设对焦区域内的所有像素点的对比度值进行求和得到每个所述预设对焦区域的对比度值。Contrast values of all the pixels in each of the preset focus areas are respectively summed to obtain a contrast value of each of the preset focus areas.
可针对每个对焦区域设置高通滤波器,每个对焦区域内的图像分别发送至每个对焦区域对应的高通滤波器中以计算对比度值,在滤波时分别针对对焦区域中的每个像素点进行滤波,可以理解的是,也可将每个区域内的图像依次发送至同一滤波器以计算每个对焦区域的对比度值。A high-pass filter can be set for each focus area, and images in each focus area are respectively sent to a high-pass filter corresponding to each focus area to calculate a contrast value, which is respectively performed for each pixel point in the focus area during filtering. Filtering, it can be understood that the images in each region can also be sequentially transmitted to the same filter to calculate the contrast value of each focus region.
每个对焦区域的对比度值可与该对焦区域关联存储,可针对每个对焦区域分别分配不同的缓存区域来实现对比度值与对焦区域的关联存储,即,将对焦区域的对比度值存储于该对焦区域对应的缓存区域内;或者可针对每个对焦区域设置对比度值的数据保存表,通过该数据保存表来实现对比度值与对焦区域的关联存储。The contrast value of each focus area can be stored in association with the focus area, and different buffer areas can be allocated for each focus area to realize the associated storage of the contrast value and the focus area, that is, the contrast value of the focus area is stored in the focus. The buffer area corresponding to the area; or a data saving table for setting a contrast value for each focus area, and the data storage table is used to realize the association storage of the contrast value and the focus area.
步骤S30,在所述像距调节至预设值时,将最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域作为待对焦区域,其中,所述偏差值位于预设区间为所述预设对焦区域的对比度值的最小值与所述最大值的第一比值小于第一预设阈值,或者所述预设对焦区域的对比度值的最大值与所述最小值的第二比值大于第二预设阈值;Step S30, when the image distance is adjusted to a preset value, the preset focus area having the smallest deviation area of the maximum contrast value and the minimum contrast value in the focus area of the preset interval is used as the to-be-focused area, wherein The deviation value is located in a preset interval, where a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value is less than a first preset threshold, or a maximum value of a contrast value of the preset focus area The second ratio of the minimum value is greater than the second predetermined threshold;
第二预设阈值大于第一预设阈值,偏差值为对焦区域的对比度值的最小 值与所述最大值的第一比值,或者对焦区域的对比度值的最大值与所述最小值的第二比值,待对焦区域为最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域,即步骤S30包括:The second preset threshold is greater than the first preset threshold, and the offset value is the minimum of the contrast value of the focus area a first ratio of the value to the maximum value, or a second ratio of the maximum value of the contrast value of the in-focus area to the minimum value, and the deviation of the maximum contrast value and the minimum contrast value in the to-be-focused area is in a preset interval The preset focus area with the smallest area in the area, that is, step S30 includes:
按照对焦区域面积由小到大的顺序依次计算获取每个所述预设对焦区域的所述偏差值;And obtaining the deviation value of each of the preset focus areas in order according to an area of the focus area being small to large;
每获取一个预设对焦区域的偏差值,判断在所述偏差值是否位于预设区间;Obtaining a deviation value of a preset focus area, determining whether the deviation value is located in a preset interval;
在所述偏差值位于预设区间时,将当前计算所述偏差值对应的所述预设对焦区域作为待对焦区域,并停止计算所述其它对焦区域的所述偏差值;When the deviation value is in the preset interval, the preset focus area corresponding to the deviation value is currently calculated as the to-be-focused area, and the calculation of the deviation value of the other focus area is stopped;
在所述偏差值超出所述预设区间时,继续计算下一所述预设对焦区域的所述偏差值,直至计算完所有所述预设对焦区域的所述偏差值。When the deviation value exceeds the preset interval, the deviation value of the next predetermined focus area is continuously calculated until the deviation value of all the preset focus areas is calculated.
参照图4,以对焦区域包括A1、A2以及A3以及偏差值为第一比值为例进行说明,A1对应的对比度值为(K1、K2、K3…Kn),A2对应的对比度值为(L1、L2、L3…Ln),A3对应的对比度值为(M1、M2、M3…Mn),先计算A1对应的对比度值中最小值与最大值的第一比值,若计算出的第一比值为D1,则判断D1是否小于第一预设阈值,在D1小于第一预设阈值时,将A1作为待对焦区域,在D1大于或等于第一预设阈值时,继续计算A2对应的对比度值中最小值与最大值的第一比值,若计算出的第一比值为D2,则判断D2是否小于第一预设阈值,在D2小于第一预设阈值时,将A2作为待对焦区域,在D2大于或等于第一预设阈值时,继续计算A3对应的对比度值中最小值与最大值的第一比值,若计算出的第一比值为D3,则判断D3是否小于第一预设阈值,在D3小于第一预设阈值时,将A3作为待对焦区域,在D3大于或等于第一预设阈值时,将预设像距对应的图像作为对焦图像。该在偏差值为第二比值时,过程类似在此不再赘述。Referring to FIG. 4, the focus ratio includes A1, A2, and A3, and the deviation value is taken as an example. The contrast value corresponding to A1 is (K1, K2, K3, ... Kn), and the contrast value corresponding to A2 is (L1). L2, L3...Ln), the contrast value corresponding to A3 is (M1, M2, M3...Mn), first calculate the first ratio of the minimum value and the maximum value of the contrast value corresponding to A1, and if the calculated first ratio is D1 And determining whether D1 is smaller than the first preset threshold. When D1 is less than the first preset threshold, A1 is used as the to-be-focused area, and when D1 is greater than or equal to the first preset threshold, the minimum of the contrast value corresponding to A2 is continuously calculated. The first ratio of the value to the maximum value, if the calculated first ratio is D2, it is determined whether D2 is smaller than the first preset threshold, and when D2 is smaller than the first preset threshold, A2 is regarded as the to-be-focused region, and D2 is greater than Or equal to the first preset threshold, continue to calculate the first ratio of the minimum value and the maximum value of the contrast values corresponding to A3. If the calculated first ratio is D3, determine whether D3 is less than the first preset threshold, at D3. When it is smaller than the first preset threshold, A3 is regarded as the to-be-focused area, and is greater than D3. Or equal to the first preset threshold, the image corresponding to the preset image distance is taken as the in-focus image. When the deviation value is the second ratio, the process is similar to that of the above.
在上述获取每个对焦区域中的对比度值最大值以及对比度值最小值时,可对每个对焦区域的对比度值按照由大到小或者由小到大的顺序进行排序,以获取最大值以及最小值;或者将对比度值进行两两比对以获取最大值以及最小值。 When the maximum value of the contrast value and the minimum value of the contrast value in each focus area are obtained as described above, the contrast values of each focus area can be sorted in order of large to small or small to large to obtain the maximum value and the minimum value. Value; or compare the contrast values in pairs to get the maximum and minimum values.
可以理解的是,也可同时计算A1、A2以及A3对应的第一比值D1、D2以及D3,并获取D1、D2以及D3中小于第一预设阈值的对比度值,例如小于第一预设阈值的对比度值为D2和D3,则将A2作为待对焦区域。It can be understood that the first ratios D1, D2, and D3 corresponding to A1, A2, and A3 can also be calculated at the same time, and the contrast values smaller than the first preset threshold in D1, D2, and D3 are obtained, for example, less than the first preset threshold. The contrast values are D2 and D3, and A2 is used as the area to be focused.
步骤S40,获取所述待对焦区域对应的最大对比度值,将获取的所述最大对比度值对应的图像作为对焦图像。Step S40: Acquire a maximum contrast value corresponding to the to-be-focused area, and use the acquired image corresponding to the maximum contrast value as the in-focus image.
最大对比度值对应图像作为对焦图像为,最大对比度值对应的像距时获取到的图像,将最大对比度值对应的图像作为对焦图像即在取景框显示该最大对比度值对应的图像。The maximum contrast value corresponds to an image obtained by the image as the focused image, and the image obtained by the maximum contrast value, and the image corresponding to the maximum contrast value is used as the focused image, that is, the image corresponding to the maximum contrast value is displayed in the finder frame.
可以理解的是,在每个对焦区域的对比度值偏差值均超出预设区间时,说明每个对焦区域的对焦效果均较差,则可选取预设像距处的图像作为对焦图像,即该方法还包括,在每个所述预设对焦区域对应的所述偏差值均超出所述预设区间时,将每个所述将预设像距中的默认像距处采集到的图像作为对焦图像。It can be understood that, when the contrast value deviation value of each focus area exceeds the preset interval, indicating that the focus effect of each focus area is poor, the image at the preset image distance can be selected as the in-focus image, that is, the The method further includes: when the deviation value corresponding to each of the preset focus areas exceeds the preset interval, using the image captured by each of the default image distances in the preset image distance as a focus image.
本实施例提出的对焦方法,控制调焦马达按照预设的方向移动镜头,以调节图像采集的像距,在移动过程中,在每个预设像距采集图像,并计算采集到的所述图像中多个预设对焦区域的对比度值,其中,多个预设对焦区域按照面积大小依次嵌套,在所述镜头移动至预设位置时,获取最大对比度值与最小对比度值偏差最小的对焦区域中最小的对焦区域作为待对焦区域,并获取所述待对焦区域对应的最大对比度值,将获取的所述最大对比度值对应的图像作为对焦图像,以保证获取到的待对焦区域中有足够的边缘特征,同时在中心区域中有足够边缘特征时,对焦点不会偏离值边缘区域,使得对焦更加准确。In the focusing method of the embodiment, the focus motor is controlled to move the lens according to a preset direction to adjust the image distance of the image acquisition, and during the moving process, the image is acquired at each preset image distance, and the collected image is calculated. The contrast value of the plurality of preset focus areas in the image, wherein the plurality of preset focus areas are sequentially nested according to the size of the area, and when the lens moves to the preset position, the focus with the smallest deviation between the maximum contrast value and the minimum contrast value is obtained. The smallest focus area in the area is used as the to-be-focused area, and the maximum contrast value corresponding to the to-be-focused area is obtained, and the obtained image corresponding to the maximum contrast value is used as the in-focus image to ensure that there is enough in the obtained to-be-focused area. The edge feature, while having sufficient edge features in the center region, does not deviate from the edge of the value, making the focus more accurate.
本发明实施例还提出一种移动终端,该移动终端包括以上任一实施例所述的对焦装置。The embodiment of the present invention further provides a mobile terminal, where the mobile terminal includes the focusing device according to any of the above embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述 实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。Those skilled in the art can clearly understand the above by the description of the above embodiments. The embodiment method can be implemented by means of software plus a necessary general hardware platform, of course, also through hardware, but in many cases the former is a 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.
工业实用性Industrial applicability
上述技术方案能够保证获取到的待对焦区域中有足够的边缘特征,同时在中心区域中有足够边缘特征时,对焦点不会偏离值边缘区域,使得对焦更加准确。 The above technical solution can ensure that there are enough edge features in the acquired to-be-focused area, and when there are enough edge features in the central area, the focus point does not deviate from the value edge area, so that the focus is more accurate.

Claims (20)

  1. 一种对焦装置,所述对焦装置包括:A focusing device, the focusing device comprising:
    控制模块,设置为按照预设的方向调节图像采集的像距;a control module, configured to adjust an image distance of the image acquisition according to a preset direction;
    图像采集模块,设置为在调节像距的过程中,在每个预设像距处采集图像;The image acquisition module is configured to collect an image at each preset image distance during the adjustment of the image distance;
    计算模块,设置为计算采集到的所述图像中多个预设对焦区域的对比度值,其中,多个预设对焦区域按照面积大小依次嵌套;a calculation module, configured to calculate a contrast value of the plurality of preset focus areas in the collected image, wherein the plurality of preset focus areas are sequentially nested according to the size of the area;
    处理模块,设置为在所述像距调节至预设值时,将最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域作为待对焦区域,其中,所述偏差值位于预设区间为所述预设对焦区域的对比度值的最小值与所述最大值的第一比值小于第一预设阈值,或者所述预设对焦区域的对比度值的最大值与所述最小值的第二比值大于第二预设阈值;a processing module, configured to: when the image distance is adjusted to a preset value, a preset focus area having a smallest deviation value between the maximum contrast value and the minimum contrast value in a focus area of the preset interval is used as a to-focus area, where The deviation value is located in a preset interval, where a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value is less than a first preset threshold, or a maximum value of a contrast value of the preset focus area a second ratio to the minimum value is greater than a second predetermined threshold;
    对焦模块,设置为获取所述待对焦区域对应的最大对比度值,将获取的所述最大对比度值对应的图像作为对焦图像。The focusing module is configured to acquire a maximum contrast value corresponding to the to-be-focused area, and use the acquired image corresponding to the maximum contrast value as the in-focus image.
  2. 如权利要求1所述的对焦装置,其中,所述处理模块包括:The focusing device of claim 1 wherein said processing module comprises:
    第一计算单元,设置为按照对焦区域面积由小到大的顺序依次计算获取每个所述预设对焦区域的所述偏差值;以及接收处理单元的通知,停止继续计算预设对焦区域的偏差值,或继续计算预设对焦区域的偏差值,直至计算完所有所述预设对焦区域的所述偏差值;The first calculating unit is configured to sequentially calculate the deviation value of each of the preset focus areas according to the area of the focus area from small to large; and receive the notification of the processing unit to stop continuing to calculate the deviation of the preset focus area Value, or continue to calculate the deviation value of the preset focus area until the deviation value of all the preset focus areas is calculated;
    判断单元,设置为每获取一个预设对焦区域的偏差值,判断在所述偏差值是否位于预设区间;a determining unit, configured to determine a deviation value of each preset focus area, and determine whether the deviation value is in a preset interval;
    处理单元,设置为在所述偏差值位于预设区间时,将当前计算所述偏差值对应的所述预设对焦区域作为待对焦区域,通知第一计算单元停止计算所述其它对焦区域的所述偏差值;以及在所述偏差值超出所述预设区间时,通知第一计算单元继续计算下一所述预设对焦区域的所述偏差值。 The processing unit is configured to, when the deviation value is located in the preset interval, use the preset focus area corresponding to the deviation value as the to-be-focused area, and notify the first calculation unit to stop calculating the location of the other focus area Deviating the value; and when the deviation value exceeds the preset interval, notifying the first calculating unit to continue to calculate the deviation value of the next predetermined focus area.
  3. 如权利要求1或2所述的对焦装置,所述对焦模块,还设置为在每个所述预设对焦区域对应的所述偏差值均超出所述预设区间时,将每个所述将预设像距中的默认像距处采集到的图像作为对焦图像。The focusing device according to claim 1 or 2, wherein the focusing module is further configured to: when the deviation value corresponding to each of the preset focusing regions exceeds the preset interval, each of the The image captured at the default image distance in the preset image distance is used as the in-focus image.
  4. 如权利要求1或2所述的对焦装置,其中,所述计算模块包括:The focusing device according to claim 1 or 2, wherein the calculation module comprises:
    获取单元,设置为分别获取所述图像中每个对焦区域内中的所述图像的所有像素信息;An obtaining unit configured to respectively acquire all pixel information of the image in each focus area in the image;
    第二计算单元,设置为根据所述像素信息分别对每个预设对焦区域内的所有像素点的对比度值进行求和得到每个所述预设对焦区域的对比度值。The second calculating unit is configured to respectively sum the contrast values of all the pixels in each preset focus area according to the pixel information to obtain a contrast value of each of the preset focus areas.
  5. 如权利要求4所述的对焦装置,其中,所述第二计算单元包括:The focusing device of claim 4, wherein the second computing unit comprises:
    获取子单元,设置为对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值;Obtaining a subunit, configured to perform high-pass filtering on each pixel in each image in the focus area to obtain a contrast value of each pixel;
    计算子单元,设置为将分别对每个所述对焦区域内的所有像素点的对比度值进行求和得到每个所述对焦区域的对比度值。The calculation subunit is configured to sum the contrast values of all the pixels in each of the in-focus areas to obtain a contrast value of each of the in-focus areas.
  6. 如权利要求1所述的对焦装置,其中,The focusing device according to claim 1, wherein
    预设方向包括由远及近、或由近及远。The preset directions include far and near, or near and far.
  7. 如权利要求1所述的对焦装置,其中,图像采集模块是设置为通过如下方式实现在调节像距的过程中,在每个预设像距处采集图像:The focusing apparatus according to claim 1, wherein the image capturing module is configured to acquire an image at each of the preset image distances during the adjustment of the image distance by:
    将像距每调节预设的像距间隔,进行图像采集;Image acquisition is performed by adjusting the image distance of each preset by the image distance;
    or
    在像距调节过程中,在像距到达预设像距时进行图像采集。In the image distance adjustment process, image acquisition is performed when the image distance reaches a preset image distance.
  8. 如权利要求1所述的对焦装置,其中, The focusing device according to claim 1, wherein
    所述对比度值指图像的聚焦值,用于体现图像边缘信息的强度。The contrast value refers to the focus value of the image for embodying the intensity of the image edge information.
  9. 如权利要求5所述的对焦装置,其中,获取子单元是设置为通过如下方式实现对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值:The focusing apparatus according to claim 5, wherein the acquisition subunit is configured to perform high-pass filtering on each pixel in each of the in-focus images to obtain a contrast value for each pixel by:
    对每个对焦区域设置高通滤波器,将每个对焦区域内的图像分别发送至与每个对焦区域对应的高通滤波器中进行高通滤波得到每个像素点的对比度值;Setting a high-pass filter for each focus area, and transmitting an image in each focus area to a high-pass filter corresponding to each focus area for high-pass filtering to obtain a contrast value of each pixel;
    or
    将每个对焦区域内的图像依次发送至同一高通滤波器进行高通滤波得到每个像素点的对比度值。The images in each focus area are sequentially sent to the same high-pass filter for high-pass filtering to obtain the contrast value of each pixel.
  10. 如权利要求1所述的对焦装置,The focusing device according to claim 1,
    所述计算模块,还设置为将每个对焦区域的对比度值与对焦区域关联存储。The calculation module is further configured to store the contrast value of each focus area in association with the focus area.
  11. 一种对焦方法,所述对焦方法包括以下步骤:A focusing method, the focusing method comprising the following steps:
    按照预设的方向调节图像采集的像距;Adjust the image distance of the image acquisition according to the preset direction;
    在调节像距的过程中,在每个预设像距处采集图像,并计算采集到的所述图像中多个预设对焦区域的对比度值,其中,多个预设对焦区域按照面积大小依次嵌套;In the process of adjusting the image distance, an image is acquired at each preset image distance, and the contrast value of the plurality of preset focus areas in the collected image is calculated, wherein the plurality of preset focus areas are sequentially arranged according to the area size Nested
    在所述像距调节至预设值时,将最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域作为待对焦区域,其中,所述偏差值位于预设区间为所述预设对焦区域的对比度值的最小值与所述最大值的第一比值小于第一预设阈值,或者所述预设对焦区域的对比度值的最大值与所述最小值的第二比值大于第二预设阈值;When the image distance is adjusted to a preset value, a preset focus area having a smallest deviation value between the maximum contrast value and the minimum contrast value in a focus area of the preset interval is used as a to-focus area, wherein the deviation value is located The preset interval is that a first ratio of a minimum value of the contrast value of the preset focus area to the maximum value is smaller than a first preset threshold, or a maximum value of the contrast value of the preset focus area and the minimum value The second ratio is greater than the second predetermined threshold;
    获取所述待对焦区域对应的最大对比度值,将获取的所述最大对比度值 对应的图像作为对焦图像。Obtaining a maximum contrast value corresponding to the to-be-focused area, and obtaining the maximum contrast value The corresponding image is used as the in-focus image.
  12. 如权利要求11所述的对焦方法,其中,所述将最大对比度值与最小对比度值的偏差值位于预设区间的对焦区域中面积最小的预设对焦区域作为待对焦区域的步骤包括:The focusing method according to claim 11, wherein the step of setting the maximum contrast value and the minimum contrast value to have a preset focus area having the smallest area in the focus area of the preset interval as the to-focus area includes:
    按照对焦区域面积由小到大的顺序依次计算获取每个所述预设对焦区域的所述偏差值;And obtaining the deviation value of each of the preset focus areas in order according to an area of the focus area being small to large;
    为每获取一个预设对焦区域的偏差值,判断在所述偏差值是否位于预设区间;Determining whether the deviation value is in a preset interval for each deviation value of a preset focus area;
    在所述偏差值位于预设区间时,将当前计算所述偏差值对应的所述预设对焦区域作为待对焦区域,并停止计算所述其它对焦区域的所述偏差值;When the deviation value is in the preset interval, the preset focus area corresponding to the deviation value is currently calculated as the to-be-focused area, and the calculation of the deviation value of the other focus area is stopped;
    在所述偏差值超出所述预设区间时,继续计算下一所述预设对焦区域的所述偏差值,直至计算完所有所述预设对焦区域的所述偏差值。When the deviation value exceeds the preset interval, the deviation value of the next predetermined focus area is continuously calculated until the deviation value of all the preset focus areas is calculated.
  13. 如权利要求11或12所述的对焦方法,还包括:The focusing method according to claim 11 or 12, further comprising:
    所述计算采集到的所述图像中多个预设对焦区域的对比度值的步骤之后,在每个所述预设对焦区域对应的所述偏差值均超出所述预设区间时,将每个所述将预设像距中的默认像距处采集到的图像作为对焦图像。After the step of calculating the contrast value of the plurality of preset focus areas in the collected image, each of the preset focus areas corresponding to the deviation value exceeds the preset interval, each will The image collected at the default image distance in the preset image distance is taken as the in-focus image.
  14. 如权利要求11或12所述的对焦方法,其中,所述计算采集到的所述图像中多个预设对焦区域的对比度值的步骤包括:The focusing method according to claim 11 or 12, wherein the calculating the contrast value of the plurality of preset focus areas in the acquired image comprises:
    分别获取所述图像中每个对焦区域内中的所述图像的所有像素信息;Acquiring all pixel information of the image in each focus area in the image, respectively;
    根据所述像素信息分别对每个预设对焦区域内的所有像素点的对比度值进行求和得到每个所述预设对焦区域的对比度值。And comparing the contrast values of all the pixels in each preset focus area according to the pixel information to obtain a contrast value of each of the preset focus areas.
  15. 如权利要求14所述的对焦方法,其中,所述根据所述像素信息分别对每个预设对焦区域内的所有像素点的对比度值进行求和得到每个所述预设 对焦区域的对比度值的步骤包括:The focusing method according to claim 14, wherein the summing the contrast values of all the pixels in each of the preset in-focus areas according to the pixel information to obtain each of the presets The steps of the contrast value of the focus area include:
    对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值;Performing high-pass filtering on each pixel in each image in the in-focus area to obtain a contrast value of each pixel;
    分别对每个所述对焦区域的所有像素点的对比度值进行求和得到每个所述对焦区域的对比度值。The contrast values of all the pixels of each of the in-focus regions are respectively summed to obtain a contrast value of each of the in-focus regions.
  16. 如权利要求11所述的对焦方法,其中,The focusing method according to claim 11, wherein
    预设方向包括由远及近、或由近及远。The preset directions include far and near, or near and far.
  17. 如权利要求11所述的对焦方法,其中,在调节像距的过程中,在每个预设像距处采集图像包括:The focusing method according to claim 11, wherein, in the process of adjusting the image distance, acquiring an image at each preset image distance comprises:
    将像距每调节预设的像距间隔,进行图像采集;Image acquisition is performed by adjusting the image distance of each preset by the image distance;
    or
    在像距调节过程中,在像距到达预设像距时进行图像采集。In the image distance adjustment process, image acquisition is performed when the image distance reaches a preset image distance.
  18. 如权利要求11所述的对焦方法,其中,The focusing method according to claim 11, wherein
    所述对比度值指图像的聚焦值,用于体现图像边缘信息的强度。The contrast value refers to the focus value of the image for embodying the intensity of the image edge information.
  19. 如权利要求15所述的对焦方法,其中,对每个所述对焦区域内的图像中每个像素点进行高通滤波得到每个像素点的对比度值,包括:The focusing method according to claim 15, wherein each pixel point in each image in the in-focus area is subjected to high-pass filtering to obtain a contrast value of each pixel point, including:
    对每个对焦区域设置高通滤波器,将每个对焦区域内的图像分别发送至与每个对焦区域对应的高通滤波器中进行高通滤波得到每个像素点的对比度值;Setting a high-pass filter for each focus area, and transmitting an image in each focus area to a high-pass filter corresponding to each focus area for high-pass filtering to obtain a contrast value of each pixel;
    or
    将每个对焦区域内的图像依次发送至同一高通滤波器进行高通滤波得到每个像素点的对比度值。 The images in each focus area are sequentially sent to the same high-pass filter for high-pass filtering to obtain the contrast value of each pixel.
  20. 如权利要求11所述的对焦方法,还包括:The focusing method of claim 11 further comprising:
    在计算采集到的所述图像中多个预设对焦区域的对比度值后,将每个对焦区域的对比度值与对焦区域关联存储。 After calculating the contrast values of the plurality of preset focus areas in the acquired image, the contrast value of each focus area is stored in association with the focus area.
PCT/CN2016/105179 2015-11-27 2016-11-09 Focusing method and device WO2017088662A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510867852.5 2015-11-27
CN201510867852.5A CN105357444B (en) 2015-11-27 2015-11-27 focusing method and device

Publications (1)

Publication Number Publication Date
WO2017088662A1 true WO2017088662A1 (en) 2017-06-01

Family

ID=55333294

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/105179 WO2017088662A1 (en) 2015-11-27 2016-11-09 Focusing method and device

Country Status (2)

Country Link
CN (1) CN105357444B (en)
WO (1) WO2017088662A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105357444B (en) * 2015-11-27 2018-11-02 努比亚技术有限公司 focusing method and device
WO2017166076A1 (en) * 2016-03-29 2017-10-05 华为技术有限公司 Method, device and apparatus for determining focus window
CN106131403B (en) * 2016-06-30 2020-06-02 北京小米移动软件有限公司 Touch focusing method and device
CN110858872B (en) * 2018-08-23 2021-06-22 浙江宇视科技有限公司 Optical axis offset compensation method and device
JP6641572B1 (en) * 2018-08-24 2020-02-05 エスゼット ディージェイアイ テクノロジー カンパニー リミテッドSz Dji Technology Co.,Ltd Determination device, control device, imaging device, determination method, and program
WO2021102961A1 (en) * 2019-11-29 2021-06-03 深圳市大疆创新科技有限公司 Focusing method for photographing apparatus, image processing device, and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1794032A (en) * 2005-12-30 2006-06-28 北京中星微电子有限公司 Automatic focusing method
CN101924880A (en) * 2009-06-15 2010-12-22 卡西欧计算机株式会社 Filming apparatus with automatic focus function
CN101950063A (en) * 2009-07-10 2011-01-19 佛山普立华科技有限公司 Automatic focusing system and automatic focusing method
US20140016021A1 (en) * 2011-03-31 2014-01-16 Fujifilm Corporation Imaging device, method for controlling imaging device, and computer-readable storage medium
CN103945126A (en) * 2014-04-21 2014-07-23 中国人民解放军国防科学技术大学 Automatic focusing and locating method
CN104270562A (en) * 2014-08-15 2015-01-07 广东欧珀移动通信有限公司 Method and device for focusing when photographing
CN105357444A (en) * 2015-11-27 2016-02-24 努比亚技术有限公司 Focusing method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006258944A (en) * 2005-03-15 2006-09-28 Fujinon Corp Autofocus system
CN100561326C (en) * 2007-07-06 2009-11-18 鸿富锦精密工业(深圳)有限公司 Autofocus system and automatic focusing method
JP5300133B2 (en) * 2008-12-18 2013-09-25 株式会社ザクティ Image display device and imaging device
CN108322652A (en) * 2015-06-16 2018-07-24 广东欧珀移动通信有限公司 A kind of focusing reminding method and terminal

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1794032A (en) * 2005-12-30 2006-06-28 北京中星微电子有限公司 Automatic focusing method
CN101924880A (en) * 2009-06-15 2010-12-22 卡西欧计算机株式会社 Filming apparatus with automatic focus function
CN101950063A (en) * 2009-07-10 2011-01-19 佛山普立华科技有限公司 Automatic focusing system and automatic focusing method
US20140016021A1 (en) * 2011-03-31 2014-01-16 Fujifilm Corporation Imaging device, method for controlling imaging device, and computer-readable storage medium
CN103945126A (en) * 2014-04-21 2014-07-23 中国人民解放军国防科学技术大学 Automatic focusing and locating method
CN104270562A (en) * 2014-08-15 2015-01-07 广东欧珀移动通信有限公司 Method and device for focusing when photographing
CN105357444A (en) * 2015-11-27 2016-02-24 努比亚技术有限公司 Focusing method and device

Also Published As

Publication number Publication date
CN105357444B (en) 2018-11-02
CN105357444A (en) 2016-02-24

Similar Documents

Publication Publication Date Title
WO2017107629A1 (en) Mobile terminal, data transmission system and shooting method of mobile terminal
JP6803982B2 (en) Optical imaging method and equipment
WO2017088662A1 (en) Focusing method and device
WO2017067520A1 (en) Mobile terminal having binocular cameras and photographing method therefor
WO2017071559A1 (en) Image processing apparatus and method
JP5657182B2 (en) Imaging apparatus and signal correction method
JP5946970B2 (en) Imaging apparatus and imaging method
JP6031587B2 (en) Imaging apparatus, signal processing method, and signal processing program
JP5982601B2 (en) Imaging apparatus and focus control method
WO2018076938A1 (en) Method and device for processing image, and computer storage medium
JP5799178B2 (en) Imaging apparatus and focus control method
JP6307526B2 (en) Imaging apparatus and focus control method
WO2017045647A1 (en) Method and mobile terminal for processing image
JP5779726B2 (en) Imaging apparatus and exposure determination method
JP2016536895A (en) Method and terminal for acquiring panoramic image
JP5677625B2 (en) Signal processing apparatus, imaging apparatus, and signal correction method
WO2017088609A1 (en) Image denoising apparatus and method
WO2017054677A1 (en) Mobile terminal photographing system and mobile terminal photographing method
JP6028112B2 (en) Imaging apparatus and focus control method
WO2017071558A1 (en) Mobile terminal photographing device and method
WO2017067481A1 (en) Method and mobile terminal for processing image
CN105357441B (en) A kind of image-pickup method and mobile terminal
CN105426081B (en) Interface switching device and method of mobile terminal
EP2706746A2 (en) Photographing apparatus and method of photographing image thereof
CN106993138B (en) Time-gradient image shooting device and method

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: 16867886

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16867886

Country of ref document: EP

Kind code of ref document: A1