diff --git a/README.md b/README.md index f984923c6..163758a7a 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,16 @@ Description. The package package_name is used to: - - - - + Processing + - Histogram matching + - Structural similary + - Resize image + Utils + - Read image + - Save image + - Plot image + - Plot result + - Plot histogram ## Installation @@ -13,15 +21,8 @@ Use the package manager [pip](https://pip.pypa.io/en/stable/) to install package pip install package_name ``` -## Usage - -```python -from package_name.module1_name import file1_name -file1_name.my_function() -``` - ## Author -My_name +Rodrigo ## License [MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git a/build/lib/image_processing/__init__.py b/build/lib/image_processing/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/build/lib/image_processing/processing/__init__.py b/build/lib/image_processing/processing/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/build/lib/image_processing/processing/combination.py b/build/lib/image_processing/processing/combination.py new file mode 100644 index 000000000..a75ecbd27 --- /dev/null +++ b/build/lib/image_processing/processing/combination.py @@ -0,0 +1,17 @@ +import numpy as np +from skimage.color import rgb2gray +from skimage.exposure import match_histograms +from skimage.metrics import structural_similarity + +def find_difference(image1, image2): + assert image1.shape == image2.shape, "Specify 2 images with de same shape." + gray_image1 = rgb2gray(image1) + gray_image2 = rgb2gray(image2) + (score, difference_image) = structural_similarity(gray_image1, gray_image2, full=True) + print("Similarity of the images:", score) + normalized_difference_image = (difference_image-np.min(difference_image))/(np.max(difference_image)-np.min(difference_image)) + return normalized_difference_image + +def transfer_histogram(image1, image2): + matched_image = match_histograms(image1, image2, multichannel=True) + return matched_image \ No newline at end of file diff --git a/build/lib/image_processing/processing/transformation.py b/build/lib/image_processing/processing/transformation.py new file mode 100644 index 000000000..a726ada29 --- /dev/null +++ b/build/lib/image_processing/processing/transformation.py @@ -0,0 +1,8 @@ +from skimage.transform import resize + +def resize_image(image, proportion): + assert 0 <= proportion <= 1, "Specify a valid proportion between 0 and 1." + height = round(image.shape[0] * proportion) + width = round(image.shape[1] * proportion) + image_resized = resize(image, (height, width), anti_aliasing=True) + return image_resized \ No newline at end of file diff --git a/build/lib/image_processing/utils/__init__.py b/build/lib/image_processing/utils/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/build/lib/image_processing/utils/io.py b/build/lib/image_processing/utils/io.py new file mode 100644 index 000000000..12d396ffc --- /dev/null +++ b/build/lib/image_processing/utils/io.py @@ -0,0 +1,8 @@ +from skimage.io import imread, imsave + +def read_image(path, is_gray = False): + image = imread(path, as_gray = is_gray) + return image + +def save_image(image, path): + imsave(path, image) \ No newline at end of file diff --git a/build/lib/image_processing/utils/plot.py b/build/lib/image_processing/utils/plot.py new file mode 100644 index 000000000..a59c55696 --- /dev/null +++ b/build/lib/image_processing/utils/plot.py @@ -0,0 +1,28 @@ +import matplotlib.pyplot as plt + +def plot_image(image): + plt.figure(figsize=(12, 4)) + plt.imshow(image, cmap='gray') + plt.axis('off') + plt.show() + +def plot_result(*args): + number_images = len(args) + fig, axis = plt.subplots(nrows=1, ncols = number_images, figsize=(12, 4)) + names_lst = ['Image {}'.format(i) for i in range(1, number_images)] + names_lst.append('Result') + for ax, name, image in zip(axis, names_lst, args): + ax.set_title(name) + ax.imshow(image, cmap='gray') + ax.axis('off') + fig.tight_layout() + plt.show() + +def plot_histogram(image): + fig, axis = plt.subplots(nrows=1, ncols = 3, figsize=(12, 4), sharex=True, sharey=True) + color_lst = ['red', 'green', 'blue'] + for index, (ax, color) in enumerate(zip(axis, color_lst)): + ax.set_title('{} histogram'.format(color.title())) + ax.hist(image[:, :, index].ravel(), bins = 256, color = color, alpha = 0.8) + fig.tight_layout() + plt.show() \ No newline at end of file diff --git a/dist/image_proccesing-0.0.1-py3-none-any.whl b/dist/image_proccesing-0.0.1-py3-none-any.whl new file mode 100644 index 000000000..6a0e21919 Binary files /dev/null and b/dist/image_proccesing-0.0.1-py3-none-any.whl differ diff --git a/dist/image_proccesing-0.0.1.tar.gz b/dist/image_proccesing-0.0.1.tar.gz new file mode 100644 index 000000000..4afe8e749 Binary files /dev/null and b/dist/image_proccesing-0.0.1.tar.gz differ diff --git a/image_proccesing.egg-info/PKG-INFO b/image_proccesing.egg-info/PKG-INFO new file mode 100644 index 000000000..66e1f51d2 --- /dev/null +++ b/image_proccesing.egg-info/PKG-INFO @@ -0,0 +1,45 @@ +Metadata-Version: 2.2 +Name: image_proccesing +Version: 0.0.1 +Home-page: https://github.com/yDigss/image-processing-package.git +Author: Rodrigo +Requires-Python: >=3.5 +Description-Content-Type: text/markdown +Requires-Dist: matplotlib +Requires-Dist: numpy +Requires-Dist: scikit-image>=0.16.1 +Dynamic: author +Dynamic: description +Dynamic: description-content-type +Dynamic: home-page +Dynamic: requires-dist +Dynamic: requires-python + +# package_name + +Description. +The package package_name is used to: + Processing + - Histogram matching + - Structural similary + - Resize image + Utils + - Read image + - Save image + - Plot image + - Plot result + - Plot histogram + +## Installation + +Use the package manager [pip](https://pip.pypa.io/en/stable/) to install package_name + +```bash +pip install package_name +``` + +## Author +Rodrigo + +## License +[MIT](https://choosealicense.com/licenses/mit/) diff --git a/image_proccesing.egg-info/SOURCES.txt b/image_proccesing.egg-info/SOURCES.txt new file mode 100644 index 000000000..b95c1ceab --- /dev/null +++ b/image_proccesing.egg-info/SOURCES.txt @@ -0,0 +1,14 @@ +README.md +setup.py +image_proccesing.egg-info/PKG-INFO +image_proccesing.egg-info/SOURCES.txt +image_proccesing.egg-info/dependency_links.txt +image_proccesing.egg-info/requires.txt +image_proccesing.egg-info/top_level.txt +image_processing/__init__.py +image_processing/processing/__init__.py +image_processing/processing/combination.py +image_processing/processing/transformation.py +image_processing/utils/__init__.py +image_processing/utils/io.py +image_processing/utils/plot.py \ No newline at end of file diff --git a/image_proccesing.egg-info/dependency_links.txt b/image_proccesing.egg-info/dependency_links.txt new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/image_proccesing.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/image_proccesing.egg-info/requires.txt b/image_proccesing.egg-info/requires.txt new file mode 100644 index 000000000..9c62440d9 --- /dev/null +++ b/image_proccesing.egg-info/requires.txt @@ -0,0 +1,3 @@ +matplotlib +numpy +scikit-image>=0.16.1 diff --git a/image_proccesing.egg-info/top_level.txt b/image_proccesing.egg-info/top_level.txt new file mode 100644 index 000000000..9e9fe703a --- /dev/null +++ b/image_proccesing.egg-info/top_level.txt @@ -0,0 +1 @@ +image_processing diff --git a/requirements.txt b/requirements.txt index e69de29bb..aedfba4e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,3 @@ +matplotlib +numpy +scikit-image >= 0.16.1 \ No newline at end of file diff --git a/setup.py b/setup.py index e69de29bb..10173f1f2 100644 --- a/setup.py +++ b/setup.py @@ -0,0 +1,20 @@ +from setuptools import setup, find_packages + +with open("README.md", "r") as f: + page_description = f.read() + +with open("requirements.txt") as f: + requirements = f.read().splitlines() + +setup( + name="image_proccesing", + version="0.0.1", + author="Rodrigo", + description="", + long_description=page_description, + long_description_content_type="text/markdown", + url="https://github.com/yDigss/image-processing-package.git", + packages=find_packages(), + install_requires=requirements, + python_requires=">=3.5", +) \ No newline at end of file