I am new to Julia and image processing. I need to implement geometrical shape (e.g. triangle, rectangle) detection for a course assignment. I want to solve it using Julia only (not e.g. opencv)
I found an article doing this in .net : - this gives idea if I have a list of objects extracted from the image, then with some calculation I can recognise simple shapes.
I went through this book: Cudihins: Hands-On Computer Vision with Julia , but did not find help (or I did not understand what I need from there)
I got this far, a simple colored geometrical shapes image converted to a bitmap containing only the edges. How can I get a list of objects where each object has a list of edges? Or this result is a dead end and I need something else?
using Images, ImageFeatures, FileIO img = Images.load(Images.download("http://www.aforgenet.com/articles/shape_checker/demo.png")) gray_img = Gray.(img); img_edges = canny(gray_img, (Percentile(97), Percentile(60))); dx, dy=imgradients(gray_img, KernelFactors.ando5); img_phase = phase(dx, dy); centers, radii = hough_circle_gradient(img_edges, img_phase, 20:30); img_demo = Float64.(img_edges); for c in centers img_demo[c] = 2; end [img Gray.(img_demo)]
also tried this (continuing the above code):
using ImageFiltering gx, gy = ImageFiltering.imgradients(Gray.(img_edges),KernelFactors.ando3, "replicate") mag, grad_angle = Images.magnitude_phase(gx,gy) #mag[mag .< 0.5] .= 0.0 # Threshold magnitude image thinned = Images.thin_edges(mag, grad_angle) [Gray.(mag) Gray.(thinned)]
but obviously I do not understand what I am doing.
Please give me some pointers what/where to look for.