CN115437601A - Image sorting method, electronic device, program product, and medium - Google Patents

Image sorting method, electronic device, program product, and medium Download PDF

Info

Publication number
CN115437601A
CN115437601A CN202211364538.1A CN202211364538A CN115437601A CN 115437601 A CN115437601 A CN 115437601A CN 202211364538 A CN202211364538 A CN 202211364538A CN 115437601 A CN115437601 A CN 115437601A
Authority
CN
China
Prior art keywords
image
images
matching
area
electronic device
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202211364538.1A
Other languages
Chinese (zh)
Other versions
CN115437601B (en
Inventor
陈敬濠
曹鹏蕊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211364538.1A priority Critical patent/CN115437601B/en
Publication of CN115437601A publication Critical patent/CN115437601A/en
Application granted granted Critical
Publication of CN115437601B publication Critical patent/CN115437601B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/06Arrangements for sorting, selecting, merging, or comparing data on individual record carriers
    • G06F7/08Sorting, i.e. grouping record carriers in numerical or other ordered sequence according to the classification of at least some of the information they carry
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/60Information retrieval; Database structures therefor; File system structures therefor of audio data
    • G06F16/63Querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/60Information retrieval; Database structures therefor; File system structures therefor of audio data
    • G06F16/68Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Library & Information Science (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application provides an image sorting method, an electronic device, a program product and a medium, wherein the method comprises the following steps: acquiring a first image set, wherein the first image set comprises a plurality of images to be sorted, and the images to be sorted are images obtained by searching according to query images; calculating the common view proportion of the corresponding images to be sorted and the query image according to the matched first characteristic points between each image to be sorted and the query image; and sequencing the images to be sequenced according to the common view proportion. According to the method and the device, the similar images in the retrieval result can be further sorted according to the similarity by reflecting the common-view proportion of the distribution of the feature points, so that a more accurate sorting result is obtained, and the problem of disordered sorting of the similar images in the image retrieval result is solved.

Description

Image sorting method, electronic device, program product, and medium
Technical Field
The present application relates to the field of retrieval technologies, and in particular, to an image sorting method, an electronic device, a computer program product, and a computer-readable storage medium.
Background
Image retrieval is continuously developed, and from the beginning, features of an image are described for retrieval in a text description manner, and analysis and retrieval can be performed according to colors, textures, layouts and the like of the image, that is, content-based image retrieval technology has been developed. Image retrieval is widely applied to scenes such as visual positioning, commodity recommendation and similar object search.
In general, image retrieval is performed by performing similarity matching based on image features, and returning similar images of the image retrieval in the order of similarity from large to small. For images of the same shooting target at different distances or different visual angles, due to the fact that the image features are highly similar, the images in the retrieval result are disordered in sequence.
Disclosure of Invention
The application provides an image sorting method, electronic equipment, a computer program product and a computer readable storage medium, and aims to solve the problem of disordered sorting of similar images in an image retrieval result.
In a first aspect, the present application provides an image sorting method, including: acquiring a first image set, wherein the first image set comprises a plurality of images to be sorted, and the images to be sorted are images obtained by searching according to query images; calculating a common-view ratio corresponding to the images to be sorted and the query image according to a first feature point matched between each image to be sorted and the query image, wherein the first feature point comprises a feature point matched with the query image in a target image and a feature point matched with the target image in the query image, the target image is the image to be sorted, the common-view ratio is the area ratio of a matching area, in which the feature points matched between the two images are distributed, in the two images and a preset area of an image to which the matching area belongs; and sorting the images to be sorted according to the common view proportion.
According to the method, after the image to be sorted which is similar to the image characteristics of the query image is obtained through retrieval, the common view proportion reflecting the distribution of the characteristic points is calculated according to the first characteristic points matched between the image to be sorted and the query image; and finally, the images to be sorted are sorted according to the common-view proportion, so that the effect of further sorting the retrieval results according to the feature point distribution of the images is achieved, and the sorting precision is higher.
In a possible implementation, the calculating, according to the first feature point matched between each image to be ranked and the query image, a common view ratio corresponding to the image to be ranked and the query image includes: determining a first matching area in the target image and a second matching area in the query image according to the first feature point; the first matching area is an area block where the first characteristic point in the target image is located, and the second matching area is an area block where the first characteristic point in the query image is located; the common view ratio is calculated using the smaller of the first matching region and the second matching region.
According to the method and the device, the smaller matching area image is determined as the common-view area for calculating the common-view proportion, so that the common-view proportion can reflect the similarity between the image to be sorted and the query image more accurately, and the sorting result obtained according to the common-view proportion is higher in precision.
In one possible implementation, the calculating the common view scale using the smaller of the first matching region and the second matching region includes: if the first matching area is smaller than the second matching area, calculating the area ratio of the first matching area and the target image to obtain the common view ratio; if the first matching area is larger than the second matching area, calculating the area ratio of the second matching area and the query image to obtain the common view ratio.
According to the method and the device, the distribution condition of the matching feature points in the original image can be reflected intuitively by calculating the ratio of the areas of the matching area and the original image as the common-view ratio, and the similarity between the target image and the query image reflected by the calculated common-view ratio is more accurate.
In one possible implementation, the calculating the common view scale using the smaller of the first matching region and the second matching region includes: if the first matching area is smaller than the second matching area, calculating the area ratio of the first matching area and a first characteristic area of the target image to obtain the common view ratio; the first characteristic region is a region block where a second characteristic point in the target image is located, and the second characteristic point is a characteristic point matched between the target image and the target image; if the first matching area is larger than the second matching area, calculating the area ratio of the second matching area and a second characteristic area of the query image to obtain the common view ratio; the second feature region is a region block where a third feature point in the query image is located, and the third feature point is a feature point matched between the query image and the query image.
According to the method and the device, the area ratio of the matching area to the characteristic area is calculated to serve as the common view proportion, so that the influence of a blank area or a characteristic-free area in the image can be eliminated, and the similarity of the distribution situation of the matching characteristic points between the target image and the query image can be reflected more accurately.
In one possible implementation, the determining a first matching region in the target image and a second matching region in the query image according to the first feature point includes: dividing the target image and the query image into N and M area blocks respectively, wherein the size of each area block is the same, and N and M are integers larger than 0; and determining the area block in which the first characteristic point exists as the first matching area or the second matching area.
In the method, whether the unit region block belongs to the matching region is determined by whether the first feature point exists in the unit region blocks with the same size, so that the distribution situation of the matching feature points can be better reflected, and meanwhile, the area counting is facilitated.
In one possible implementation, before the sorting the plurality of images to be sorted according to the common-view scale, the method further includes: and deleting the images to be sorted with the common visual ratio lower than a first threshold value in the first image set.
According to the method and the device, the images to be sorted with the common view proportion lower than the first threshold value are deleted, so that the calculation amount of sorting can be reduced, and the quality of candidate images in a retrieval result is improved; the number of candidate images is smaller, and the calculation amount and the calculation time of the corresponding algorithm can be reduced when the candidate images in the search result are used as the input of other algorithms.
In one possible implementation, the sorting the plurality of images to be sorted according to the common-view scale includes: sorting the images to be sorted in the first image set from large to small according to the common-view proportion to obtain a sorting result; after the sorting the plurality of images to be sorted according to the common-view scale, the method further comprises: and inputting the first P images in the sequencing result into an image positioning algorithm or a pose estimation algorithm, wherein P is an integer larger than 0.
In the embodiment of the application, after the image sequence with the similarity ordered from top to bottom is obtained, the first N images can be selected as the input of other algorithms, so that the accuracy of the algorithm can be improved, and meanwhile, the operation amount and the operation time of the algorithm are reduced.
In a second aspect, there is provided an image sorting apparatus comprising means for performing any one of the methods of the first aspect. The device can be an electronic device and can also be a chip in the electronic device. The apparatus may include an input unit and a processing unit.
When the apparatus is an electronic device, the processing unit may be a processor, and the input unit may be a communication interface; the electronic device may further comprise a memory for storing computer program code which, when executed by the processor, causes the electronic device to perform any of the methods of the first aspect.
When the apparatus is a chip within an electronic device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin, a circuit, or the like; the chip may also include a memory, which may be a memory within the chip (e.g., registers, cache, etc.) or a memory external to the chip (e.g., read only memory, random access memory, etc.); the memory is adapted to store computer program code which, when executed by the processor, causes the chip to perform any of the methods of the first aspect.
In a third aspect, an electronic device is provided, comprising a processor configured to couple with a memory, and to read instructions from the memory and to cause the electronic device to perform any of the methods of the first aspect according to the instructions.
In a fourth aspect, a computer-readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, causes the processor to carry out any of the methods of the first aspect.
In a fifth aspect, there is provided a computer program product comprising: computer program code which, when executed by a processor, causes the processor to perform the method of any of the first aspects.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a software block diagram of an electronic device according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of an image sorting method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of an image retrieval method according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating a comparison between a query image and a target image according to an embodiment of the present application;
FIG. 6 is a schematic flow chart of calculating a common view scale according to an embodiment of the present application;
fig. 7 is a block diagram of an image sorting apparatus according to an embodiment of the present application;
fig. 8 is a block diagram of a structure of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. The terminology used in the following examples is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of this application and the appended claims, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, such as "one or more", unless the context clearly indicates otherwise. It should also be understood that in the embodiments of the present application, "one or more" means one, two or more; "and/or" describes the association relationship of the associated objects, indicating that three relationships may exist; for example, a and/or B, may represent: a alone, both A and B, and B alone, where A, B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The embodiments of the present application relate to a plurality of numbers greater than or equal to two. It should be noted that, in the description of the embodiments of the present application, the terms "first", "second", and the like are used for distinguishing the description, and are not to be construed as indicating or implying relative importance or order.
The image sorting method provided by the embodiment of the application can be applied to the electronic device 100.
In some embodiments, the electronic device 100 may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a handheld computer, a netbook, a Personal Digital Assistant (PDA), a wearable electronic device, a smart watch, and the like, and the embodiments of the present application do not particularly limit the specific form of the electronic device. In this embodiment, the structure of the electronic device 100 may be as shown in fig. 1.
As shown in fig. 1, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identification Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the structure illustrated in the present embodiment does not specifically limit the electronic device 100. In other embodiments, electronic device 100 may include more or fewer components than shown, or combine certain components, or split certain components, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a SIM interface, and/or a USB interface, etc.
The I2C interface is a bidirectional synchronous serial bus including a serial data line (SDA) and a Serial Clock Line (SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, a charger, a flash, a camera 193, etc. through different I2C bus interfaces, respectively. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through an I2C bus interface to implement a touch function of the electronic device 100.
The I2S interface may be used for audio communication. In some embodiments, processor 110 may include multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 through an I2S bus, enabling communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit the audio signal to the wireless communication module 160 through the I2S interface, so as to implement a function of receiving a call through a bluetooth headset.
The PCM interface may also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled by a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to implement a function of answering a call through a bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus used for asynchronous communications. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example: the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit the audio signal to the wireless communication module 160 through a UART interface, so as to implement the function of playing music through a bluetooth headset.
MIPI interfaces may be used to connect processor 110 with peripheral devices such as display screen 194, camera 193, and the like. The MIPI interface includes a Camera Serial Interface (CSI), a Display Serial Interface (DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the capture functionality of electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal and may also be configured as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, and the like.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device. And the earphone can also be used for connecting an earphone and playing audio through the earphone. The interface may also be used to connect other electronic devices, such as AR devices and the like.
It should be understood that the interface connection relationship between the modules illustrated in the present embodiment is only an exemplary illustration, and does not limit the structure of the electronic device 100. In other cases of the embodiments of the present application, the electronic device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charging management module 140 is configured to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive a wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140, and supplies power to the processor 110, the internal memory 121, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be used to monitor parameters such as battery capacity, battery cycle count, battery state of health (leakage, impedance), etc. In some other embodiments, the power management module 141 may also be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 150 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional modules, independent of the processor 110.
The wireless communication module 160 may provide a solution for wireless communication applied to the electronic device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), global Navigation Satellite System (GNSS), frequency Modulation (FM), near Field Communication (NFC), infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160 so that electronic device 100 can communicate with networks and other devices through wireless communication techniques. The wireless communication technology may include global system for mobile communications (GSM), general Packet Radio Service (GPRS), code division multiple access (code division multiple access, CDMA), wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc. The GNSS may include a Global Positioning System (GPS), a global navigation satellite system (GLONASS), a beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and/or a Satellite Based Augmentation System (SBAS).
The electronic device 100 implements display functions via the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may be a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-OLED, a quantum dot light-emitting diode (QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
A series of Graphical User Interfaces (GUIs) may be displayed on the display screen 194 of the electronic device 100 and are the main screen of the electronic device 100. Generally, the size of the display screen 194 of the electronic device 100 is fixed, and only a limited number of controls can be displayed in the display screen 194 of the electronic device 100. A control is a GUI element, which is a software component contained in an application program and controls all data processed by the application program and interactive operations related to the data, and a user can interact with the control through direct manipulation (direct manipulation) to read or edit information related to the application program. Generally, a control may include a visual interface element such as an icon, button, menu, tab, text box, dialog box, status bar, navigation bar, widget, and the like. For example, in the present embodiment, the display screen 194 may display virtual keys (image retrieval or image positioning).
The electronic device 100 may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display 194, the application processor, and the like.
The ISP is used to process the data fed back by the camera 193. For example, when a user takes a picture, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, an optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and converting into an image visible to the naked eye. The ISP can also carry out algorithm optimization on the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to be converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process other digital signals besides digital image signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to perform fourier transform or the like on the frequency bin energy.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and the like.
The NPU is a neural-network (NN) computing processor, which processes input information quickly by referring to a biological neural network structure, for example, by referring to a transfer mode between neurons of a human brain, and can also learn by itself continuously. Applications such as intelligent recognition of the electronic device 100 can be realized through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. For example, in the present embodiment, processor 110 may perform image retrieval, image ordering, and/or image positioning by executing instructions stored in internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100, and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
The electronic device 100 may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into analog audio signals for output, and also used to convert analog audio inputs into digital audio signals. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal. The electronic apparatus 100 can listen to music through the speaker 170A or listen to a handsfree call.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into an acoustic signal. When the electronic apparatus 100 receives a call or voice information, it can receive voice by placing the receiver 170B close to the ear of the person.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can input a voice signal to the microphone 170C by speaking near the microphone 170C through the mouth. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C to achieve a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further include three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and perform directional recording.
The earphone interface 170D is used to connect a wired earphone. The headset interface 170D may be the USB interface 130, or may be a 3.5mm open mobile electronic device platform (OMTP) standard interface, a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used for sensing a pressure signal, and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A can be of a variety of types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a sensor comprising at least two parallel plates having an electrically conductive material. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 194, the electronic apparatus 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic apparatus 100 may also calculate the touched position from the detection signal of the pressure sensor 180A. In some embodiments, the touch operations that are applied to the same touch position but different touch operation intensities may correspond to different operation instructions. For example: and when the touch operation with the touch operation intensity smaller than the first pressure threshold value acts on the short message application icon, executing an instruction for viewing the short message. And when the touch operation with the touch operation intensity larger than or equal to the first pressure threshold value acts on the short message application icon, executing an instruction of newly building the short message.
The gyro sensor 180B may be used to determine the motion attitude of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., the x, y, and z axes) may be determined by gyroscope sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. Illustratively, when the shutter is pressed, the gyro sensor 180B detects a shake angle of the electronic device 100, calculates a distance to be compensated for the lens module according to the shake angle, and allows the lens to counteract the shake of the electronic device 100 through a reverse movement, thereby achieving anti-shake. The gyroscope sensor 180B may also be used for navigation, somatosensory gaming scenes.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude, aiding in positioning and navigation, from barometric pressure values measured by barometric pressure sensor 180C.
The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip holster using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. And then according to the opening and closing state of the leather sheath or the opening and closing state of the flip cover, the automatic unlocking of the flip cover is set.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. The method can also be used for identifying the posture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and the like.
A distance sensor 180F for measuring a distance. The electronic device 100 may measure the distance by infrared or laser. In some embodiments, taking a picture of a scene, electronic device 100 may utilize range sensor 180F to range for fast focus.
The proximity light sensor 180G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light to the outside through the light emitting diode. The electronic device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 may determine that there are no objects near the electronic device 100. The electronic device 100 can utilize the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear for talking, so as to automatically turn off the screen to achieve the purpose of saving power. The proximity light sensor 180G can also be used in a holster mode, a pocket mode automatically unlocks and locks the screen.
The ambient light sensor 180L is used to sense the ambient light level. Electronic device 100 may adaptively adjust the brightness of display screen 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust the white balance when taking a picture. The ambient light sensor 180L may also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 can utilize the collected fingerprint characteristics to unlock the fingerprint, access the application lock, photograph the fingerprint, answer an incoming call with the fingerprint, and so on.
The temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 implements a temperature processing strategy using the temperature detected by temperature sensor 180J. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 performs a reduction in performance of a processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection. In other embodiments, the electronic device 100 heats the battery 142 when the temperature is below another threshold to avoid the low temperature causing the electronic device 100 to shut down abnormally. In other embodiments, when the temperature is lower than a further threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown due to low temperature.
The touch sensor 180K is also called a "touch device". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation applied thereto or nearby. The touch sensor can communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may be disposed on a surface of the electronic device 100, different from the position of the display screen 194.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, the bone conduction sensor 180M may acquire a vibration signal of the human vocal part vibrating the bone mass. The bone conduction sensor 180M may also contact the human pulse to receive the blood pressure pulsation signal. In some embodiments, the bone conduction sensor 180M may also be disposed in a headset, integrated into a bone conduction headset. The audio module 170 may analyze a voice signal based on the vibration signal of the bone mass vibrated by the sound part acquired by the bone conduction sensor 180M, so as to implement a voice function. The application processor can analyze heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M, so as to realize the heart rate detection function.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The electronic apparatus 100 may receive a key input, and generate a key signal input related to user setting and function control of the electronic apparatus 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback. For example, touch operations applied to different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also respond to different vibration feedback effects for touch operations applied to different areas of the display screen 194. Different application scenes (such as time reminding, receiving information, alarm clock, game and the like) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card can be brought into and out of contact with the electronic apparatus 100 by being inserted into the SIM card interface 195 or being pulled out of the SIM card interface 195. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support a Nano SIM card, a Micro SIM card, a SIM card, etc. The same SIM card interface 195 can be inserted with multiple cards at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, namely: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
In addition, an operating system runs on the above components. For example, the iOS os developed by apple, the Android open source os developed by ***, the Windows os developed by microsoft, and the like. A running application may be installed on the operating system.
The operating system of the electronic device 100 may employ a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes an Android system with a layered architecture as an example, and exemplarily illustrates a software structure of the electronic device 100.
Fig. 2 is a block diagram of a software structure of the electronic device 100 according to the embodiment of the present application.
The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library, and a kernel layer from top to bottom.
The application layer may include a series of application packages. As shown in fig. 2, the application package may include applications such as camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, etc. For example, in embodiments of the present application, the application package may further include a dedicated image retrieval application, an image positioning application, or a social application that includes an image retrieval function and an image positioning function. When the user needs to perform image retrieval or image positioning, the application can access an image retrieval interface or an image positioning interface management service provided by an application framework layer.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions. As shown in FIG. 2, the application framework layers may include a window manager, content provider, view system, phone manager, resource manager, notification manager, and the like. For example, in the embodiment of the present application, the application framework layer may provide an API related to image retrieval, image sorting, or image positioning functions for the application layer, and provide an interface management service for the application layer to implement a scene arrangement function.
The window manager is used for managing window programs. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
The phone manager is used to provide communication functions for the electronic device 100. Such as management of call status (including on, off, etc.).
The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like.
The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short dwell, and does not require user interaction. Such as a notification manager used to notify download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in the status bar, sounding a prompt tone, vibrating the electronic device, flashing an indicator light, etc.
The Android Runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system.
The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface managers (surface managers), media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., openGL ES), 2D graphics engines (e.g., SGL), and the like.
The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
The media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. The media library may support a variety of audio-video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, and the like.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
Although the Android system is taken as an example for description in the embodiments of the present application, the basic principle is also applicable to electronic devices based on an os such as iOS or Windows.
The following describes exemplary work flows of a hardware system and a software system of the electronic device 100 with reference to a specific scenario.
When a user performs a touch operation on the touch sensor 180K, a corresponding hardware interrupt is sent to the kernel layer, and the kernel layer processes the touch operation into an original input event, where the original input event includes information such as touch coordinates and a timestamp of the touch operation. The original input event is stored in the kernel layer, and the application framework layer acquires the original input event from the kernel layer, identifies a control corresponding to the original input event, and notifies an Application (APP) corresponding to the control. For example, the touch operation is a click operation, the APP corresponding to the control is a camera APP, and after the camera APP is awakened by the click operation, the camera drive of the kernel layer can be called through the API, and the camera 193 is controlled to shoot through the camera drive.
Application scenario one
When a user opens a search APP and wants to search similar images according to images in the electronic device, the electronic device responds to a query image selected by the user, retrieves similar images with the query image from the Internet or an image database of the search APP, and displays the similar images through a display screen of the electronic device in the sequence of high similarity to low similarity.
However, when the existing image retrieval algorithm is used for image retrieval, the electronic device performs similarity matching based on image features, and for images with highly similar image features, such as multiple images of the same target shot at different distances or different viewing angles, the electronic device is difficult to further sort, so that the similarity sorting in a retrieval result is disordered, and the user experience is poor.
Application scenario two
When a user opens a social APP to shoot a scene image and wants to release the scene image and display the position of the user, the electronic device can respond to the scene image, retrieve the scene image from an Internet database, and determine position information corresponding to the scene image through a visual positioning system/service (VPS) according to a plurality of images in a retrieval result; finally, the electronic device can display the scene image and the position information through a display screen of the electronic device so that a user can confirm whether to issue the scene image and the position information.
However, although the image obtained by the conventional image retrieval algorithm contains contents with highly similar features of the scene image, the image may also contain a large amount of interference information, for example, the scene image is a pyramid, and many images in the retrieval result contain lion figure and animal buildings besides the pyramid, so that when the electronic device performs positioning by using the retrieval result, positioning may be performed based on the lion figure and animal finally, which causes positioning errors and poor user experience.
Based on this, the embodiment of the application provides an image sorting method.
It should be understood that the above description is illustrative of the application scenario and does not limit the application scenario of the present application in any way.
The following describes the image processing method provided in the embodiment of the present application in detail with reference to fig. 3 to 6.
Referring to fig. 3, fig. 3 is a schematic flowchart of an image sorting method according to an embodiment of the present application, which specifically includes steps 301 to 303.
301. A first set of images is acquired.
The first image set comprises a plurality of images to be sorted, and each image to be sorted is an image retrieved according to the query image.
Further, the number of matched feature points between each image to be ranked and the query image is greater than or equal to a second threshold value. In one possible implementation, acquiring the first set of images includes: retrieving an image database according to a query image to obtain a second image set, wherein the second image set comprises a plurality of candidate images; and deleting the candidate images of which the matching feature points with the query image in the second image set are less than a second threshold value to obtain a first image set.
The query image refers to a source image provided by a user, and the device queries and searches for an image similar to the source image through the source image, so as to obtain the image to be sorted. The query image may specifically be an image captured by a user through a camera of the electronic device, or the user may be an image selected from a database of the electronic device, and the second image set may be a candidate image set retrieved from the database according to the query image.
The image database may be a public database in the internet or a private database of an APP.
The second threshold may be a preset threshold of the number of feature points, or a threshold determined according to the number of feature points of the query image, and is used to screen candidate images in the second image set that are more similar to the query image.
In the application, the electronic equipment can search the image database through a search algorithm to obtain a plurality of candidate images with higher similarity scores; and then, acquiring images with the number of matched characteristic points larger than a second threshold value from the candidate images as images to be sorted, so as to improve the similarity between the images to be sorted in the final first image set and the query image, and avoid interference of special images on image sorting. For example, a local close-up image of a query image, in which matching feature points of the local close-up image and the query image are uniformly distributed, is high in common view ratio calculated in a specific mode, but is low in overall similarity, and may interfere with an image ranking result, thereby causing ranking disorder.
In another possible implementation, referring to fig. 4, a flow of retrieving, by an electronic device, a first image set according to a query image may be shown, where fig. 4 is an image retrieval method provided in this embodiment of the present application, and includes steps 401 to 404.
401. And (5) image preprocessing.
After the electronic device obtains the query image and the database image set, it may be determined whether the query image and the database image in the database image set meet a requirement of a preset image size. The predetermined size may be a maximum of the side length of the image, for example, the predetermined maximum side length is 640 pixels, or may be a height and a width of the image, for example, the predetermined size is 640 × 480 pixels.
In one possible implementation, the preset size is an image side length; if the height or width of a certain image is larger than the preset side length, the height or width of the image is reduced to a preset size in proportion; if less than the predetermined size, no pre-processing will be required.
In another possible implementation, the preset sizes are height and width of the image; if the height and width of a certain image are not consistent with the preset size, the image is stretched in proportion, so that the height and width of the image are consistent with the preset size.
It will be appreciated that the setting of the preset size is relevant to the subsequent algorithm of feature extraction and matching; by adjusting the image size, feature extraction of subsequent images is facilitated.
402. And extracting local features of the image.
After obtaining the query image and the database image which meet the preset size requirement, the electronic device can respectively extract a first feature point of the query image and a second feature point of the database image.
Specifically, the electronic device may perform image feature extraction through a scale-invariant feature transform (SIFT) algorithm or a super point (super point) algorithm.
Taking the SIFT algorithm as an example, the electronic device may first construct a scale space of an image and establish a corresponding image pyramid, where each layer in the image pyramid is an image at a different scale; detecting a feature point in the scale space, for example, when a point in the scale space is a maximum or minimum value compared with 8 adjacent points of the same scale and 18 adjacent points of adjacent scales, determining that the point is a feature point; then, characteristic points with low contrast and instability can be removed; and finally, assigning a value to the extreme point to generate a corresponding feature point descriptor.
It should be understood that the SIFT algorithm and the super point algorithm are only examples, and other feature extraction algorithms may be adopted in practical applications, which are not limited specifically herein.
403. And matching local features of the image.
After extracting the first feature point of the query image and the second feature point of the database image, the electronic device may match the first feature point and the second feature point to obtain feature points of all database images matched with the query image.
Specifically, the electronic device may perform feature matching through a super glue algorithm or a SIFT algorithm.
Taking an SIFT algorithm as an example, after the feature points of the two images are extracted, the feature point descriptors of the two images can be matched; specifically, a corresponding SIFT feature vector may be generated according to the feature point descriptor, and then the euclidean distance of the feature vector is used as the similarity determination metric of the key points in the two images. For example, a certain feature point in the query image is taken, and the first two feature points with the closest european distance in the database image are found, and in the two feature points, if the closest distance divided by the second closest distance is smaller than a preset proportion threshold, the feature point in the query image and the feature point with the closest european distance in the database image are determined as matching feature points.
It should be understood that the SIFT algorithm and the super-value algorithm are only examples, and other feature extraction algorithms may be used in practical applications, and are not limited herein.
404. And (5) removing outliers.
Wherein, the outlier (outlier) refers to an abnormal point pair in the matching point pair, and using the outlier as the algorithm input causes errors, which reduces the algorithm precision. Outliers are generated in the feature point matching process, and there are two types of outliers in general, the first type is mainly caused by wrong feature matching; the second category is from motion feature points in the environment, and if the motion feature points are treated as static points, the result of the algorithm is inconsistent.
Specifically, the electronic device may remove outliers by a random sample consensus (RANSAC) algorithm, a robust estimation method, or a combination thereof.
Taking the RANSAC algorithm as an example, the electronic equipment can randomly select a matching feature point as a hypothesis interior point; fitting a model based on the assumed interior points; judging whether the remaining matching feature points conform to the fitted model or not, and dividing the remaining matching feature points into inner points and outer points; if the number of the interior points is too few, marking invalid iteration, and re-fitting the model according to the assumed interior points and the interior points divided in the previous step; and calculating residual errors of all interior points, and re-evaluating the model according to the residual errors and the error rate.
The electronic equipment can iterate the steps, the model with the minimum residual sum or the maximum number of the inner points is used as the optimal model, and the corresponding outer points are obtained according to the optimal model and are removed.
405. And (4) screening images.
After the outer points are removed, the electronic equipment can obtain images to be sorted by centralized screening from the database images according to the number of the matched feature points between each database image and the query image.
302. And calculating the common view proportion of the corresponding images to be sorted and the query images according to the matched first characteristic points between each image to be sorted and the query image.
When the first image set is obtained, the electronic device can synchronously obtain all the first feature points matched between the images to be ranked and the query image.
The common view ratio refers to the area ratio of a matching region where feature points matched between the two images are distributed in the two images and a preset region of an image to which the matching region belongs.
The first feature points comprise feature points in a target image matched with the query image and feature points in the query image matched with the target image, and the target image is an image to be sorted of which the common view proportion is calculated at the current time.
After obtaining the first set of images, the electronic device may compute a common-view ratio between each image to be ranked and the query image one by one.
In one possible implementation, the electronic device may determine a first matching region in the target image and a second matching region in the query image according to the first feature point; and finally, calculating the common view ratio by adopting the smaller of the first matching area and the second matching area.
The first matching area is an area block where a first feature point in the target image is located, and the second matching area is an area block where the first feature point in the query image is located.
The electronic device can divide the target image and the query image into N and M area blocks respectively, the size of each area block is the same, the area blocks can be grids with the size of M, or circles with the radius of r, or unit area blocks with other shapes, and N and M are integers larger than 0; and finally, determining the area block with the first characteristic point as the first matching area or the second matching area.
Specifically, the electronic device may count the first matching region in the target image by counting; and adding 1 to the count when each area block of the target image has the first characteristic point, and expressing the area of the first matching area by using a numerical value. The counting of the second matching region is the same.
It can be understood that, in the target image and the query image, the number of the matched first feature points is the same, and by taking the region block where the first feature points are located as the matching region, the distribution situation of the matched feature points can be intuitively reflected through the size of the matching region; the larger the matching area is, the more discrete the distribution of the matching characteristic points is, and the smaller the matching area is, the more concentrated the distribution of the matching characteristic points is.
In the application, the higher the common view ratio is, the higher the similarity is, and the size of the matching area is in direct proportion to the common view ratio, so that the common view ratio is calculated by adopting the smaller matching area, and the similarity of the target image and the query image can be more accurately reflected. For example, under the condition that the first feature points in the query image are uniformly distributed, the first matching area is smaller than or equal to the second matching area, and the common visual proportion calculated by the first matching area can reflect the similarity under the same standard scale; in some special cases where the first matching area is larger than the second matching area, for example, when the query image includes a large blank area, which results in the first feature points being concentrated, and the target image is a close-up image of a non-blank area in the query image, the similarity between the two images can be better reflected by calculating the common view ratio using the smaller second matching area.
As shown in fig. 5, fig. 5 is a schematic diagram showing a comparison of a query image, which is an image taken 50 meters ahead of a subject, and a target image, which is an image taken 500 meters away from the subject, and a target image, which is an image taken within 10 meters from the subject. Wherein, the dotted line between the images is the connection between the first characteristic points. It is to be understood that all the first feature points are not shown in the figure for the sake of simplicity.
It can be seen that when the common view ratio of the query image and the target image a is calculated, the first matching area is small and the second matching area is large, the common view ratio is calculated by using the first matching area, and the calculating device can reflect the similarity with the query image by the area where the first feature points are distributed in the target image a; when the common-view ratio of the query image and the target image B is calculated, the first matching area is large and the second matching area is small, the common-view ratio is calculated by using the second matching area, and the calculation device can reflect the similarity with the query image in the area where the first feature points are distributed in the query image.
In other possible implementations, the electronic device may calculate only the first matching region or the second matching region, and calculate the co-view ratio according to the first matching region or the second matching region.
After determining the first matching region and the second matching region, and determining the smaller of the two as the common view region, the electronic device may further calculate the common view ratio.
In one possible implementation, the electronic device may calculate a ratio of areas of the images to which the common view region and the common view region belong as a common view ratio.
If the first matching region is smaller than the second matching region, the first matching region is a common-view region, and the electronic equipment calculates the area ratio of the first matching region and the target image to obtain the common-view ratio; specifically, the target image may be divided into N region blocks in the aforementioned step of calculating the first matching region, N may represent an area of the target image, and thus the common view ratio is a ratio of the region count of the first matching region and N.
If the first matching area is larger than the second matching area, calculating the area ratio of the second matching area and the query image to obtain the common view ratio. Similarly, M may represent the area of the query image, and the common view scale is the ratio of the region count of the second matching region to M.
In another possible implementation, the electronic device may calculate a ratio of the areas of the common-view region and the feature region in the same image as the common-view ratio.
Specifically, referring to fig. 6, fig. 6 is a flowchart of a co-view scale calculation according to an embodiment of the present application, where the flowchart includes steps 601 to 603.
601. And calculating a matching area and a characteristic area.
After determining the target image, the electronic device may first obtain a first feature point matched between the target image and the query image, and calculate a first matching region A1 in the target image and a second matching region A2 in the query image according to the first feature point.
Then, the electronic device may adopt steps 401 to 403 in the method embodiment described in fig. 4 to obtain a second feature point that the target image and the target image match themselves, and a third feature point that the query image and the query image match themselves; and then calculating a first characteristic region B1 in which the second characteristic point in the target image is located and a second characteristic region B2 in which the third characteristic point in the query image is located.
It can be understood that the above method for calculating the area of the region is to count the region block where the corresponding feature point is located, and is the same as the above method for counting the area of the region, and is not described herein again.
602. And judging whether the first matching area is larger than the second matching area.
After the calculation results of A1 and A2, the electronic device may determine whether the first matching area is larger than the second matching area by comparing the sizes of A1 and A2; then, the smaller matching area is used as the common view area, and step 603 is performed.
603. The common view ratio is calculated.
And if A1 is larger than A2, calculating the ratio of the second matching area A2 to the fourth characteristic area B2 to obtain the common visual proportion C.
And if the A1 is smaller than the A2, calculating the ratio of the first matching area A1 to the third characteristic area B1 to obtain the common visual proportion C.
In the application, the ratio of the matching area to the corresponding characteristic area is calculated as the common view ratio, so that the interference of a blank area or a characteristic point-free area in the image can be eliminated, and the obtained common view ratio can more accurately reflect the similarity of the distribution situation of the second characteristic points in the two images.
303. And sorting the plurality of images to be sorted according to the common view proportion.
After obtaining the common-view ratio of each image to be sorted, the electronic device may sort the images to be sorted in the first image set from large to small according to the common-view ratio.
In a possible implementation, the electronic device may delete the images to be sorted having a common view ratio lower than the first threshold in the first image set, and then sort the remaining images to be sorted.
The first threshold is a preset common-view ratio threshold.
In one possible implementation, after the electronic device sorts the images to be sorted, the electronic device may select the top P images as an input image set, where P is an integer greater than 0, and the input image set is used as an input of another algorithm.
Wherein the other algorithm may be an image localization algorithm or a pose estimation algorithm.
In the embodiment of the application, after the image sequence with the similarity ordered from top to bottom is obtained, the first N images can be selected as the input of other algorithms, so that the accuracy of the algorithm can be improved, and meanwhile, the operation amount and the operation time of the algorithm are reduced.
According to the method and the device, after the images to be sorted which are similar to the image characteristics of the query images are obtained through retrieval, the common-view proportion reflecting the distribution of the characteristic points is obtained through calculation according to the matched characteristic points between the images to be sorted and the query images; and finally, the images to be sorted are sorted according to the common-view proportion, so that the effect of further sorting the retrieval results according to the feature point distribution of the images is achieved, and the problem of low sorting precision of similar images is solved.
Referring to fig. 7, fig. 7 is a block diagram illustrating an image sorting apparatus 700 according to an embodiment of the present disclosure, where the image sorting apparatus 700 includes:
an obtaining unit 701, configured to obtain a first image set, where the first image set includes a plurality of images to be ranked, and the images to be ranked are images obtained by retrieval according to a query image;
a calculating unit 702, configured to calculate, according to a first feature point matched between each image to be ranked and the query image, a common view ratio corresponding to the image to be ranked and the query image, where the first feature point includes a feature point in a target image that is matched with the query image and a feature point in the query image that is matched with the target image, the target image is the image to be ranked, in which the common view ratio is currently calculated, and the common view ratio refers to an area ratio of a matching region, in which the feature points matched between two images are distributed, in the two images to a preset region of an image to which the matching region belongs;
the sorting unit 703 is configured to sort the multiple images to be sorted according to the common view scale.
In a possible implementation, the computing unit 702 is specifically configured to: determining a first matching area in the target image and a second matching area in the query image according to the first feature point; the first matching area is an area block where the first characteristic point in the target image is located, and the second matching area is an area block where the first characteristic point in the query image is located; the common view ratio is calculated using the smaller of the first matching region and the second matching region.
In a possible implementation, the computing unit 702 is specifically configured to: if the first matching area is smaller than the second matching area, calculating the area ratio of the first matching area and the target image to obtain the common view ratio; if the first matching area is larger than the second matching area, calculating the area ratio of the second matching area and the query image to obtain the common view ratio.
In a possible implementation, the computing unit 702 is specifically configured to: if the first matching area is smaller than the second matching area, calculating the area ratio of the first matching area and a first characteristic area of the target image to obtain the common view ratio; the first characteristic region is a region block where a second characteristic point in the target image is located, and the second characteristic point is a characteristic point matched between the target image and the target image; if the first matching area is larger than the second matching area, calculating the area ratio of the second matching area and a second characteristic area of the query image to obtain the common view ratio; the second feature region is a region block where a third feature point in the query image is located, and the third feature point is a feature point matched between the query image and the query image.
In a possible implementation, the computing unit 702 is specifically configured to: dividing the target image and the query image into N and M area blocks respectively, wherein the size of each area block is the same, and N and M are integers larger than 0; and determining the area block in which the second characteristic point exists as the first matching area or the second matching area.
In one possible implementation, the apparatus further comprises: a deleting unit 704, configured to delete the image to be sorted in the first image set, where the common view ratio is lower than the first threshold.
In a possible implementation, the sorting unit 703 is specifically configured to: sorting the images to be sorted in the first image set from large to small according to the common-view proportion to obtain a sorting result; the device also includes: the output unit 705 inputs the first P images in the sorting result into an image positioning algorithm or a pose estimation algorithm, where P is an integer greater than 0.
The image sorting apparatus 700 provided in this embodiment is used for executing the image sorting method of the foregoing embodiments, and the technical principle and the technical effect are similar, and are not described herein again.
The image processing apparatus 700 is implemented as a functional unit. The term "unit" herein may be implemented in software and/or hardware, and is not particularly limited thereto.
The embodiment of the application further provides electronic equipment which comprises the processor. The electronic device provided by this embodiment may be the electronic device 100 shown in fig. 1, and is configured to execute the image sorting method. In case an integrated unit is employed, the electronic device may comprise a processing module, a storage module and a communication module. The processing module may be configured to control and manage actions of the electronic device, and for example, may be configured to support the electronic device to perform steps performed by the display unit, the detection unit, and the processing unit. The memory module can be used to support the electronic device in executing stored program codes and data, etc. The communication module can be used for supporting the communication between the electronic equipment and other equipment.
The processing module may be a processor or a controller. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. A processor may also be a combination of computing functions, e.g., a combination of one or more microprocessors, a Digital Signal Processing (DSP) and a microprocessor, or the like. The storage module may be a memory. The communication module may specifically be a radio frequency circuit, a bluetooth chip, a Wi-Fi chip, or other devices that interact with other electronic devices.
In an embodiment, when the processing module is a processor and the storage module is a memory, the electronic device according to this embodiment may be a device having the structure shown in fig. 1.
Specifically, referring to fig. 8, fig. 8 shows a schematic structural diagram of another electronic device provided in the present application. The dashed lines in fig. 8 indicate that the unit or the module is optional. The electronic device 800 may be used to implement the image ordering method described in the above method embodiments.
The electronic device 800 includes one or more processors 801, and the one or more processors 801 may enable the electronic device 800 to implement the image ordering method in the above-described method embodiments.
The processor 801 may be configured to control the electronic device 800, execute software programs, and process data of the software programs. The electronic device 800 may also include a communication unit 805 to enable input (reception) and output (transmission) of signals.
The electronic device 800 may include one or more memories 802, on which programs 804 are stored, and the programs 804 may be executed by the processor 801 to generate instructions 803, so that the processor 801 executes the image sorting method described in the above method embodiments according to the instructions 803.
Optionally, the memory 802 may also have data stored therein. Alternatively, processor 801 may also read data stored in memory 802, which may be stored at the same memory address as program 804, or at a different memory address than program 804.
The processor 801 and the memory 802 may be provided separately or integrated together; for example, on a System On Chip (SOC) of the terminal device.
The embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the processor is enabled to execute the image sorting method according to any one of the above embodiments.
Such as memory 802. The memory 802 can be either volatile memory or nonvolatile memory, or the memory 802 can include both volatile and nonvolatile memory. The non-volatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash memory. Volatile memory can be Random Access Memory (RAM), which acts as external cache memory. It is to be understood that the above description is intended to be illustrative, and not restrictive.
The embodiment of the present application further provides a computer program product, which when running on a computer, causes the computer to execute the above related steps to implement the image sorting method in the above embodiment.
The computer program product may be stored in the memory 802, for example, as a program 804, and the program 804 may be pre-processed, compiled, assembled, and linked to obtain an executable object file capable of being executed by the processor 801.
The electronic device, the computer-readable storage medium, the computer program product, or the chip provided in this embodiment are all configured to execute the corresponding method provided above, and therefore, the beneficial effects that can be achieved by the electronic device, the computer-readable storage medium, the computer program product, or the chip may refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, a module or a unit may be divided into only one logic function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another apparatus, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, the replaced units may or may not be physically separated, and the components shown as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a variety of media that can store program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of ordering images, the method comprising:
acquiring a first image set, wherein the first image set comprises a plurality of images to be sorted, and the images to be sorted are images obtained by searching according to query images;
calculating a common-view ratio corresponding to the images to be sorted and the query images according to first feature points matched between each image to be sorted and the query images, wherein the first feature points comprise feature points matched with the feature points of the query images in a target image and feature points matched with the feature points of the target images in the query images, the target image is the image to be sorted of which the common-view ratio is currently calculated, and the common-view ratio refers to the area ratio of a matching area of the feature points matched between the two images, which are distributed in the two images, to a preset area of an image to which the matching area belongs;
and sequencing the images to be sequenced according to the common-view proportion.
2. The method according to claim 1, wherein the calculating the common view ratio of the images to be sorted and the query image according to the matched first feature point between each image to be sorted and the query image comprises:
determining a first matching region in the target image and a second matching region in the query image according to the first feature point; the first matching area is an area block where the first characteristic point in the target image is located, and the second matching area is an area block where the first characteristic point in the query image is located;
calculating the common view ratio using a smaller of the first matching region and the second matching region.
3. The method of claim 2, wherein said calculating the co-view scale using the smaller of the first matching region and the second matching region comprises:
if the first matching region is smaller than the second matching region, calculating the area ratio of the first matching region and the target image to obtain the common-view ratio;
if the first matching area is larger than the second matching area, calculating the area ratio of the second matching area and the query image to obtain the common view ratio.
4. The method of claim 2, wherein said calculating the common view scale using the smaller of the first matching region and the second matching region comprises:
if the first matching region is smaller than the second matching region, calculating the area ratio of the first matching region and a first characteristic region of the target image to obtain the common view ratio; the first characteristic region is a region block where a second characteristic point in the target image is located, and the second characteristic point is a characteristic point matched between the target image and the target image;
if the first matching region is larger than the second matching region, calculating the area ratio of the second matching region and a second characteristic region of the query image to obtain the common view ratio; the second characteristic region is a region block where a third characteristic point in the query image is located, and the third characteristic point is a characteristic point matched between the query image and the query image.
5. The method according to any one of claims 2 to 4, wherein the determining a first matching region in the target image and a second matching region in the query image according to the first feature point comprises:
dividing the target image and the query image into N and M area blocks respectively, wherein the size of each area block is the same, and N and M are integers greater than 0;
determining a region block in which the first feature point exists as the first matching region or the second matching region.
6. The method according to any one of claims 1 to 4, wherein prior to said sorting the plurality of images to be sorted according to the common view proportion, the method further comprises:
deleting the images to be sorted in the first image set, wherein the common visual proportion of the images to be sorted is lower than a first threshold value.
7. The method according to any one of claims 1 to 4, wherein said sorting the plurality of images to be sorted according to the common view scale comprises:
sorting the images to be sorted in the first image set from large to small according to the common-view proportion to obtain a sorting result;
after the sorting the plurality of images to be sorted according to the common-view scale, the method further comprises:
and inputting the first P images in the sequencing result into an image positioning algorithm or a pose estimation algorithm, wherein P is an integer larger than 0.
8. An electronic device, comprising a processor configured to couple with a memory and to read instructions in the memory and to cause the electronic device to perform the method according to any of claims 1 to 7 according to the instructions.
9. A computer-readable storage medium, in which a computer program is stored which, when executed by a processor, causes the processor to carry out the method of any one of claims 1 to 7.
10. A computer program product, the computer program product comprising: computer program code which, when executed by a processor, causes the processor to perform the method of any of claims 1 to 7.
CN202211364538.1A 2022-11-02 2022-11-02 Image ordering method, electronic device, program product and medium Active CN115437601B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211364538.1A CN115437601B (en) 2022-11-02 2022-11-02 Image ordering method, electronic device, program product and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211364538.1A CN115437601B (en) 2022-11-02 2022-11-02 Image ordering method, electronic device, program product and medium

Publications (2)

Publication Number Publication Date
CN115437601A true CN115437601A (en) 2022-12-06
CN115437601B CN115437601B (en) 2024-04-19

Family

ID=84252884

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211364538.1A Active CN115437601B (en) 2022-11-02 2022-11-02 Image ordering method, electronic device, program product and medium

Country Status (1)

Country Link
CN (1) CN115437601B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117131213A (en) * 2023-04-10 2023-11-28 荣耀终端有限公司 Image processing method and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220067082A1 (en) * 2020-09-03 2022-03-03 General Electric Company Inspection systems and methods including image retrieval module
CN114782716A (en) * 2022-04-11 2022-07-22 中国工商银行股份有限公司 Image matching method and device
WO2022161011A1 (en) * 2021-01-29 2022-08-04 华为技术有限公司 Method for generating image and electronic device
CN115170893A (en) * 2022-08-29 2022-10-11 荣耀终端有限公司 Training method of common-view gear classification network, image sorting method and related equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220067082A1 (en) * 2020-09-03 2022-03-03 General Electric Company Inspection systems and methods including image retrieval module
WO2022161011A1 (en) * 2021-01-29 2022-08-04 华为技术有限公司 Method for generating image and electronic device
CN114782716A (en) * 2022-04-11 2022-07-22 中国工商银行股份有限公司 Image matching method and device
CN115170893A (en) * 2022-08-29 2022-10-11 荣耀终端有限公司 Training method of common-view gear classification network, image sorting method and related equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
易军凯 等: "图像的SIFT特征二阶检索算法", 北京化工大学学报(自然科学版), vol. 43, no. 4, 20 July 2016 (2016-07-20), pages 84 - 89 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117131213A (en) * 2023-04-10 2023-11-28 荣耀终端有限公司 Image processing method and related equipment

Also Published As

Publication number Publication date
CN115437601B (en) 2024-04-19

Similar Documents

Publication Publication Date Title
CN110134316B (en) Model training method, emotion recognition method, and related device and equipment
CN113794800B (en) Voice control method and electronic equipment
CN113645351B (en) Application interface interaction method, electronic device and computer-readable storage medium
CN111061912A (en) Method for processing video file and electronic equipment
CN113364971A (en) Image processing method and device
CN112130714B (en) Keyword search method capable of learning and electronic equipment
CN113838490B (en) Video synthesis method and device, electronic equipment and storage medium
CN113542580B (en) Method and device for removing light spots of glasses and electronic equipment
CN111881315A (en) Image information input method, electronic device, and computer-readable storage medium
WO2021169370A1 (en) Method for cross-device allocation of service elements, terminal device, and storage medium
CN116070035B (en) Data processing method and electronic equipment
CN112204532A (en) Method for evaluating AI task support capability by terminal and terminal
CN113970888A (en) Household equipment control method, terminal equipment and computer readable storage medium
CN114995715A (en) Control method of floating ball and related device
CN115115679A (en) Image registration method and related equipment
CN112637477A (en) Image processing method and electronic equipment
CN115437601B (en) Image ordering method, electronic device, program product and medium
CN112740148A (en) Method for inputting information into input box and electronic equipment
CN111249728B (en) Image processing method, device and storage medium
CN114911400A (en) Method for sharing pictures and electronic equipment
CN114444000A (en) Page layout file generation method and device, electronic equipment and readable storage medium
CN113380240B (en) Voice interaction method and electronic equipment
CN115730091A (en) Comment display method and device, terminal device and readable storage medium
CN113407300A (en) Application false killing evaluation method and related equipment
CN114812381A (en) Electronic equipment positioning method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant