CN109213891A - A method of using average hash algorithm search pictures - Google Patents

A method of using average hash algorithm search pictures Download PDF

Info

Publication number
CN109213891A
CN109213891A CN201810951421.0A CN201810951421A CN109213891A CN 109213891 A CN109213891 A CN 109213891A CN 201810951421 A CN201810951421 A CN 201810951421A CN 109213891 A CN109213891 A CN 109213891A
Authority
CN
China
Prior art keywords
gray
picture
average
pixels
color
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.)
Pending
Application number
CN201810951421.0A
Other languages
Chinese (zh)
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.)
SHENZHEN LEWEI TECHNOLOGY DEVELOPMENT Co Ltd
Original Assignee
SHENZHEN LEWEI TECHNOLOGY DEVELOPMENT 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 SHENZHEN LEWEI TECHNOLOGY DEVELOPMENT Co Ltd filed Critical SHENZHEN LEWEI TECHNOLOGY DEVELOPMENT Co Ltd
Priority to CN201810951421.0A priority Critical patent/CN109213891A/en
Publication of CN109213891A publication Critical patent/CN109213891A/en
Pending legal-status Critical Current

Links

Landscapes

  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a kind of methods using average hash algorithm search pictures, belong to field of computer technology, step are as follows: user selects a picture to scan for, picture is narrowed down to the size of 8x8, 64 pixels in total, remove the details of picture, only retain structure, the essential informations such as light and shade, abandon different sizes, ratio bring picture difference, the small picture of 8*8 is converted into gray scale picture, the color of 64 pixels is converted into a kind of color, by original RGB (R, G, B the R in), G, B is unified to be replaced with Gray, form new color RGB (Gray, Gray, Gray), original RGB (R is replaced with it, G, it B) is grayscale image, calculate the average gray of all 64 pixels, the gray scale of compared pixels, by the ash of each pixel Degree, is compared with average value, calculates cryptographic Hash and combines the comparison result of previous step, just constitutes one 64 integers, and the present invention is realized to scheme to search figure, can search original image by thumbnail, can be applied to internet, medically.

Description

A method of using average hash algorithm search pictures
Technical field
The present invention relates to field of computer technology, in particular to a kind of side using average hash algorithm search pictures Method.
Background technique
With the continuous development of Internet technology, internet provides needs of the various search to meet people for people. People not only need to scan for text information, but also are also required to carry out searching for picture or local similar pictures on the internet Rope, but due to the particularity of picture searching, it is a worldwide insoluble skill according to image content search pictures Art problem.
Average hash algorithm, its effect are to generate " fingerprint " character string to every picture, then more different figures The fingerprint of piece.Comparison result is closer, just illustrates that picture is more similar, it is desirable that the content of picture cannot change, if on picture Adding several texts, it cannot be searched out.
Summary of the invention
Invention is designed to provide a kind of method using average hash algorithm search pictures, to scheme to search figure, Ke Yitong It crosses thumbnail and searches original image, can be applied to internet, medically, to solve the problems mentioned in the above background technology.
To achieve the above object, the invention provides the following technical scheme:
A method of using average hash algorithm search pictures, include the following steps:
Step 1: user selects a picture to scan for;
Step 2: picture is narrowed down to the size of 8x8, in total 64 pixels by minification;
Step 3: simplifying picture color, the small picture of 8*8 be converted into gray scale picture, and the color of 64 pixels is converted At a kind of color;
Step 4: calculating pixel average, calculates the average gray of all 64 pixels;
Step 5: the gray scale of each pixel is compared by the gray scale of compared pixels with average value, is greater than or equal to flat Mean value is denoted as 1;Less than average value, it is denoted as 0;
Step 6: it calculates cryptographic Hash and combines the comparison result of previous step, constitute one 64 integers, root Picture fingerprint is generated according to the average gray of each pixel;
Step 7: according to picture fingerprint to data base querying;
Step 8: output query result.
Further, picture is converted to gray scale picture in step 3 can be used floating-point arithmetic: Gray=R*0.3+G* 0.59+B*0.11 or integer method: Gray=(R*30+G*59+B*11)/100 or displacement method: Gray=(R*76+G*151+ B*28) > > 8 or mean value method: Gray=(R+G+B)/3 only takes green: one of Gray=G.
Further, after Gray is acquired by any method, by the R in original RGB (R, G, B), G, B uniformly use Gray Replacement, forms new color RGB (Gray, Gray, Gray), replacing original RGB (R, G, B) with it is grayscale image.
Further, the color of 64 pixels is red, green, blue in step 3, and the color being converted into is black-white-gray Degree.
Compared with prior art, the beneficial effects of the present invention are: the present invention changes traditional picture searching mode, by picture The size of 8x8 is narrowed down to, in total 64 pixels, remove the details of picture, only retained the essential informations such as structure, light and shade, abandon not Same size, ratio bring picture difference, are converted into gray scale picture for the small picture of 8*8, the color of 64 pixels are converted into A kind of color, by the R in original RGB (R, G, B), G, B are unified to be replaced with Gray, formed new color RGB (Gray, Gray, Gray), replacing original RGB (R, G, B) with it is grayscale image, calculates the average gray of all 64 pixels, compares The gray scale of each pixel is compared by the gray scale of pixel with average value, cryptographic Hash is calculated, by the comparison result of previous step, group It is combined, just constitutes one 64 integers, realize to scheme to search figure, original image can be searched by thumbnail, can answered For internet, medically.
Detailed description of the invention
Fig. 1 is picture query process flow diagram of the invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
Referring to Fig. 1, a kind of method using average hash algorithm search pictures, includes the following steps:
Step 1: user selects a picture to scan for, and is scanned for based on this picture;
Step 2: picture is narrowed down to the size of 8x8, in total 64 pixels by minification;The effect of this step is removal The details of picture only retains the essential informations such as structure, light and shade, abandons different sizes, ratio bring picture difference;
Step 3: simplifying picture color, the small picture of 8*8 be converted into gray scale picture, by the colors of 64 pixels (red, Green, blue) it is converted into a kind of color (black and white gray scale);Convenient for subsequent calculating average gray;
Picture complete for a width is made of red, green, blue three channels.Red, green, blue three logical Figure is look in the contracting in road to be shown with gray scale.The specific gravity of " red, green, blue " in picture is indicated with different gray scales.Channel In it is pure white, represent the coloured light here it is maximum brightness, gray scale is 255, and picture, which is converted to gray scale picture, to be adopted With the following method:
Using floating-point arithmetic: Gray=R*0.3+G*0.59+B*0.11;
Integer method: Gray=(R*30+G*59+B*11)/100;
Displacement method: Gray=(R*76+G*151+B*28) > > 8;
Mean value method: Gray=(R+G+B)/3
Only take green: Gray=G.
After acquiring Gray by any of the above-described kind of method, by the R in original RGB (R, G, B), G, B are unified to be replaced with Gray It changes, forms new color RGB (Gray, Gray, Gray), replacing original RGB (R, G, B) with it is grayscale image.
Step 4: calculating pixel average, calculates the average gray of all 64 pixels;
Step 5: the gray scale of each pixel is compared by the gray scale of compared pixels with average value, is greater than or equal to flat Mean value is denoted as 1;Less than average value, it is denoted as 0;Convenient for the combination of next step;
Step 6: it calculates cryptographic Hash and combines the comparison result of previous step, constitute one 64 integers, root Picture fingerprint is generated according to the average gray of each pixel;
Step 7: according to picture fingerprint to data base querying;
Step 8: output query result can search original image by thumbnail.
The present invention is by taking iOS platform picture searching App as an example:
1) user opens picture searching App and takes pictures or upload thumbnail;
2) user opens picture searching App and takes pictures or upload thumbnail;
3) App calculates the average gray of all 64 pixels using the method for calculating pixel grey scale average value;
4) App marks 64 pixels according to the pixel grey scale average value calculated respectively;
5) App calculates picture cryptographic Hash according to the label of each pixel, saves as picture fingerprint;
6) App provides the fingerprint of the picture to server, and server is inquired in the database;
7) App shows search result to user.
In conclusion the method proposed by the present invention using average hash algorithm search pictures, the present invention changes traditional Picture is narrowed down to the size of 8x8 by picture searching mode, in total 64 pixels, removes the details of picture, only retains structure, bright The essential informations such as dark, abandon different sizes, ratio bring picture difference, the small picture of 8*8 are converted into gray scale picture, by 64 The color of a pixel is converted into a kind of color, and by the R in original RGB (R, G, B), G, B are unified to be replaced with Gray, is formed new Color RGB (Gray, Gray, Gray), replacing original RGB (R, G, B) with it is grayscale image, calculates all 64 pixels Average gray, the gray scale of compared pixels.By the gray scale of each pixel, it is compared with average value.More than or equal to average Value, is denoted as 1;Less than average value, it is denoted as 0, calculates cryptographic Hash.It by the comparison result of previous step, combines, just constitutes one A 64 integers are realized to scheme to search figure, can search original image by thumbnail, can be applied to internet, medically.
The foregoing is only a preferred embodiment of the present invention, but scope of protection of the present invention is not limited thereto, Anyone skilled in the art in the technical scope disclosed by the present invention, according to the technique and scheme of the present invention and its Inventive concept is subject to equivalent substitution or change, should be covered by the protection scope of the present invention.

Claims (4)

1. a kind of method using average hash algorithm search pictures, which comprises the steps of:
Step 1: user selects a picture to scan for;
Step 2: picture is narrowed down to the size of 8x8, in total 64 pixels by minification;
Step 3: simplify picture color, the small picture of 8*8 is converted into gray scale picture, the color of 64 pixels is converted into one Kind color;
Step 4: calculating pixel average, calculates the average gray of all 64 pixels;
Step 5: the gray scale of each pixel is compared by the gray scale of compared pixels with average value, is greater than or equal to average value, It is denoted as 1;Less than average value, it is denoted as 0;
Step 6: it calculates cryptographic Hash and combines the comparison result of previous step, one 64 integers are constituted, according to every The average gray of a pixel generates picture fingerprint;
Step 7: according to picture fingerprint to data base querying;
Step 8: output query result.
2. a kind of method using average hash algorithm search pictures according to claim 1, which is characterized in that step 3 It is middle picture to be converted into gray scale picture floating-point arithmetic can be used: Gray=R*0.3+G*0.59+B*0.11 or integer method: Gray =(R*30+G*59+B*11)/100 or displacement method: Gray=(R*76+G*151+B*28) > > 8 or mean value method: Gray =(R+G+B)/3 only takes green: one of Gray=G.
3. a kind of method using average hash algorithm search pictures according to claim 2, which is characterized in that Gray by After any method acquires, by the R in original RGB (R, G, B), G, B are unified to be replaced with Gray, forms new color RGB (Gray, Gray, Gray), replacing original RGB (R, G, B) with it is grayscale image.
4. a kind of method using average hash algorithm search pictures according to claim 1, which is characterized in that step 3 In 64 pixels color be red, green, blue, the color being converted into be black and white gray scale.
CN201810951421.0A 2018-08-20 2018-08-20 A method of using average hash algorithm search pictures Pending CN109213891A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810951421.0A CN109213891A (en) 2018-08-20 2018-08-20 A method of using average hash algorithm search pictures

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810951421.0A CN109213891A (en) 2018-08-20 2018-08-20 A method of using average hash algorithm search pictures

Publications (1)

Publication Number Publication Date
CN109213891A true CN109213891A (en) 2019-01-15

Family

ID=64988885

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810951421.0A Pending CN109213891A (en) 2018-08-20 2018-08-20 A method of using average hash algorithm search pictures

Country Status (1)

Country Link
CN (1) CN109213891A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110031461A (en) * 2019-02-14 2019-07-19 江苏恒力化纤股份有限公司 A kind of polyester filament dye uniformity test method
CN110175559A (en) * 2019-05-24 2019-08-27 北京博视未来科技有限公司 A kind of independent judgment method of the video frame for intelligent recognition
CN111475662A (en) * 2020-04-03 2020-07-31 南京云吾时信息科技有限公司 Background retrieval system for graphic database
CN112131956A (en) * 2020-08-27 2020-12-25 国网湖北省电力有限公司电力科学研究院 Voltage sag source classification method based on difference hash algorithm
CN112308162A (en) * 2020-11-06 2021-02-02 上海软中信息技术有限公司 Image big data similarity comparison method and system
CN113486972A (en) * 2021-07-19 2021-10-08 筑盟(上海)数字科技有限公司 System and method for BIM model copyright authentication

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147927A (en) * 2010-02-05 2011-08-10 新奥特(北京)视频技术有限公司 Processing method for terrain texture map and processing device
CN105139011A (en) * 2015-09-07 2015-12-09 浙江宇视科技有限公司 Method and apparatus for identifying vehicle based on identification marker image
CN105912643A (en) * 2016-04-08 2016-08-31 浙江理工大学 Image retrieval method based on content improved Average Hash
CN106412715A (en) * 2016-09-14 2017-02-15 华为软件技术有限公司 Information retrieval method, terminal and server
CN107909076A (en) * 2017-12-11 2018-04-13 奕响(大连)科技有限公司 A kind of similar decision method of picture based on LBP
CN108038436A (en) * 2017-12-05 2018-05-15 奕响(大连)科技有限公司 A kind of similar decision method of local pixel gray scale picture

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147927A (en) * 2010-02-05 2011-08-10 新奥特(北京)视频技术有限公司 Processing method for terrain texture map and processing device
CN105139011A (en) * 2015-09-07 2015-12-09 浙江宇视科技有限公司 Method and apparatus for identifying vehicle based on identification marker image
CN105912643A (en) * 2016-04-08 2016-08-31 浙江理工大学 Image retrieval method based on content improved Average Hash
CN106412715A (en) * 2016-09-14 2017-02-15 华为软件技术有限公司 Information retrieval method, terminal and server
CN108038436A (en) * 2017-12-05 2018-05-15 奕响(大连)科技有限公司 A kind of similar decision method of local pixel gray scale picture
CN107909076A (en) * 2017-12-11 2018-04-13 奕响(大连)科技有限公司 A kind of similar decision method of picture based on LBP

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110031461A (en) * 2019-02-14 2019-07-19 江苏恒力化纤股份有限公司 A kind of polyester filament dye uniformity test method
CN110031461B (en) * 2019-02-14 2022-03-18 江苏恒力化纤股份有限公司 Polyester filament yarn dyeing uniformity test method
CN110175559A (en) * 2019-05-24 2019-08-27 北京博视未来科技有限公司 A kind of independent judgment method of the video frame for intelligent recognition
CN110175559B (en) * 2019-05-24 2020-12-11 北京博视未来科技有限公司 Independent judgment method for video frame for intelligent identification
CN111475662A (en) * 2020-04-03 2020-07-31 南京云吾时信息科技有限公司 Background retrieval system for graphic database
CN112131956A (en) * 2020-08-27 2020-12-25 国网湖北省电力有限公司电力科学研究院 Voltage sag source classification method based on difference hash algorithm
CN112131956B (en) * 2020-08-27 2022-08-26 国网湖北省电力有限公司电力科学研究院 Voltage sag source classification method based on difference hash algorithm
CN112308162A (en) * 2020-11-06 2021-02-02 上海软中信息技术有限公司 Image big data similarity comparison method and system
CN113486972A (en) * 2021-07-19 2021-10-08 筑盟(上海)数字科技有限公司 System and method for BIM model copyright authentication

Similar Documents

Publication Publication Date Title
CN109213891A (en) A method of using average hash algorithm search pictures
JP5958023B2 (en) Image processing apparatus and image processing program
CN103593830B (en) A kind of low illumination level video image enhancement
CN103402117B (en) Based on the video image color cast detection method of Lab chrominance space
ES2839252T3 (en) Image processing device, image processing method and program
EP1359543A3 (en) Method for detecting subject matter regions in images
KR890004547A (en) Color Image Enhancement System and Method
JP2013211750A (en) Image processing device and image processing program
CN104978565B (en) A kind of pictograph extracting method of universality
US9384519B1 (en) Finding similar images based on extracting keys from images
CN108806638B (en) Image display method and device
Maali Amiri et al. A strategy toward spectral and colorimetric color reproduction using ordinary digital cameras
CN108664951A (en) Pedestrian's recognition methods again based on color name feature
JP2013009074A (en) Information transmission system, light-receiving device, information transmission method, and program
WO2017143812A1 (en) Method and device for differentiating objects
WO2022120799A1 (en) Image processing method and apparatus, electronic device, and storage medium
CN104240197B (en) A kind of erasing method for keeping contrast, colour consistency and gray-scale pixels feature
JP6818284B1 (en) Image processing equipment, image processing system, and image processing method
CN101151882A (en) System and method of processing scan data
JP2008225887A (en) Image retrieval system
CN111815733A (en) Video coloring method and system
Gong et al. Comprehensive model for predicting perceptual image quality of smart mobile devices
TW200930045A (en) Method for color transformation and prospect transfer of image device
CN113610934B (en) Image brightness adjustment method, device, equipment and storage medium
CN115937031A (en) Enhancement method for low-illumination image

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190115

RJ01 Rejection of invention patent application after publication