Coder Social home page Coder Social logo

o0o0o0o0o0o0o / image-processing-from-scratch Goto Github PK

View Code? Open in Web Editor NEW
1.1K 132.0 305.0 35.69 MB

This project contains some interesting image processing algorithms that were wrote in python and c++ from scratch.

License: MIT License

Python 0.59% C++ 81.45% CMake 2.85% C 2.20% Shell 0.17% Cuda 1.13% Fortran 11.48% JavaScript 0.07% CSS 0.05%

image-processing-from-scratch's Introduction

image processing from scratch

what is this?

This repository contains many interesting image processing algorithms that are written from scratch. Read these codes will allow you to have a comprehensive understanding of the principles of these algorithms.

Implementation
All codes were wrote in python3.7 or c++
moudles you may need:
python:

  • numpy for matix calculation
  • matplotlib for reading and showing images
  • opencv2 for some image operations

c++:

  • opencv2

Usage
you can always run a python script just by
python script.py

for c++, you need to compile first
cd build
cmake ..
make

when it's done, you are ready to run the executable file by
./program_name parameters
Just make sure you have the images in the right path, and you might wanna modify the code a bit to process another image.
Have fun!

Contents

  • canny edge detection
    It is an algorithm that extracts edges of an image.

  • hough transform
    It is an algorithm that can theoratically detects shapes that you can write formulas for it.

  • harris corner detection
    This algorithm detects corners.

  • fast fourier transform
    2-D fourier transform for images using fft.

  • sift
    Scale-invariant feature transform, a well-known technique to extract feature points for image matching. Now added c++ version along with SURF and ORB.

  • KNN
    Using balanced K-D tree to find k nearest neighbors of K-dimension points.

  • PCA&SVD
    Do PCA and SVD using jacobi rotation.(which is accurate but slow)

  • Ransac
    Stitch different images together after knowing the sift keypoint pairs.

  • watershed
    watershed segmentation algorithm.

  • meanshift
    meanshift segmentation algorithm.

  • generalized hough transform
    template match of images, detects a given template in an query image. The vote space is implemented with a sparse vector to support big images.

  • closed-form image matting
    a classic image matting algorithm proposed in A Closed-Form Solution to Natural Image Matting

  • haze removal
    Using dark channel prior and fast guided filter proposed in Single Image Haze Removal Using Dark Channel Prior and Fast Guided Filter

  • a lot to be continued...

image-processing-from-scratch's People

Contributors

o0o0o0o0o0o0o 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  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

image-processing-from-scratch's Issues

Image size not reduced with PCA

I tried using your codes for PCA&SVD and tested it on 0.jpg (21.9 kB) image provided, I found out that in spite of using PCA, the size of image 0_.jpg (73.1 kB) is not reduced.
Any leads will be helpful

SIFT 代码中有一些疑问,求指教

up你好,b站来的。有一些SIFT代码问题求指教:
1、GuassianKernel( ) 求高斯卷积核的时候为啥不需要归一化咧?
2、LocateKeyPoint()函数中,threshold = 0.5contrastThreshold/(n255SIFT_FIXPT_SCALE),计算差分图像中的噪点阈值时候,这个公式与视频中所讲的0.50.4/n不同,是怎么来的啊?
3、LocateKeyPoint()函数中,计算邻域极值的时候,我注意到这个邻域不是 33,而是34?这是为啥呢?对于i是i-1,但对于j就变成了j+2,不应该是j+1嘛?
eight_neiborhood_prev = img_prev[max(0, i - 1):min(i + 2, img_prev.shape[0]), max(0, j - 1):min(j + 2, img_prev.shape[1])] eight_neiborhood = img[max(0, i - 1):min(i + 2, img.shape[0]), max(0, j - 1):min(j + 2, img.shape[1])] eight_neiborhood_next = img_next[max(0, i - 1):min(i + 2, img_next.shape[0]), max(0, j - 1):min(j + 2, img_next.shape[1])]

ERROR:slice indices must be integers or None or have an __index__ `method`

Traceback (most recent call last):
  File "HoughTransform.py", line 94, in <module>
    lines = lines_detector_hough(edge)
  File "HoughTransform.py", line 45, in lines_detector_hough
    eight_neiborhood = accumulator[max(0, result[0,i] - halfThetaWindowSize + 1):min(result[0,i] + halfThetaWindowSize, accumulator.shape[0]), max(0, result[1,i] - halfDistWindowSize + 1):min(result[1,i] + halfDistWindowSize, accumulator.shape[1])]
TypeError: slice indices must be integers or None or have an __index__ `method`

Value 'info.shape' is unsubscriptable

{
"resource": "/D:/Github/clone path/image-processing-from-scratch/sift/SIFT.py",
"owner": "python",
"code": "unsubscriptable-object",
"severity": 8,
"message": "Value 'info.shape' is unsubscriptable",
"source": "pylint",
"startLineNumber": 507,
"startColumn": 26,
"endLineNumber": 507,
"endColumn": 26
}

运行sift.py时报错

Traceback (most recent call last):
File "/home/zsc/桌面/image-processing-from-scratch/sift/SIFT.py", line 557, in
drawLines(X1,X2,Y1,Y2,match[0][:,0],result)
File "/home/zsc/桌面/image-processing-from-scratch/sift/SIFT.py", line 503, in drawLines
img = Lines(img,info)
File "/home/zsc/桌面/image-processing-from-scratch/sift/SIFT.py", line 491, in Lines
result[i,j] = color
ValueError: cannot copy sequence with size 3 to array axis with dimension 4

运行Watershed算法报错

Windows上使用VS2019运行分水岭算法代码时,出现如下错误:
image
找不出问题所做,请求帮助。

some questions in function convlove()

Hi, I have a question about the function convlove()
"val = (filter * pad_mat[j * strides[1]:j * strides[1] + filter_size[0],
k * strides[0]:k * strides[0] + filter_size[1]]).sum()"
why you multiply "j" with stride[i]? In the "for j in range(0, mat_size[0], strides[1]):" , there is a strides[1]. I'm confused about it. Thank you!

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.