Skip to main content

A simple and rapid image processing toolkit

Project description

Quick-Image: A simple image processing toolkit.

Installation

    pip install quick-image

Examples

  1. Basic Usage
from quick_image import *

# quick_download_image(
# pic_url='https://pixnio.com/free-images/2022/07/21/2022-07-21-08-38-18-1350x900.jpg',
# save_path='flower.jpg')

# quick_show_image("flower.jpg")

# quick_show_image_by_grayscale("flower.jpg")

# quick_show_image_by_grayscale2("flower.jpg")

# quick_show_image_gray("flower.jpg")

# quick_convert_12bit_gray("flower.jpg","flower_12bit.jpg")

# quick_show_canny("flower.jpg")

# quick_replace_image_color("flower.jpg",show=True)

# quick_save_edges("flower.jpg","flower_edges.jpg",t=50)

# quick_filter_by_dist("flower.jpg",max_dist=1000)

'''
list_points,list_colors=quick_pick_image_color("flower.jpg","points.csv" ,"colors.csv")
print(list_points)
print(list_colors)
'''

# quick_remove_pix_color("flower.jpg",target_color= [203,152,125],save_path='flower_removed_color.jpg')

quick_remove_pix_color_by_range("flower.jpg",lower_color= np.array([100, 150, 0]),
                                upper_color=np.array([140, 255, 255]),show=True)
  1. Remove noise
from quick_image import *
from quick_image.quick_image_similarity_measures import *

quick_remove_noise1(image_path="flower.jpg",save_path="test4/output1.jpg")

# quick_remove_noise2(image_path="flower.jpg",save_path="test4/output2.jpg",min_size=5)
score_ssim = ssim('flower.jpg', 'test4/output1.jpg')
score_dvsim = dvsim('flower.jpg', 'test4/output1.jpg')
print(score_ssim)
print(score_dvsim)
  1. Estimate color similarity
from quick_image import *
from skimage import io
'''
    find image color similarity
'''
# Example 1:
img_rgb = io.imread('flower.jpg')
green = [203,152,125]
s=get_pct_color(img_rgb, green, 10)
print("s=",s)

# Example 2:
base=[35,103,239]
test_color=[153,0,0]
test_color1=[0,128,255]

print(quick_color_similarity(base,test_color))
print(quick_color_similarity(base,test_color1))
  1. Edge detection
from quick_image.quick_image_processing import *
import time
time_cost={}
if __name__=="__main__":
    image_path="flower.jpg"

    # coords = load_polygon_file(f'datasets/areas/{gender}/{body_part}_polygon_area.pickle')
    file_name="flower.jpg"

    start=time.time()
    # Using Canny algorithm (86)
    detect_edges(img_path=image_path,save_path='test3_output/'+file_name)
    time1=time.time()
    # Using Canny algorithm with polygons
    detect_edges_with_polygon(img_path=image_path, save_path='test3_output/' + file_name)
    time2=time.time()
    # Using single-color isolate algorithm
    isolate_image(image_path=image_path,save_path='test3_output/'+file_name)
    time3=time.time()
    # Using multi-color isolate algorithm
    isolate_image2(image_path=image_path, save_main_color='test3_output/' + file_name, 
                   save_path='test3_output/' + file_name)
    time4=time.time()
    time_cost["canny"]=time1-start
    time_cost["canny_polygon"]=time2-time1
    time_cost["isolate1"]=time3-time2
    time_cost["isolate2"]=time4-time3
    print("Method\tTime cost")
    for k in time_cost:
        print(f"{k}\t{round(time_cost[k],4)}")

License

The quick-image toolkit is provided by Donghua Chen with MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quick-image-0.0.1a0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

quick_image-0.0.1a0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file quick-image-0.0.1a0.tar.gz.

File metadata

  • Download URL: quick-image-0.0.1a0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for quick-image-0.0.1a0.tar.gz
Algorithm Hash digest
SHA256 87f43065a25c757dab767a15c8f5f63aafccd1c54a352a77b0745a09a76f12b0
MD5 da3d0b36215b7f36a4bbfe122833ed71
BLAKE2b-256 8a85bcf42e3d5c422ca9885b16a8d6e589c7f9bf3d438525488c61973dbaf73d

See more details on using hashes here.

File details

Details for the file quick_image-0.0.1a0-py3-none-any.whl.

File metadata

  • Download URL: quick_image-0.0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for quick_image-0.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 85c32c953316f49535cae2ffb5bcea8760ac4c484aa17f5a8b1da0c708379dce
MD5 9647b50431e9dddaf77aa886b2160539
BLAKE2b-256 e0d46c98dc885dd969e656993289953d3b14aa3fd09a4186827672b73edb99ea

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page