Skip to content

Akaspreet/Hookups

Repository files navigation

Hook ups

Discription

This is the system in which we search for a match for an image. We select a game for a person by using hash coding. We check the hash code difference between the two images. Image with a minimum contrast gets selected and finally shown.

Library used

OS: for using an operating system.

Sys: for providing various functions of the system.

Glob: used to return all file paths that match a specific pattern.

Imagehash: used to convert the Image into hash code.

PIL: Python Imaging Library (expansion of PIL) is an image processing package. It incorporates lightweight image processing tools that aid in editing, creating, and saving images.

Execution Steps:

Firstly, we run a file named resized1.py (that we used to resize all our images in a folder and change them into one extension like here it is .jpg).

  1. Import the libraries.
  2. Give a path of a directory to a program.
  3. We use listdir to get the list of all files and directories in the specified directory.
  4. We make a function named resize () in which we run a for loop, and one by one, we select Image from the directory.
  5. In that, I use if loop, open that Image, and use the method splitext to split a string into text.
  6. Then, using the resize method, we resize our Image by giving the dimension we require (here, it is 400X400). (Here, one parameter given in resize is Image.ANTIALIAS that a technique used in digital imaging to reduce the visual defects that occur when high-resolution images are present in a lower resolution.)
  7. Here we are done and get our final resized Image in that directory.

Secondly, we run our main program that is match.py, after resizing all our images.

  1. Import the libraries.
  2. To open the Image (that we want to search for a perfect match for), we give a path of our directory to a program.
  3. We use the average_hash method from the image hash to get the hashcode of our Image.
  4. To extract the multiple files of the same pattern, we use glob. glob.
  5. We make a list named girls [0] and a variable named accepted_difference = 1000.
  6. Then we run a for loop to extract Images from a directory and get their hash code.
  7. We make a difference between the hashcode of the Image (that we want to search for a perfect match) and the images (in the directory we are finding).
  8. Then we use an if loop inside for loop and check the condition if (diff< accepted_diff) then that Image has been selected.
  9. Then we create a new frame to open both images and save them with a specific name (here, it is my_valentine_dat_date.jpg).
  10. Finally, we use img. show () to show or open that, Image.




image

image

image

image

image

image

image

image



Result

my_valentine_day_date



my_shaadi.com.mp4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published