FANDOM


#Histogram Equalization - Most pixel values are within a small range. E.g. (125:175), think grayscale

#    Edge dectection at a disadvantage here
#    The goal is to spread out the histogram to use the full dynamic range available.

import numpy
import cv2

img=cv2.imread('file.jpg',0)
img_eq=equalizeHist(img)

#Hough Line Transfomr
#    Creates a 2D array to hold all possible values of p and theata.  All values are initial set to 0.
#    Now each pixel and determine if there is enough evidence or a staight line at that pixel.  If so then do some math and do some things.
#    Lastly, findthe bins with the highest values.

edges=cv2.Canny(img, 50, 100)
lines=cv2.HoughLines(edges, 1, numpy.pi/180,200)


#Hough Circle Transfomr
#    Don't tell Jeremy but there is a more advanced method for finding circles call Hough Gradient Method.

circles=cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1, 20, param1=50, param2=30,minRadius=0, maxRadius=0)
#(img, method (only gradient), dp -> inverse ration of the accumulator resolution to the image resolution, minDist (in pixels), param1, param2, minRadius, MaxRadius)

#Template matching - Not sure what this does, but I think it will find similar shapes as the template
#    Don't tell Jeremy, but this is beyond the scope to learn how it works

temp=cv2.imgread('template.jpg',0)
res=matchTemplate(img, temp, methd)
minV,maxV,minL,maxL=cv2.minMaxLoc(res) #finds the location of found image, this tells you where its at.
# does not take into account size difference of template vs image size. Apparently that's a grad course. Here we are looking for something that's the same size.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.