{ "info": { "author": "Gefu Tang", "author_email": "tanggefu@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "pylsd\n=============\n\n### 1. Introduction\n\npylsd is the python bindings for [LSD - Line Segment Detector](http://www.ipol.im/pub/art/2012/gjmr-lsd/).\n\n### 2. Install\n\nThis package uses distutils, which is the default way of installing python modules. To install in your home directory, securely run the following:\n```\ngit clone https://github.com/primetang/pylsd.git\ncd pylsd\n[sudo] python setup.py install\n```\n\nOr directly through `pip` to install it:\n```\n[sudo] pip install pylsd\n```\n\n### 3. Usage\n\nWe can use the package by using `from pylsd.lsd import lsd`, and `lines = lsd(src)` is the call format for the `lsd` function, where `src` is a Grayscale Image (`H * W` numpy.array), and the return value `lines` is the Detected Line Segment, `lines` is an `N * 5` numpy.array, each row represents a straight line, the 5-dimensional vector is:\n\n`[point1.x, point1.y, point2.x, point2.y, width]`\n\n\nAccording to these presentations, we can use it just like the following code ([here is the link](https://github.com/primetang/pylsd/tree/master/example)):\n\n* by using cv2 module\n\n```python\nimport cv2\nimport numpy as np\nimport os\nfrom pylsd.lsd import lsd\nfullName = 'car.jpg'\nfolder, imgName = os.path.split(fullName)\nsrc = cv2.imread(fullName, cv2.IMREAD_COLOR)\ngray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)\nlines = lsd(gray)\nfor i in xrange(lines.shape[0]):\n pt1 = (int(lines[i, 0]), int(lines[i, 1]))\n pt2 = (int(lines[i, 2]), int(lines[i, 3]))\n width = lines[i, 4]\n cv2.line(src, pt1, pt2, (0, 0, 255), int(np.ceil(width / 2)))\ncv2.imwrite(os.path.join(folder, 'cv2_' + imgName.split('.')[0] + '.jpg'), src)\n```\n\n* by using PIL(Image) module\n\n```python\nfrom PIL import Image, ImageDraw\nimport numpy as np\nimport os\nfrom pylsd.lsd import lsd\nfullName = 'house.png'\nfolder, imgName = os.path.split(fullName)\nimg = Image.open(fullName)\ngray = np.asarray(img.convert('L'))\nlines = lsd(gray)\ndraw = ImageDraw.Draw(img)\nfor i in xrange(lines.shape[0]):\n pt1 = (int(lines[i, 0]), int(lines[i, 1]))\n pt2 = (int(lines[i, 2]), int(lines[i, 3]))\n width = lines[i, 4]\n draw.line((pt1, pt2), fill=(0, 0, 255), width=int(np.ceil(width / 2)))\nimg.save(os.path.join(folder, 'PIL_' + imgName.split('.')[0] + '.jpg'))\n```\n\nThe following is the result:\n\n* car.jpg by using cv2 module\n\n![](https://github.com/primetang/pylsd/blob/master/example/car.jpg)\n\n![](https://github.com/primetang/pylsd/blob/master/example/cv2_car.jpg)\n\n* house.png by using PIL(Image) module\n\n![](https://github.com/primetang/pylsd/blob/master/example/house.png)\n\n![](https://github.com/primetang/pylsd/blob/master/example/PIL_house.jpg)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kba/pylsd", "keywords": "LSD,line segmentation", "license": "BSD", "maintainer": "kba", "maintainer_email": "", "name": "ocrd-fork-pylsd", "package_url": "https://pypi.org/project/ocrd-fork-pylsd/", "platform": "", "project_url": "https://pypi.org/project/ocrd-fork-pylsd/", "project_urls": { "Homepage": "https://github.com/kba/pylsd" }, "release_url": "https://pypi.org/project/ocrd-fork-pylsd/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "pylsd is the python bindings for LSD - Line Segment Detector", "version": "0.0.3" }, "last_serial": 4672212, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "4355465dd85b7024c006d6ff174e4fe0", "sha256": "9a33d21c2cb524c3745607029b4bceba55ab6e72f6e720fd11546efd13c5efd7" }, "downloads": -1, "filename": "ocrd_fork_pylsd-0.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "4355465dd85b7024c006d6ff174e4fe0", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 47554, "upload_time": "2019-01-08T09:39:33", "url": "https://files.pythonhosted.org/packages/49/8a/721974593c3df85036591de8735f3767441d028edfbad17bbdb307dbd392/ocrd_fork_pylsd-0.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3a35bdbe290b7b21c29f86ab83c40f1d", "sha256": "758fc14dc1a76c174397ce9dae6db1f9b3dc530b361767a9714538dd01b9bf03" }, "downloads": -1, "filename": "ocrd_fork_pylsd-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3a35bdbe290b7b21c29f86ab83c40f1d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 47554, "upload_time": "2019-01-08T09:39:35", "url": "https://files.pythonhosted.org/packages/6a/df/12fba60b9b3e141f515d69edd539bd066294d6b3be79b12450888819986d/ocrd_fork_pylsd-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c537c32307528840ceeaa647908960c9", "sha256": "728c88f2c53372c3614d8f0ffcb610939fab867b08b72603a85b202e9818938f" }, "downloads": -1, "filename": "ocrd-fork-pylsd-0.0.3.tar.gz", "has_sig": false, "md5_digest": "c537c32307528840ceeaa647908960c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46759, "upload_time": "2019-01-08T09:39:37", "url": "https://files.pythonhosted.org/packages/b8/4f/d61c4d2f73cfd8c66c5bfca341ea5cf115fd596015452b875d347becb247/ocrd-fork-pylsd-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4355465dd85b7024c006d6ff174e4fe0", "sha256": "9a33d21c2cb524c3745607029b4bceba55ab6e72f6e720fd11546efd13c5efd7" }, "downloads": -1, "filename": "ocrd_fork_pylsd-0.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "4355465dd85b7024c006d6ff174e4fe0", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 47554, "upload_time": "2019-01-08T09:39:33", "url": "https://files.pythonhosted.org/packages/49/8a/721974593c3df85036591de8735f3767441d028edfbad17bbdb307dbd392/ocrd_fork_pylsd-0.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3a35bdbe290b7b21c29f86ab83c40f1d", "sha256": "758fc14dc1a76c174397ce9dae6db1f9b3dc530b361767a9714538dd01b9bf03" }, "downloads": -1, "filename": "ocrd_fork_pylsd-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3a35bdbe290b7b21c29f86ab83c40f1d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 47554, "upload_time": "2019-01-08T09:39:35", "url": "https://files.pythonhosted.org/packages/6a/df/12fba60b9b3e141f515d69edd539bd066294d6b3be79b12450888819986d/ocrd_fork_pylsd-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c537c32307528840ceeaa647908960c9", "sha256": "728c88f2c53372c3614d8f0ffcb610939fab867b08b72603a85b202e9818938f" }, "downloads": -1, "filename": "ocrd-fork-pylsd-0.0.3.tar.gz", "has_sig": false, "md5_digest": "c537c32307528840ceeaa647908960c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46759, "upload_time": "2019-01-08T09:39:37", "url": "https://files.pythonhosted.org/packages/b8/4f/d61c4d2f73cfd8c66c5bfca341ea5cf115fd596015452b875d347becb247/ocrd-fork-pylsd-0.0.3.tar.gz" } ] }