Read here: http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for an explanation
ID: 664873 • Letter: R
Question
Read here: http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for an explanation of the classical Hough transform. Read here http://www.mathworks.com/help/images/hough-transform.html about steps in using Hough transform software modules. Read here https://en.wikipedia.org/wiki/Hough_transform at least as far as the section Examples. Note the bulleted points, including A graph of the line lengths for each angle, known as a Hough space graph, is then created. Note that these are the colored x's. See the animation at http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html, where the creation of proposed lines at several angles, for each of several points in the image is shown. Create an image containing 4 distinct points, 3 of which are colinear, the 4th now. Plan how to attack this problem, looking specifically for the line with the most collinear points. Discuss how much storage this would take (sizes of arrays). Write code to find the line formed by the 3 points.
Explanation / Answer
package main import ( "fmt" "image" "image/color" "image/draw" "image/png" "math" "os" ) func hough(im image.Image, ntx, mry int) draw.Image { nimx := im.Bounds().Max.X mimy := im.Bounds().Max.Y mry = int(mry/2) * 2 him := image.NewGray(image.Rect(0, 0, ntx, mry)) draw.Draw(him, him.Bounds(), image.NewUniform(color.White), image.ZP, draw.Src) rmax := math.Hypot(float64(nimx), float64(mimy)) dr := rmax / float64(mry/2) dth := math.Pi / float64(ntx) for jx := 0; jxRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.