Giter Club home page Giter Club logo

basic-image-processing's Introduction

Basic Digital Image Processing Tasks

This repository contains basic implementations of image processing algorithms in python.

Required Libraries

  • PIL
$ pip install pillow
  • opencv-python
$ pip install opencv-python

Algorithms

Gradient

$ python gradient.py
Original Gradient
Gradient-Original Gradient-Result

Image Negative

$ python negative.py binary.jpeg binary
Original Binary Negative
Binary-Negative-Original Binary-Negative-Result
$ python negative.py lena.jpg gray
Original Grayscale Negative
Gray-Negative-Original Gray-Negative-Result
$ python negative.py lena.jpg rgb
Original RGB Negative
Rgb-Negative-Original Rgb-Negative-Result

Image Segmentation

$ python Segmentation.py
Original Segmented
Segmented-Original Segmented-Result

Centroid

$ python Centroid.py
Original Centroid
Centroid-Original
Top LeftTop Right
Centroid-TopLeftCentroid-TopRight
Bottom LeftBottom Right
Centroid-BottomLeftCentroid-BottomRight

Connected Component Labelling

$ python ccl4.py
Original CCL4 Labelled
CCL4-Original CCL4-Result

Histogram Equalization

$ python hist_eq.py
Original Histogram Equalized
Hist-eq-Original Hist-eq-Result

Local Histogram Analysis

Original Local Histogram
Local-Hist-Original Local-Hist-Result

Morphology

$ python Simple.py
Original Morphology
Morphology-Original
ErosionDilation
ErosionDilation
OpeningClosing
OpeningClosing

Sharpening

$ python sharpen.py
Original Sharpened
Sharpened-Original Sharpened-Result

Skeletonization

$ python Skeletonization.py

Skeletionization

Smoothing

$ python AvergingFilter.py
Original Averaging Filter
Averaging-Original Averaging-Result
$ python gaussian.py
Original Gaussian
gaussian-Original gaussian-Result
$ python unsharp_masking.py
Original Unsharp Masking
Unsharp-Original Unsharp-Result
$ python median.py
Original Median
Unsharp-Original Unsharp-Result

XY Cuts

$ python XY_Cuts.py
Original XY Cuts
XY-Original XY-Result

Template Matching

$ python TemplateMatching.py
Template Matched in Image
Template MatchedTemplate

basic-image-processing's People

Contributors

mohammaduzair9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

basic-image-processing's Issues

Another problem

def calculateTransitions(im):
h, w = im.shape[0], im.shape[1]
prev = im[0,0]
n = 0
for x in range(1, h):
for y in range(1, w):
curr = im[x,y]
# check if the is black to white transition
n = n+1 if curr == 255 and prev == 0 else n
prev = curr
return n

There is something wrong with
n = n+1 if curr == 255 and prev == 0 else n
prev = curr
return n
this part

please solve getting the same error

I am getting an error

NameError Traceback (most recent call last)
in
54 return n
55
---> 56 boundingBox = findBB(binary)
57 cropImg = binary[boundingBox[0]:boundingBox[1], boundingBox[2]:boundingBox[3]]
58 centroid = findCentroid(cropImg)

in findBB(im)
10 right, bottom = 0, 0
11
---> 12 for x in xrange(h):
13 for y in xrange(w):
14 if (im[x,y] == 0):

NameError: name 'xrange' is not defined

I am getting another error

ValueError Traceback (most recent call last)
in
55 return n
56
---> 57 boundingBox = findBB(binary)
58 cropImg = binary[boundingBox[0]:boundingBox[1], boundingBox[2]:boundingBox[3]]
59 centroid = findCentroid(cropImg)

in findBB(im)
13 for x in range(h):
14 for y in range(w):
---> 15 if (im[x,y] == 0):
16 right = x if x > right else right
17 left = x if x < left else left

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I have tried a lot but still not able to solve this error. Please help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.