Created
February 7, 2016 00:46
-
-
Save culurciello/a990ff826f8f0fc15ece to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local cv = require 'cv' | |
require 'cv.highgui' | |
require 'cv.imgproc' | |
require 'cv.imgcodecs' | |
require 'image' | |
-- local image = cv.imread{arg[1] or 'demo/lena.jpg', cv.IMREAD_GRAYSCALE} | |
imgT = image.lena() | |
imgT = image.lena() | |
imgTg = imgT[2] -- convert to grayscale and remove the first dimension | |
imgTgB = (imgTg*255):byte() | |
-- imgCV = imgT:transpose(1,2):transpose(2,3):clone() | |
-- cv.imshow{"Lena", imgCV}; | |
local detector = cv.LineSegmentDetector{} | |
local lines = detector:detect{imgTgB} | |
imgCV = detector:drawSegments{imgTgB, lines} | |
cv.imshow{"Detected lines", imgCV} | |
cv.waitKey{0} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment