├── .gitignore ├── README.md └── lsd_1.6 ├── .gitignore ├── CMakeLists.txt ├── COPYING ├── README.txt ├── doc ├── annotated.html ├── doxygen.css ├── doxygen.png ├── files.html ├── form_0.png ├── form_1.png ├── form_10.png ├── form_2.png ├── form_3.png ├── form_4.png ├── form_5.png ├── form_6.png ├── form_7.png ├── form_8.png ├── form_9.png ├── formula.repository ├── functions.html ├── functions_vars.html ├── globals.html ├── globals_defs.html ├── globals_func.html ├── globals_type.html ├── graph_legend.dot ├── graph_legend.html ├── graph_legend.png ├── index.html ├── lsd_8c-source.html ├── lsd_8c.html ├── lsd_8c__incl.png ├── lsd_8c_a19_cgraph.png ├── lsd_8c_a20_cgraph.png ├── lsd_8c_a21_cgraph.png ├── lsd_8c_a22_cgraph.png ├── lsd_8c_a23_cgraph.png ├── lsd_8c_a24_cgraph.png ├── lsd_8c_a25_cgraph.png ├── lsd_8c_a26_cgraph.png ├── lsd_8c_a27_cgraph.png ├── lsd_8c_a28_cgraph.png ├── lsd_8c_a29_cgraph.png ├── lsd_8c_a30_cgraph.png ├── lsd_8c_a31_cgraph.png ├── lsd_8c_a32_cgraph.png ├── lsd_8c_a33_cgraph.png ├── lsd_8c_a34_cgraph.png ├── lsd_8c_a39_cgraph.png ├── lsd_8c_a40_cgraph.png ├── lsd_8c_a41_cgraph.png ├── lsd_8c_a42_cgraph.png ├── lsd_8c_a43_cgraph.png ├── lsd_8c_a44_cgraph.png ├── lsd_8c_a45_cgraph.png ├── lsd_8c_a46_cgraph.png ├── lsd_8c_a47_cgraph.png ├── lsd_8c_a48_cgraph.png ├── lsd_8c_a49_cgraph.png ├── lsd_8c_a50_cgraph.png ├── lsd_8c_a51_cgraph.png ├── lsd_8c_a52_cgraph.png ├── lsd_8c_a53_cgraph.png ├── lsd_8c_a54_cgraph.png ├── lsd_8c_a55_cgraph.png ├── lsd_8c_a56_cgraph.png ├── lsd_8c_a57_cgraph.png ├── lsd_8h-source.html ├── lsd_8h.html ├── lsd_8h__dep__incl.png ├── lsd_8h_a0_cgraph.png ├── lsd_8h_a1_cgraph.png ├── lsd_8h_a2_cgraph.png ├── lsd_8h_a3_cgraph.png ├── lsd_opencv.rst ├── structcoorlist.html ├── structcoorlist__coll__graph.png ├── structimage__char__s.html ├── structimage__double__s.html ├── structimage__int__s.html ├── structntuple__list__s.html ├── structpoint.html ├── structrect.html └── structrect__iter.html ├── doxygen.config ├── examples ├── CMakeLists.txt ├── lsd_call_example.cpp ├── lsd_cmd.cpp ├── lsd_filterAngle.cpp ├── lsd_lines.cpp ├── lsd_opencv_cmd.cpp ├── lsd_opencv_example.cpp └── lsd_wrap_cmd.cpp ├── images ├── board.jpg ├── building.jpg ├── chairs.pgm └── left01.jpg ├── include ├── lsd.hpp ├── lsd_opencv.hpp └── lsd_wrap.hpp ├── src ├── CMakeLists.txt ├── lsd.cpp ├── lsd_opencv.cpp └── lsd_wrap.cpp └── tests ├── CMakeLists.txt ├── accuracy_test.cpp ├── houghlines.cpp ├── perf_test.cpp └── visual_test.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | 15 | # Directories 16 | build/ 17 | lib/ 18 | bin/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | LSD OpenCV 2 | ========== 3 | 4 | Introduction 5 | ----- 6 | A port of Line Segment Detector(LSD) to use OpenCV structures, as part of the GSoC 2013 program. 7 | The original code and paper, developed by Rafael Grompone von Gioi , can be found at http://www.ipol.im/pub/art/2012/gjmr-lsd/ . 8 | 9 | 10 | Files 11 | ----- 12 | The source files are separated in the following directories: 13 | 14 | * src/ - main files that are build to different shared libs 15 | * examples/ - contains a variety of examples on how to use the code 16 | * tests/ - different ways to test the performance 17 | Extra 18 | 19 | * docs/ - documentation from the original code 20 | * images/ - contains images for easy use and tests 21 | 22 | 23 | Compile 24 | ----- 25 | On linux, navigate to the lsd_1.6 directory and execute 26 | 27 | mkdir build 28 | cd build/ 29 | cmake .. 30 | make 31 | 32 | 33 | Use 34 | ----- 35 | To use the OpenCV LSD, create and LSD object, calling detect with the input image and a vector of lines. 36 | 37 | 38 | Testing 39 | ----- 40 | To test the difference between the standard and the converted algorithm, run 41 | 42 | ./visual_test ./../images/any-image 43 | 44 | to test the algorithm in specific cases, use the 45 | 46 | ./accuracy_test 47 | 48 | It will run the code against a set of predefined cases. 49 | -------------------------------------------------------------------------------- /lsd_1.6/.gitignore: -------------------------------------------------------------------------------- 1 | /lsd_opencv.sublime-project 2 | /lsd_opencv.sublime-workspace 3 | -------------------------------------------------------------------------------- /lsd_1.6/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project(LSD) 4 | 5 | # Verbose make 6 | #SET(CMAKE_VERBOSE_MAKEFILE ON) 7 | 8 | SET(CMAKE_BUILD_TYPE DEBUG) 9 | 10 | # Library type (STATIC or SHARED) 11 | SET(LIBRARY_TYPE STATIC) 12 | 13 | # Set link and compile flags 14 | # -no-write-strings to remove deprecated conversion for the c-code. 15 | # -pg for profiling the code. REMOVE WHEN DELIVERING 16 | # -O3 -ffast-math optimization flag 17 | SET(CXX_COVERAGE_FLAGS "-Wno-write-strings -O3 -ffast-math -pg") 18 | SET(CXX_COVERAGE_LINK_FLAGS "") 19 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_COVERAGE_FLAGS}") 20 | SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_COVERAGE_LINK_FLAGS}") 21 | 22 | #set the default path for built executables to the "bin" directory 23 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 24 | #set the default path for built libraries to the "lib" directory 25 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 26 | 27 | subdirs(src) 28 | subdirs(examples) 29 | subdirs(tests) 30 | -------------------------------------------------------------------------------- /lsd_1.6/README.txt: -------------------------------------------------------------------------------- 1 | LSD - Line Segment Detector 2 | =========================== 3 | 4 | Version 1.6 - November 11, 2011 5 | by Rafael Grompone von Gioi 6 | 7 | 8 | Introduction 9 | ------------ 10 | 11 | LSD is an implementation of the Line Segment Detector on digital 12 | images described in the paper: 13 | 14 | "LSD: A Fast Line Segment Detector with a False Detection Control" 15 | by Rafael Grompone von Gioi, Jeremie Jakubowicz, Jean-Michel Morel, 16 | and Gregory Randall, IEEE Transactions on Pattern Analysis and 17 | Machine Intelligence, vol. 32, no. 4, pp. 722-732, April, 2010. 18 | 19 | and in more details in the CMLA Technical Report: 20 | 21 | "LSD: A Line Segment Detector, Technical Report", 22 | by Rafael Grompone von Gioi, Jeremie Jakubowicz, Jean-Michel Morel, 23 | Gregory Randall, CMLA, ENS Cachan, 2010. 24 | 25 | The version implemented here includes some further improvements as 26 | described in the IPOL article of which this file is part: 27 | 28 | "LSD: a Line Segment Detector" by Rafael Grompone von Gioi, 29 | Jeremie Jakubowicz, Jean-Michel Morel, and Gregory Randall, 30 | Image Processing On Line, 2012. DOI:10.5201/ipol.2012.gjmr-lsd 31 | http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd 32 | 33 | 34 | Files 35 | ----- 36 | 37 | README.txt - This file. 38 | COPYING - GNU AFFERO GENERAL PUBLIC LICENSE Version 3. 39 | Makefile - Compilation instructions for 'make'. 40 | lsd.c - LSD module ANSI C code, peer reviewed file. 41 | lsd.h - LSD module ANSI C header, peer reviewed file. 42 | lsd_cmd.c - command line interface for LSD, ANSI C code. 43 | lsd_call_example.c - Minimal example of calling LSD from a C language program. 44 | chairs.pgm - Test image in PGM format. 45 | chairs.lsd.txt - Expected result for 'chairs.pgm' image as an ASCII file. 46 | chairs.lsd.eps - Expected result for 'chairs.pgm' image as an EPS file. 47 | doc - Html code documentation. 48 | doxygen.config - doxygen configuration file for documentation generation. 49 | 50 | The files "lsd.c" and "lsd.h" were subject to peer review as part of 51 | the acceptance process of the IPOL article, and are the official 52 | version of LSD. 53 | 54 | 55 | Compiling 56 | --------- 57 | 58 | LSD is an ANSI C Language program and can be used as a module 59 | to be called from a C language program or as an independent 60 | command. 61 | 62 | In the distribution is included a Makefile file with instructions 63 | to build the command lines program 'lsd', as well as minimal 64 | example program on how to call LSD from C code. 65 | 66 | To build both programs, a C compiler (called with 'cc') must be 67 | installed on your system, as well as the program 'make'. 68 | LSD only uses the standard C library so it should compile 69 | in any ANSI C Language environment. In particular, it should 70 | compile in an Unix like system. 71 | 72 | The compiling instruction is just 73 | 74 | make 75 | 76 | from the directory where the source codes and the Makefile are located. 77 | 78 | To verify a correct compilation you can apply LSD to the test 79 | image 'chairs.pgm' and compare the result to the provided ones. 80 | 81 | An explicit example of how to compile a program using LSD as a module 82 | is provided. The compilation line for 'lsd_call_example.c' is just 83 | 84 | cc -o lsd_call_example lsd_call_example.c lsd.c -lm 85 | 86 | 87 | Running LSD Command 88 | ------------------- 89 | 90 | The simplest LSD command execution is just 91 | 92 | lsd 93 | 94 | or 95 | 96 | ./lsd 97 | 98 | if the command is not in the path. That should print LSD version 99 | and the command line interface, including the available options. 100 | The only input image format handled by LSD is PGM, in its two 101 | versions, ASCII and Binary. A useful execution would be: 102 | 103 | lsd chairs.pgm chairs.result.txt 104 | 105 | That should give the result as an ASCII file 'chairs.result.txt' where 106 | each line corresponds to a detected line segment. Each line is 107 | composed of seven numbers separated by spaces, that are 108 | x1, y1, x2, y2, width, p, -log_nfa. 109 | For example, the line: 110 | 111 | 159.232890 134.369601 160.325338 105.613616 2.735466 0.125000 17.212465 112 | 113 | means that a line segment starting at point (159.232890,134.369601), 114 | ending at point (160.325338 105.613616) and of width 2.735466 was 115 | detected. An angle precision p of 0.125 was used, which means a 116 | gradient angle tolerance of p*180 = 0.125*180 = 22.5 degree. The 117 | opposite of the logarithm in base 10 of the NFA value of the detection 118 | was -log_10(NFA)=17.212465, so the NFA value was 10^(-17.2124656), 119 | roughly 6e-18. The length unit is the pixel and the origin of 120 | coordinates is the center of the top-left pixel (0,0). 121 | 122 | For easier visualization of the result, the LSD command can also 123 | give the output in EPS or SVG file formats. For example, 124 | 125 | lsd -P chairs.result.eps chairs.pgm chairs.result.txt 126 | 127 | will, in addition to the ASCII output file, produce the EPS file 128 | 'chairs.result.eps'. 129 | 130 | To see the full options, execute LSD command without parameters, 131 | as in './lsd'. 132 | 133 | Optional arguments should always appear before the needed arguments 134 | input and output. For example, the following line is wrong: 135 | 136 | lsd chairs.pgm -s 0.5 chairs.result.txt -> WRONG!! 137 | 138 | and should be 139 | 140 | lsd -s 0.5 chairs.pgm chairs.result.txt 141 | 142 | If the name of an input file is just - (one dash), then that 143 | file will be read from the standard input. Analogously, if the 144 | name of an output file is just - (one dash), then that file 145 | will be written to the standard output. For example, 146 | 147 | lsd - - 148 | 149 | will work as a filter, taking the input from standard input and 150 | giving the output to standard output. 151 | 152 | 153 | Code Documentation 154 | ------------------ 155 | 156 | There is a HTML documentation of the code on the directory 'doc'. The 157 | entry point is the file 'doc/index.html' that should be opened with a 158 | web browser. The documentation was automatically generated from the 159 | source code files using the Doxygen documentation system, see 160 | http://www.stack.nl/~dimitri/doxygen/. 161 | 162 | 163 | Copyright and License 164 | --------------------- 165 | 166 | Copyright (c) 2007-2011 rafael grompone von gioi 167 | 168 | LSD is free software: you can redistribute it and/or modify 169 | it under the terms of the GNU Affero General Public License as 170 | published by the Free Software Foundation, either version 3 of the 171 | License, or (at your option) any later version. 172 | 173 | LSD is distributed in the hope that it will be useful, 174 | but WITHOUT ANY WARRANTY; without even the implied warranty of 175 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 176 | GNU Affero General Public License for more details. 177 | 178 | You should have received a copy of the GNU Affero General Public License 179 | along with this program. If not, see . 180 | 181 | 182 | Thanks 183 | ------ 184 | 185 | I would be grateful to receive any comment, especially about errors, 186 | bugs, or strange results. 187 | -------------------------------------------------------------------------------- /lsd_1.6/doc/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: Annotated Index 4 | 5 | 6 | 7 | 8 |

LSD Data Structures

Here are the data structures with brief descriptions: 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
coorlistChained list of coordinates
image_char_sChar image data type
image_double_sDouble image data type
image_int_sInt image data type
ntuple_list_s'list of n-tuple' data type
pointA point (or pixel)
rectRectangle structure: line segment with width
rect_iterRectangle points iterator
18 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 19 | 20 | doxygen 21 | 1.3.4
22 | 23 | 24 | -------------------------------------------------------------------------------- /lsd_1.6/doc/doxygen.css: -------------------------------------------------------------------------------- 1 | H1 { 2 | text-align: center; 3 | font-family: Arial, Helvetica, sans-serif; 4 | } 5 | H2 { 6 | font-family: Geneva, Arial, Helvetica, sans-serif; 7 | } 8 | CAPTION { font-weight: bold } 9 | DIV.qindex { width: 100%; 10 | background-color: #eeeeff; 11 | border: 4px solid #eeeeff; 12 | text-align: center; 13 | margin-bottom: 2px 14 | } 15 | A.qindex { text-decoration: none; font-weight: bold; color: #0000ee } 16 | A.qindex:visited { text-decoration: none; font-weight: bold; color: #0000ee } 17 | A.qindex:hover { text-decoration: none; background-color: #ddddff } 18 | A.qindexHL { text-decoration: none; font-weight: bold; 19 | background-color: #6666cc; 20 | color: #ffffff 21 | } 22 | A.qindexHL:hover { text-decoration: none; background-color: #6666cc; color: #ffffff } 23 | A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } 24 | A.el { text-decoration: none; font-weight: bold } 25 | A.elRef { font-weight: bold } 26 | A.code { text-decoration: none; font-weight: normal; color: #4444ee } 27 | A.codeRef { font-weight: normal; color: #4444ee } 28 | A:hover { text-decoration: none; background-color: #f2f2ff } 29 | DL.el { margin-left: -1cm } 30 | DIV.fragment { 31 | width: 98%; 32 | border: 1px solid #CCCCCC; 33 | background-color: #f5f5f5; 34 | padding-left: 4px; 35 | margin: 4px; 36 | } 37 | DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } 38 | TD.md { background-color: #f2f2ff; font-weight: bold; } 39 | TD.mdname1 { background-color: #f2f2ff; font-weight: bold; color: #602020; } 40 | TD.mdname { background-color: #f2f2ff; font-weight: bold; color: #602020; width: 600px; } 41 | DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold } 42 | DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } 43 | BODY { 44 | background: white; 45 | color: black; 46 | margin-right: 20px; 47 | margin-left: 20px; 48 | } 49 | TD.indexkey { 50 | background-color: #eeeeff; 51 | font-weight: bold; 52 | padding-right : 10px; 53 | padding-top : 2px; 54 | padding-left : 10px; 55 | padding-bottom : 2px; 56 | margin-left : 0px; 57 | margin-right : 0px; 58 | margin-top : 2px; 59 | margin-bottom : 2px 60 | } 61 | TD.indexvalue { 62 | background-color: #eeeeff; 63 | font-style: italic; 64 | padding-right : 10px; 65 | padding-top : 2px; 66 | padding-left : 10px; 67 | padding-bottom : 2px; 68 | margin-left : 0px; 69 | margin-right : 0px; 70 | margin-top : 2px; 71 | margin-bottom : 2px 72 | } 73 | TR.memlist { 74 | background-color: #f0f0f0; 75 | } 76 | P.formulaDsp { text-align: center; } 77 | IMG.formulaDsp { } 78 | IMG.formulaInl { vertical-align: middle; } 79 | SPAN.keyword { color: #008000 } 80 | SPAN.keywordtype { color: #604020 } 81 | SPAN.keywordflow { color: #e08000 } 82 | SPAN.comment { color: #800000 } 83 | SPAN.preprocessor { color: #806020 } 84 | SPAN.stringliteral { color: #002080 } 85 | SPAN.charliteral { color: #008080 } 86 | .mdTable { 87 | border: 1px solid #868686; 88 | background-color: #f2f2ff; 89 | } 90 | .mdRow { 91 | padding: 8px 20px; 92 | } 93 | .mdescLeft { 94 | font-size: smaller; 95 | font-family: Arial, Helvetica, sans-serif; 96 | background-color: #FAFAFA; 97 | padding-left: 8px; 98 | border-top: 1px none #E0E0E0; 99 | border-right: 1px none #E0E0E0; 100 | border-bottom: 1px none #E0E0E0; 101 | border-left: 1px none #E0E0E0; 102 | margin: 0px; 103 | } 104 | .mdescRight { 105 | font-size: smaller; 106 | font-family: Arial, Helvetica, sans-serif; 107 | font-style: italic; 108 | background-color: #FAFAFA; 109 | padding-left: 4px; 110 | border-top: 1px none #E0E0E0; 111 | border-right: 1px none #E0E0E0; 112 | border-bottom: 1px none #E0E0E0; 113 | border-left: 1px none #E0E0E0; 114 | margin: 0px; 115 | padding-bottom: 0px; 116 | padding-right: 8px; 117 | } 118 | .memItemLeft { 119 | padding: 1px 0px 0px 8px; 120 | margin: 4px; 121 | border-top-width: 1px; 122 | border-right-width: 1px; 123 | border-bottom-width: 1px; 124 | border-left-width: 1px; 125 | border-top-style: solid; 126 | border-top-color: #E0E0E0; 127 | border-right-color: #E0E0E0; 128 | border-bottom-color: #E0E0E0; 129 | border-left-color: #E0E0E0; 130 | border-right-style: none; 131 | border-bottom-style: none; 132 | border-left-style: none; 133 | background-color: #FAFAFA; 134 | font-family: Geneva, Arial, Helvetica, sans-serif; 135 | font-size: 12px; 136 | } 137 | .memItemRight { 138 | padding: 1px 0px 0px 8px; 139 | margin: 4px; 140 | border-top-width: 1px; 141 | border-right-width: 1px; 142 | border-bottom-width: 1px; 143 | border-left-width: 1px; 144 | border-top-style: solid; 145 | border-top-color: #E0E0E0; 146 | border-right-color: #E0E0E0; 147 | border-bottom-color: #E0E0E0; 148 | border-left-color: #E0E0E0; 149 | border-right-style: none; 150 | border-bottom-style: none; 151 | border-left-style: none; 152 | background-color: #FAFAFA; 153 | font-family: Geneva, Arial, Helvetica, sans-serif; 154 | font-size: 13px; 155 | } 156 | .search { color: #0000ee; 157 | font-weight: bold; 158 | } 159 | FORM.search { 160 | margin-bottom: 0px; 161 | margin-top: 0px; 162 | } 163 | INPUT.search { font-size: 75%; 164 | color: #000080; 165 | font-weight: normal; 166 | background-color: #eeeeff; 167 | } 168 | TD.tiny { font-size: 75%; 169 | } 170 | -------------------------------------------------------------------------------- /lsd_1.6/doc/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/doxygen.png -------------------------------------------------------------------------------- /lsd_1.6/doc/files.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: File Index 4 | 5 | 6 | 7 | 8 |

LSD File List

Here is a list of all files with brief descriptions: 9 | 10 | 11 |
lsd.c [code]LSD module code
lsd.h [code]LSD module header
12 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 13 | 14 | doxygen 15 | 1.3.4
16 | 17 | 18 | -------------------------------------------------------------------------------- /lsd_1.6/doc/form_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_0.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_1.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_10.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_2.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_3.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_4.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_5.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_6.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_7.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_8.png -------------------------------------------------------------------------------- /lsd_1.6/doc/form_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/form_9.png -------------------------------------------------------------------------------- /lsd_1.6/doc/formula.repository: -------------------------------------------------------------------------------- 1 | \form#0:\[ G(x,y) = \frac{1}{2\pi\sigma^2} e^{-\frac{x^2+y^2}{2\sigma^2}} \] 2 | \form#1:\[ G(x,y) = G(x) * G(y) \] 3 | \form#2:\[ G(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{x^2}{2\sigma^2}}. \] 4 | \form#3:\[ \Gamma(x) = \frac{ \sum_{n=0}^{N} q_n x^n }{ \Pi_{n=0}^{N} (x+n) } (x+5.5)^{x+0.5} e^{-(x+5.5)} \] 5 | \form#4:\[ \log\Gamma(x) = \log\left( \sum_{n=0}^{N} q_n x^n \right) + (x+0.5) \log(x+5.5) - (x+5.5) - \sum_{n=0}^{N} \log(x+n) \] 6 | \form#5:\[ \Gamma(x) = \sqrt{\frac{2\pi}{x}} \left( \frac{x}{e} \sqrt{ x\sinh(1/x) + \frac{1}{810x^6} } \right)^x \] 7 | \form#6:\[ \log\Gamma(x) = 0.5\log(2\pi) + (x-0.5)\log(x) - x + 0.5x\log\left( x\sinh(1/x) + \frac{1}{810x^6} \right). \] 8 | \form#7:\[ \mathrm{NFA} = NT \cdot B(n,k,p) \] 9 | \form#8:\[ B(n,k,p) = \sum_{j=k}^n \left(\begin{array}{c}n\\j\end{array}\right) p^{j} (1-p)^{n-j} \] 10 | \form#9:\[ \left(\begin{array}{c}n\\k\end{array}\right) = \frac{ \Gamma(n+1) }{ \Gamma(k+1) \cdot \Gamma(n-k+1) }. \] 11 | \form#10:\[ A = \left(\begin{array}{cc} Ixx & Ixy \\ Ixy & Iyy \\ \end{array}\right) \] 12 | -------------------------------------------------------------------------------- /lsd_1.6/doc/functions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: Compound Member Index 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 | Here is a list of all struct and union fields with links to the structures/unions they belong to:

37 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 38 | 39 | doxygen 40 | 1.3.4
41 | 42 | 43 | -------------------------------------------------------------------------------- /lsd_1.6/doc/functions_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: Compound Member Index 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 |

37 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 38 | 39 | doxygen 40 | 1.3.4
41 | 42 | 43 | -------------------------------------------------------------------------------- /lsd_1.6/doc/globals.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: File Member Index 4 | 5 | 6 | 7 | 8 | 9 |
a | d | e | f | g | i | l | m | n | r | t | u
10 | 11 |

12 | 13 |

14 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- a -

    15 |
  • add_7tuple() 16 | : lsd.c
  • angle_diff() 17 | : lsd.c
  • angle_diff_signed() 18 | : lsd.c
19 |

- d -

    20 |
  • dist() 21 | : lsd.c
  • double_equal() 22 | : lsd.c
23 |

- e -

    24 |
  • enlarge_ntuple_list() 25 | : lsd.c
  • error() 26 | : lsd.c
27 |

- f -

    28 |
  • FALSE 29 | : lsd.c
  • free_image_char() 30 | : lsd.c
  • free_image_double() 31 | : lsd.c
  • free_ntuple_list() 32 | : lsd.c
33 |

- g -

    34 |
  • gaussian_kernel() 35 | : lsd.c
  • gaussian_sampler() 36 | : lsd.c
  • get_theta() 37 | : lsd.c
38 |

- i -

46 |

- l -

56 |

- m -

62 |

- n -

    63 |
  • new_image_char() 64 | : lsd.c
  • new_image_char_ini() 65 | : lsd.c
  • new_image_double() 66 | : lsd.c
  • new_image_double_ptr() 67 | : lsd.c
  • new_image_int() 68 | : lsd.c
  • new_image_int_ini() 69 | : lsd.c
  • new_ntuple_list() 70 | : lsd.c
  • nfa() 71 | : lsd.c
  • NOTDEF 72 | : lsd.c
  • NOTUSED 73 | : lsd.c
  • ntuple_list 74 | : lsd.c
75 |

- r -

    76 |
  • rect_copy() 77 | : lsd.c
  • rect_improve() 78 | : lsd.c
  • rect_nfa() 79 | : lsd.c
  • reduce_region_radius() 80 | : lsd.c
  • refine() 81 | : lsd.c
  • region2rect() 82 | : lsd.c
  • region_grow() 83 | : lsd.c
  • RELATIVE_ERROR_FACTOR 84 | : lsd.c
  • ri_del() 85 | : lsd.c
  • ri_end() 86 | : lsd.c
  • ri_inc() 87 | : lsd.c
  • ri_ini() 88 | : lsd.c
89 |

- t -

93 |

- u -

96 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 97 | 98 | doxygen 99 | 1.3.4
100 | 101 | 102 | -------------------------------------------------------------------------------- /lsd_1.6/doc/globals_defs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: File Member Index 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 |

25 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 26 | 27 | doxygen 28 | 1.3.4
29 | 30 | 31 | -------------------------------------------------------------------------------- /lsd_1.6/doc/globals_func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: File Member Index 4 | 5 | 6 | 7 | 8 | 9 |
a | d | e | f | g | i | l | n | r
10 | 11 |

12 | 13 |

14 |

- a -

    15 |
  • add_7tuple() 16 | : lsd.c
  • angle_diff() 17 | : lsd.c
  • angle_diff_signed() 18 | : lsd.c
19 |

- d -

    20 |
  • dist() 21 | : lsd.c
  • double_equal() 22 | : lsd.c
23 |

- e -

    24 |
  • enlarge_ntuple_list() 25 | : lsd.c
  • error() 26 | : lsd.c
27 |

- f -

    28 |
  • free_image_char() 29 | : lsd.c
  • free_image_double() 30 | : lsd.c
  • free_ntuple_list() 31 | : lsd.c
32 |

- g -

    33 |
  • gaussian_kernel() 34 | : lsd.c
  • gaussian_sampler() 35 | : lsd.c
  • get_theta() 36 | : lsd.c
37 |

- i -

    38 |
  • inter_hi() 39 | : lsd.c
  • inter_low() 40 | : lsd.c
  • isaligned() 41 | : lsd.c
42 |

- l -

51 |

- n -

    52 |
  • new_image_char() 53 | : lsd.c
  • new_image_char_ini() 54 | : lsd.c
  • new_image_double() 55 | : lsd.c
  • new_image_double_ptr() 56 | : lsd.c
  • new_image_int() 57 | : lsd.c
  • new_image_int_ini() 58 | : lsd.c
  • new_ntuple_list() 59 | : lsd.c
  • nfa() 60 | : lsd.c
61 |

- r -

74 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 75 | 76 | doxygen 77 | 1.3.4
78 | 79 | 80 | -------------------------------------------------------------------------------- /lsd_1.6/doc/globals_type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: File Member Index 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 |

    12 |
  • image_char 13 | : lsd.c
  • image_double 14 | : lsd.c
  • image_int 15 | : lsd.c
  • ntuple_list 16 | : lsd.c
17 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 18 | 19 | doxygen 20 | 1.3.4
21 | 22 | 23 | -------------------------------------------------------------------------------- /lsd_1.6/doc/graph_legend.dot: -------------------------------------------------------------------------------- 1 | digraph G 2 | { 3 | edge [fontname="Helvetica",fontsize=10,labelfontname="Helvetica",labelfontsize=10]; 4 | node [fontname="Helvetica",fontsize=10,shape=record]; 5 | Node9 [shape="box",label="Inherited",fontsize=10,height=0.2,width=0.4,fontname="Helvetica",color="black",style="filled" fontcolor="white"]; 6 | Node10 -> Node9 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="Helvetica"]; 7 | Node10 [shape="box",label="PublicBase",fontsize=10,height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPublicBase.html"]; 8 | Node11 -> Node10 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="Helvetica"]; 9 | Node11 [shape="box",label="Truncated",fontsize=10,height=0.2,width=0.4,fontname="Helvetica",color="red",URL="$classTruncated.html"]; 10 | Node13 -> Node9 [dir=back,color="darkgreen",fontsize=10,style="solid",fontname="Helvetica"]; 11 | Node13 [shape="box",label="ProtectedBase",fontsize=10,height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classProtectedBase.html"]; 12 | Node14 -> Node9 [dir=back,color="firebrick4",fontsize=10,style="solid",fontname="Helvetica"]; 13 | Node14 [shape="box",label="PrivateBase",fontsize=10,height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPrivateBase.html"]; 14 | Node15 -> Node9 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="Helvetica"]; 15 | Node15 [shape="box",label="Undocumented",fontsize=10,height=0.2,width=0.4,fontname="Helvetica",color="grey75"]; 16 | Node16 -> Node9 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="Helvetica"]; 17 | Node16 [shape="box",label="Templ< int >",fontsize=10,height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"]; 18 | Node17 -> Node16 [dir=back,color="orange",fontsize=10,style="dashed",label="< int >",fontname="Helvetica"]; 19 | Node17 [shape="box",label="Templ< T >",fontsize=10,height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"]; 20 | Node18 -> Node9 [dir=back,color="darkorchid3",fontsize=10,style="dashed",label="m_usedClass",fontname="Helvetica"]; 21 | Node18 [shape="box",label="Used",fontsize=10,height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classUsed.html"]; 22 | } 23 | -------------------------------------------------------------------------------- /lsd_1.6/doc/graph_legend.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: Graph Legend 4 | 5 | 6 | 7 | 8 |

Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

9 | Consider the following example:

/*! Invisible class because of truncation */
10 | class Invisible { };
11 | 
12 | /*! Truncated class, inheritance relation is hidden */
13 | class Truncated : public Invisible { };
14 | 
15 | /* Class not documented with doxygen comments */
16 | class Undocumented { };
17 | 
18 | /*! Class that is inherited using public inheritance */
19 | class PublicBase : public Truncated { };
20 | 
21 | /*! A template class */
22 | template<class T> class Templ { };
23 | 
24 | /*! Class that is inherited using protected inheritance */
25 | class ProtectedBase { };
26 | 
27 | /*! Class that is inherited using private inheritance */
28 | class PrivateBase { };
29 | 
30 | /*! Class that is used by the Inherited class */
31 | class Used { };
32 | 
33 | /*! Super class that inherits a number of other classes */
34 | class Inherited : public PublicBase,
35 |                   protected ProtectedBase,
36 |                   private PrivateBase,
37 |                   public Undocumented
38 |                   public Templ<int>
39 | {
40 |   private:
41 |     Used *m_usedClass;
42 | };
43 | 
If the MAX_DOT_GRAPH_HEIGHT tag in the configuration file is set to 240 this will result in the following graph:

44 |

45 | graph_legend.png 46 |
47 |

48 | The boxes in the above graph have the following meaning:

    49 |
  • 50 | A filled black box represents the struct or class for which the graph is generated.
  • 51 |
  • 52 | A box with a black border denotes a documented struct or class.
  • 53 |
  • 54 | A box with a grey border denotes an undocumented struct or class.
  • 55 |
  • 56 | A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
  • 57 |
58 | The arrows have the following meaning:
    59 |
  • 60 | A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • 61 |
  • 62 | A dark green arrow is used for protected inheritance.
  • 63 |
  • 64 | A dark red arrow is used for private inheritance.
  • 65 |
  • 66 | A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • 67 |
  • 68 | A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
  • 69 |
70 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 71 | 72 | doxygen 73 | 1.3.4
74 | 75 | 76 | -------------------------------------------------------------------------------- /lsd_1.6/doc/graph_legend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/graph_legend.png -------------------------------------------------------------------------------- /lsd_1.6/doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: LSD code documentation 4 | 5 | 6 | 7 | 8 |

LSD code documentation

9 |

10 | This is an implementation of the Line Segment Detector described in the paper:

11 | "LSD: A Fast Line Segment Detector with a False Detection Control" by Rafael Grompone von Gioi, Jeremie Jakubowicz, Jean-Michel Morel, and Gregory Randall, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 32, no. 4, pp. 722-732, April, 2010.

12 | and in more details in the CMLA Technical Report:

13 | "LSD: A Line Segment Detector, Technical Report", by Rafael Grompone von Gioi, Jeremie Jakubowicz, Jean-Michel Morel, Gregory Randall, CMLA, ENS Cachan, 2010.

14 | The version implemented here includes some further improvements described in the following publication, of which this code is part:

15 | "LSD: a Line Segment Detector" by Rafael Grompone von Gioi, Jeremie Jakubowicz, Jean-Michel Morel, and Gregory Randall, Image Processing On Line, 2012. DOI:10.5201/ipol.2012.gjmr-lsd http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd

16 | The module's main function is lsd().

17 | The source code is contained in two files: lsd.h and lsd.c.

18 | HISTORY:

    19 |
  • version 1.6 - nov 2011:
      20 |
    • changes in the interface,
    • max_grad parameter removed,
    • the factor 11 was added to the number of test to consider the different precision values tested,
    • a minor bug corrected in the gradient sorting code,
    • the algorithm now also returns p and log_nfa for each detection,
    • a minor bug was corrected in the image scaling,
    • the angle comparison in "isaligned" changed from < to <=,
    • "eps" variable renamed "log_eps",
    • "lsd_scale_region" interface was added,
    • minor changes to comments.
    21 |
  • version 1.5 - dec 2010: Changes in 'refine', -W option added, and more comments added.
  • version 1.4 - jul 2010: lsd_scale interface added and doxygen doc.
  • version 1.3 - feb 2010: Multiple bug correction and improved code.
  • version 1.2 - dec 2009: First full Ansi C Language version.
  • version 1.1 - sep 2009: Systematic subsampling to scale 0.8 and correction to partially handle "angle problem".
  • version 1.0 - jan 2009: First complete Megawave2 and Ansi C Language version.
22 |

23 |

Author:
rafael grompone von gioi <grompone@gmail.com>
24 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 25 | 26 | doxygen 27 | 1.3.4
28 | 29 | 30 | -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c__incl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c__incl.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a19_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a19_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a20_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a20_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a21_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a21_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a22_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a22_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a23_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a23_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a24_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a24_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a25_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a25_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a26_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a26_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a27_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a27_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a28_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a28_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a29_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a29_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a30_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a30_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a31_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a31_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a32_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a32_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a33_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a33_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a34_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a34_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a39_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a39_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a40_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a40_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a41_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a41_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a42_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a42_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a43_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a43_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a44_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a44_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a45_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a45_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a46_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a46_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a47_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a47_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a48_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a48_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a49_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a49_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a50_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a50_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a51_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a51_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a52_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a52_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a53_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a53_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a54_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a54_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a55_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a55_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a56_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a56_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8c_a57_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8c_a57_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: lsd.h Source File 4 | 5 | 6 | 7 | 8 |

lsd.h

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------------
  9 | 00002 
 10 | 00003   LSD - Line Segment Detector on digital images
 11 | 00004 
 12 | 00005   This code is part of the following publication and was subject
 13 | 00006   to peer review:
 14 | 00007 
 15 | 00008     "LSD: a Line Segment Detector" by Rafael Grompone von Gioi,
 16 | 00009     Jeremie Jakubowicz, Jean-Michel Morel, and Gregory Randall,
 17 | 00010     Image Processing On Line, 2012. DOI:10.5201/ipol.2012.gjmr-lsd
 18 | 00011     http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd
 19 | 00012 
 20 | 00013   Copyright (c) 2007-2011 rafael grompone von gioi <grompone@gmail.com>
 21 | 00014 
 22 | 00015   This program is free software: you can redistribute it and/or modify
 23 | 00016   it under the terms of the GNU Affero General Public License as
 24 | 00017   published by the Free Software Foundation, either version 3 of the
 25 | 00018   License, or (at your option) any later version.
 26 | 00019 
 27 | 00020   This program is distributed in the hope that it will be useful,
 28 | 00021   but WITHOUT ANY WARRANTY; without even the implied warranty of
 29 | 00022   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 30 | 00023   GNU Affero General Public License for more details.
 31 | 00024 
 32 | 00025   You should have received a copy of the GNU Affero General Public License
 33 | 00026   along with this program. If not, see <http://www.gnu.org/licenses/>.
 34 | 00027 
 35 | 00028   ----------------------------------------------------------------------------*/
 36 | 00029 
 37 | 00030 /*----------------------------------------------------------------------------*/
 38 | 00031 /** @file lsd.h
 39 | 00032     LSD module header
 40 | 00033     @author rafael grompone von gioi <grompone@gmail.com>
 41 | 00034  */
 42 | 00035 /*----------------------------------------------------------------------------*/
 43 | 00036 #ifndef LSD_HEADER
 44 | 00037 #define LSD_HEADER
 45 | 00038 
 46 | 00039 /*----------------------------------------------------------------------------*/
 47 | 00040 /** LSD Full Interface
 48 | 00041 
 49 | 00042     @param n_out       Pointer to an int where LSD will store the number of
 50 | 00043                        line segments detected.
 51 | 00044 
 52 | 00045     @param img         Pointer to input image data. It must be an array of
 53 | 00046                        doubles of size X x Y, and the pixel at coordinates
 54 | 00047                        (x,y) is obtained by img[x+y*X].
 55 | 00048 
 56 | 00049     @param X           X size of the image: the number of columns.
 57 | 00050 
 58 | 00051     @param Y           Y size of the image: the number of rows.
 59 | 00052 
 60 | 00053     @param scale       When different from 1.0, LSD will scale the input image
 61 | 00054                        by 'scale' factor by Gaussian filtering, before detecting
 62 | 00055                        line segments.
 63 | 00056                        Example: if scale=0.8, the input image will be subsampled
 64 | 00057                        to 80% of its size, before the line segment detector
 65 | 00058                        is applied.
 66 | 00059                        Suggested value: 0.8
 67 | 00060 
 68 | 00061     @param sigma_scale When scale!=1.0, the sigma of the Gaussian filter is:
 69 | 00062                        sigma = sigma_scale / scale,   if scale <  1.0
 70 | 00063                        sigma = sigma_scale,           if scale >= 1.0
 71 | 00064                        Suggested value: 0.6
 72 | 00065 
 73 | 00066     @param quant       Bound to the quantization error on the gradient norm.
 74 | 00067                        Example: if gray levels are quantized to integer steps,
 75 | 00068                        the gradient (computed by finite differences) error
 76 | 00069                        due to quantization will be bounded by 2.0, as the
 77 | 00070                        worst case is when the error are 1 and -1, that
 78 | 00071                        gives an error of 2.0.
 79 | 00072                        Suggested value: 2.0
 80 | 00073 
 81 | 00074     @param ang_th      Gradient angle tolerance in the region growing
 82 | 00075                        algorithm, in degrees.
 83 | 00076                        Suggested value: 22.5
 84 | 00077 
 85 | 00078     @param log_eps     Detection threshold, accept if -log10(NFA) > log_eps.
 86 | 00079                        The larger the value, the more strict the detector is,
 87 | 00080                        and will result in less detections.
 88 | 00081                        (Note that the 'minus sign' makes that this
 89 | 00082                        behavior is opposite to the one of NFA.)
 90 | 00083                        The value -log10(NFA) is equivalent but more
 91 | 00084                        intuitive than NFA:
 92 | 00085                        - -1.0 gives an average of 10 false detections on noise
 93 | 00086                        -  0.0 gives an average of 1 false detections on noise
 94 | 00087                        -  1.0 gives an average of 0.1 false detections on nose
 95 | 00088                        -  2.0 gives an average of 0.01 false detections on noise
 96 | 00089                        .
 97 | 00090                        Suggested value: 0.0
 98 | 00091 
 99 | 00092     @param density_th  Minimal proportion of 'supporting' points in a rectangle.
100 | 00093                        Suggested value: 0.7
101 | 00094 
102 | 00095     @param n_bins      Number of bins used in the pseudo-ordering of gradient
103 | 00096                        modulus.
104 | 00097                        Suggested value: 1024
105 | 00098 
106 | 00099     @param reg_img     Optional output: if desired, LSD will return an
107 | 00100                        int image where each pixel indicates the line segment
108 | 00101                        to which it belongs. Unused pixels have the value '0',
109 | 00102                        while the used ones have the number of the line segment,
110 | 00103                        numbered 1,2,3,..., in the same order as in the
111 | 00104                        output list. If desired, a non NULL int** pointer must
112 | 00105                        be assigned, and LSD will make that the pointer point
113 | 00106                        to an int array of size reg_x x reg_y, where the pixel
114 | 00107                        value at (x,y) is obtained with (*reg_img)[x+y*reg_x].
115 | 00108                        Note that the resulting image has the size of the image
116 | 00109                        used for the processing, that is, the size of the input
117 | 00110                        image scaled by the given factor 'scale'. If scale!=1
118 | 00111                        this size differs from XxY and that is the reason why
119 | 00112                        its value is given by reg_x and reg_y.
120 | 00113                        Suggested value: NULL
121 | 00114 
122 | 00115     @param reg_x       Pointer to an int where LSD will put the X size
123 | 00116                        'reg_img' image, when asked for.
124 | 00117                        Suggested value: NULL
125 | 00118 
126 | 00119     @param reg_y       Pointer to an int where LSD will put the Y size
127 | 00120                        'reg_img' image, when asked for.
128 | 00121                        Suggested value: NULL
129 | 00122 
130 | 00123     @return            A double array of size 7 x n_out, containing the list
131 | 00124                        of line segments detected. The array contains first
132 | 00125                        7 values of line segment number 1, then the 7 values
133 | 00126                        of line segment number 2, and so on, and it finish
134 | 00127                        by the 7 values of line segment number n_out.
135 | 00128                        The seven values are:
136 | 00129                        - x1,y1,x2,y2,width,p,-log10(NFA)
137 | 00130                        .
138 | 00131                        for a line segment from coordinates (x1,y1) to (x2,y2),
139 | 00132                        a width 'width', an angle precision of p in (0,1) given
140 | 00133                        by angle_tolerance/180 degree, and NFA value 'NFA'.
141 | 00134                        If 'out' is the returned pointer, the 7 values of
142 | 00135                        line segment number 'n+1' are obtained with
143 | 00136                        'out[7*n+0]' to 'out[7*n+6]'.
144 | 00137  */
145 | 00138 double * LineSegmentDetection( int * n_out,
146 | 00139                                double * img, int X, int Y,
147 | 00140                                double scale, double sigma_scale, double quant,
148 | 00141                                double ang_th, double log_eps, double density_th,
149 | 00142                                int n_bins,
150 | 00143                                int ** reg_img, int * reg_x, int * reg_y );
151 | 00144 
152 | 00145 /*----------------------------------------------------------------------------*/
153 | 00146 /** LSD Simple Interface with Scale and Region output.
154 | 00147 
155 | 00148     @param n_out       Pointer to an int where LSD will store the number of
156 | 00149                        line segments detected.
157 | 00150 
158 | 00151     @param img         Pointer to input image data. It must be an array of
159 | 00152                        doubles of size X x Y, and the pixel at coordinates
160 | 00153                        (x,y) is obtained by img[x+y*X].
161 | 00154 
162 | 00155     @param X           X size of the image: the number of columns.
163 | 00156 
164 | 00157     @param Y           Y size of the image: the number of rows.
165 | 00158 
166 | 00159     @param scale       When different from 1.0, LSD will scale the input image
167 | 00160                        by 'scale' factor by Gaussian filtering, before detecting
168 | 00161                        line segments.
169 | 00162                        Example: if scale=0.8, the input image will be subsampled
170 | 00163                        to 80% of its size, before the line segment detector
171 | 00164                        is applied.
172 | 00165                        Suggested value: 0.8
173 | 00166 
174 | 00167     @param reg_img     Optional output: if desired, LSD will return an
175 | 00168                        int image where each pixel indicates the line segment
176 | 00169                        to which it belongs. Unused pixels have the value '0',
177 | 00170                        while the used ones have the number of the line segment,
178 | 00171                        numbered 1,2,3,..., in the same order as in the
179 | 00172                        output list. If desired, a non NULL int** pointer must
180 | 00173                        be assigned, and LSD will make that the pointer point
181 | 00174                        to an int array of size reg_x x reg_y, where the pixel
182 | 00175                        value at (x,y) is obtained with (*reg_img)[x+y*reg_x].
183 | 00176                        Note that the resulting image has the size of the image
184 | 00177                        used for the processing, that is, the size of the input
185 | 00178                        image scaled by the given factor 'scale'. If scale!=1
186 | 00179                        this size differs from XxY and that is the reason why
187 | 00180                        its value is given by reg_x and reg_y.
188 | 00181                        Suggested value: NULL
189 | 00182 
190 | 00183     @param reg_x       Pointer to an int where LSD will put the X size
191 | 00184                        'reg_img' image, when asked for.
192 | 00185                        Suggested value: NULL
193 | 00186 
194 | 00187     @param reg_y       Pointer to an int where LSD will put the Y size
195 | 00188                        'reg_img' image, when asked for.
196 | 00189                        Suggested value: NULL
197 | 00190 
198 | 00191     @return            A double array of size 7 x n_out, containing the list
199 | 00192                        of line segments detected. The array contains first
200 | 00193                        7 values of line segment number 1, then the 7 values
201 | 00194                        of line segment number 2, and so on, and it finish
202 | 00195                        by the 7 values of line segment number n_out.
203 | 00196                        The seven values are:
204 | 00197                        - x1,y1,x2,y2,width,p,-log10(NFA)
205 | 00198                        .
206 | 00199                        for a line segment from coordinates (x1,y1) to (x2,y2),
207 | 00200                        a width 'width', an angle precision of p in (0,1) given
208 | 00201                        by angle_tolerance/180 degree, and NFA value 'NFA'.
209 | 00202                        If 'out' is the returned pointer, the 7 values of
210 | 00203                        line segment number 'n+1' are obtained with
211 | 00204                        'out[7*n+0]' to 'out[7*n+6]'.
212 | 00205  */
213 | 00206 double * lsd_scale_region( int * n_out,
214 | 00207                            double * img, int X, int Y, double scale,
215 | 00208                            int ** reg_img, int * reg_x, int * reg_y );
216 | 00209 
217 | 00210 /*----------------------------------------------------------------------------*/
218 | 00211 /** LSD Simple Interface with Scale
219 | 00212 
220 | 00213     @param n_out       Pointer to an int where LSD will store the number of
221 | 00214                        line segments detected.
222 | 00215 
223 | 00216     @param img         Pointer to input image data. It must be an array of
224 | 00217                        doubles of size X x Y, and the pixel at coordinates
225 | 00218                        (x,y) is obtained by img[x+y*X].
226 | 00219 
227 | 00220     @param X           X size of the image: the number of columns.
228 | 00221 
229 | 00222     @param Y           Y size of the image: the number of rows.
230 | 00223 
231 | 00224     @param scale       When different from 1.0, LSD will scale the input image
232 | 00225                        by 'scale' factor by Gaussian filtering, before detecting
233 | 00226                        line segments.
234 | 00227                        Example: if scale=0.8, the input image will be subsampled
235 | 00228                        to 80% of its size, before the line segment detector
236 | 00229                        is applied.
237 | 00230                        Suggested value: 0.8
238 | 00231 
239 | 00232     @return            A double array of size 7 x n_out, containing the list
240 | 00233                        of line segments detected. The array contains first
241 | 00234                        7 values of line segment number 1, then the 7 values
242 | 00235                        of line segment number 2, and so on, and it finish
243 | 00236                        by the 7 values of line segment number n_out.
244 | 00237                        The seven values are:
245 | 00238                        - x1,y1,x2,y2,width,p,-log10(NFA)
246 | 00239                        .
247 | 00240                        for a line segment from coordinates (x1,y1) to (x2,y2),
248 | 00241                        a width 'width', an angle precision of p in (0,1) given
249 | 00242                        by angle_tolerance/180 degree, and NFA value 'NFA'.
250 | 00243                        If 'out' is the returned pointer, the 7 values of
251 | 00244                        line segment number 'n+1' are obtained with
252 | 00245                        'out[7*n+0]' to 'out[7*n+6]'.
253 | 00246  */
254 | 00247 double * lsd_scale(int * n_out, double * img, int X, int Y, double scale);
255 | 00248 
256 | 00249 /*----------------------------------------------------------------------------*/
257 | 00250 /** LSD Simple Interface
258 | 00251 
259 | 00252     @param n_out       Pointer to an int where LSD will store the number of
260 | 00253                        line segments detected.
261 | 00254 
262 | 00255     @param img         Pointer to input image data. It must be an array of
263 | 00256                        doubles of size X x Y, and the pixel at coordinates
264 | 00257                        (x,y) is obtained by img[x+y*X].
265 | 00258 
266 | 00259     @param X           X size of the image: the number of columns.
267 | 00260 
268 | 00261     @param Y           Y size of the image: the number of rows.
269 | 00262 
270 | 00263     @return            A double array of size 7 x n_out, containing the list
271 | 00264                        of line segments detected. The array contains first
272 | 00265                        7 values of line segment number 1, then the 7 values
273 | 00266                        of line segment number 2, and so on, and it finish
274 | 00267                        by the 7 values of line segment number n_out.
275 | 00268                        The seven values are:
276 | 00269                        - x1,y1,x2,y2,width,p,-log10(NFA)
277 | 00270                        .
278 | 00271                        for a line segment from coordinates (x1,y1) to (x2,y2),
279 | 00272                        a width 'width', an angle precision of p in (0,1) given
280 | 00273                        by angle_tolerance/180 degree, and NFA value 'NFA'.
281 | 00274                        If 'out' is the returned pointer, the 7 values of
282 | 00275                        line segment number 'n+1' are obtained with
283 | 00276                        'out[7*n+0]' to 'out[7*n+6]'.
284 | 00277  */
285 | 00278 double * lsd(int * n_out, double * img, int X, int Y);
286 | 00279 
287 | 00280 #endif /* !LSD_HEADER */
288 | 00281 /*----------------------------------------------------------------------------*/
289 | 

Generated on Fri Nov 11 11:11:11 2011 for LSD by 290 | 291 | doxygen 292 | 1.3.4
293 | 294 | 295 | -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8h__dep__incl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8h__dep__incl.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8h_a0_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8h_a0_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8h_a1_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8h_a1_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8h_a2_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8h_a2_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_8h_a3_cgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/lsd_8h_a3_cgraph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/lsd_opencv.rst: -------------------------------------------------------------------------------- 1 | .. seealso:: 2 | 3 | :ocv:class:`LineSegmentDetector` 4 | 5 | 6 | LineSegmentDetector 7 | ------------------- 8 | Line segment detector class, following the algorithm described at [Rafael12]_. 9 | 10 | .. ocv:class:: LineSegmentDetector : public Algorithm 11 | 12 | 13 | createLineSegmentDetectorPtr 14 | ---------------------------- 15 | Creates a smart pointer to a LineSegmentDetector object and initializes it. 16 | 17 | .. ocv:function:: Ptr createLineSegmentDetectorPtr(int _refine = LSD_REFINE_STD, double _scale = 0.8, double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5, double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024) 18 | 19 | :param _refine: The way found lines will be refined: 20 | 21 | * **LSD_REFINE_NONE** - No refinement applied. 22 | 23 | * **LSD_REFINE_STD** - Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations. 24 | 25 | * **LSD_REFINE_ADV** - Advanced refinement. Number of false alarms is calculated, lines are refined through increase of precision, decrement in size, etc. 26 | 27 | :param scale: The scale of the image that will be used to find the lines. Range (0..1]. 28 | 29 | :param sigma_scale: Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale. 30 | 31 | :param quant: Bound to the quantization error on the gradient norm. 32 | 33 | :param ang_th: Gradient angle tolerance in degrees. 34 | 35 | :param log_eps: Detection threshold: -log10(NFA) > log_eps. Used only when advancent refinement is chosen. 36 | 37 | :param density_th: Minimal density of aligned region points in the enclosing rectangle. 38 | 39 | :param n_bins: Number of bins in pseudo-ordering of gradient modulus. 40 | 41 | The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want to edit those, as to tailor it for their own application. 42 | 43 | 44 | LineSegmentDetector::detect 45 | --------------------------- 46 | Finds lines in the input image. See the lsd_lines.cpp sample for possible usage. 47 | 48 | .. ocv:function:: void detect(const InputArray _image, OutputArray _lines, OutputArray width = noArray(), OutputArray prec = noArray(), OutputArray nfa = noArray()) 49 | 50 | :param _image A grayscale (CV_8UC1) input image. 51 | If only a roi needs to be selected, use :: 52 | lsd_ptr->detect(image(roi), lines, ...); 53 | lines += Scalar(roi.x, roi.y, roi.x, roi.y); 54 | 55 | :param lines: A vector of Vec4i elements specifying the beginning and ending point of a line. Where Vec4i is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient. 56 | 57 | :param width: Vector of widths of the regions, where the lines are found. E.g. Width of line. 58 | 59 | :param prec: Vector of precisions with which the lines are found. 60 | 61 | :param nfa: Vector containing number of false alarms in the line region, with precision of 10%. The bigger the value, logarithmically better the detection. 62 | 63 | * -1 corresponds to 10 mean false alarms 64 | * 0 corresponds to 1 mean false alarm 65 | * 1 corresponds to 0.1 mean false alarms 66 | 67 | This vector will be calculated only when the objects type is LSD_REFINE_ADV. 68 | 69 | 70 | LineSegmentDetector::drawSegments 71 | --------------------------------- 72 | Draws the line segments on a given image. 73 | 74 | .. ocv:function:: void drawSegments(InputOutputArray image, const InputArray lines) 75 | 76 | :param image: The image, where the liens will be drawn. Should be bigger or equal to the image, where the lines were found. 77 | 78 | :param lines: A vector of the lines that needed to be drawn. 79 | 80 | 81 | LineSegmentDetector::compareSegments 82 | ------------------------------------ 83 | Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels. 84 | 85 | .. ocv:function:: int compareSegments(const Size& size, const InputArray lines1, const InputArray lines2, Mat* image = 0) 86 | 87 | :param size: The size of the image, where the lines were found. 88 | 89 | :param lines1: The first group of lines that needs to be drawn. It is visualized in blue color. 90 | 91 | :param lines2: The second group of lines. They visualized in red color. 92 | 93 | :param image: Optional image, where the lines will be drawn. The image is converted to grayscale before displaying, leaving lines1 and lines2 in the above mentioned colors. 94 | 95 | 96 | .. [Rafael12] Rafael Grompone von Gioi, Jérémie Jakubowicz, Jean-Michel Morel, and Gregory Randall, LSD: a Line Segment Detector, Image Processing On Line, vol. 2012. http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd 97 | -------------------------------------------------------------------------------- /lsd_1.6/doc/structcoorlist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: coorlist struct Reference 4 | 5 | 6 | 7 | 8 |

coorlist Struct Reference

Collaboration diagram for coorlist:

Collaboration graph
9 |
[legend]

Detailed Description

10 | Chained list of coordinates. 11 |

12 | 13 |

14 | Definition at line 140 of file lsd.c. 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |

Data Fields

int x
int y
coorlistnext
24 |


Field Documentation

25 |

26 | 27 | 28 | 34 | 35 |
29 | 30 | 31 |
struct coorlist* coorlist::next 32 |
33 |
36 | 37 | 38 | 41 | 47 | 48 |
39 |   40 | 42 | 43 |

44 | 45 |

46 | Definition at line 143 of file lsd.c.

49 |

50 | 51 | 52 | 58 | 59 |
53 | 54 | 55 |
int coorlist::x 56 |
57 |
60 | 61 | 62 | 65 | 71 | 72 |
63 |   64 | 66 | 67 |

68 | 69 |

70 | Definition at line 142 of file lsd.c.

73 |

74 | 75 | 76 | 82 | 83 |
77 | 78 | 79 |
int coorlist::y 80 |
81 |
84 | 85 | 86 | 89 | 95 | 96 |
87 |   88 | 90 | 91 |

92 | 93 |

94 | Definition at line 142 of file lsd.c.

97 |


The documentation for this struct was generated from the following file: 99 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 100 | 101 | doxygen 102 | 1.3.4
103 | 104 | 105 | -------------------------------------------------------------------------------- /lsd_1.6/doc/structcoorlist__coll__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/doc/structcoorlist__coll__graph.png -------------------------------------------------------------------------------- /lsd_1.6/doc/structimage__char__s.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: image_char_s struct Reference 4 | 5 | 6 | 7 | 8 |

image_char_s Struct Reference


Detailed Description

9 | char image data type 10 |

11 | The pixel value at (x,y) is accessed by:

12 | image->data[ x + y * image->xsize ]

13 | with x and y integer. 14 |

15 | 16 |

17 | Definition at line 343 of file lsd.c. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |

Data Fields

unsigned char * data
unsigned int xsize
unsigned int ysize
27 |


Field Documentation

28 |

29 | 30 | 31 | 37 | 38 |
32 | 33 | 34 |
unsigned char* image_char_s::data 35 |
36 |
39 | 40 | 41 | 44 | 52 | 53 |
42 |   43 | 45 | 46 |

47 | 48 |

49 | Definition at line 345 of file lsd.c. 50 |

51 | Referenced by free_image_char(), LineSegmentDetection(), new_image_char(), new_image_char_ini(), reduce_region_radius(), refine(), and region_grow().

54 |

55 | 56 | 57 | 63 | 64 |
58 | 59 | 60 |
unsigned int image_char_s::xsize 61 |
62 |
65 | 66 | 67 | 70 | 78 | 79 |
68 |   69 | 71 | 72 |

73 | 74 |

75 | Definition at line 346 of file lsd.c. 76 |

77 | Referenced by LineSegmentDetection(), new_image_char(), reduce_region_radius(), refine(), and region_grow().

80 |

81 | 82 | 83 | 89 | 90 |
84 | 85 | 86 |
unsigned int image_char_s::ysize 87 |
88 |
91 | 92 | 93 | 96 | 104 | 105 |
94 |   95 | 97 | 98 |

99 | 100 |

101 | Definition at line 346 of file lsd.c. 102 |

103 | Referenced by new_image_char(), and region_grow().

106 |


The documentation for this struct was generated from the following file: 108 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 109 | 110 | doxygen 111 | 1.3.4
112 | 113 | 114 | -------------------------------------------------------------------------------- /lsd_1.6/doc/structimage__double__s.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: image_double_s struct Reference 4 | 5 | 6 | 7 | 8 |

image_double_s Struct Reference


Detailed Description

9 | double image data type 10 |

11 | The pixel value at (x,y) is accessed by:

12 | image->data[ x + y * image->xsize ]

13 | with x and y integer. 14 |

15 | 16 |

17 | Definition at line 469 of file lsd.c. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |

Data Fields

double * data
unsigned int xsize
unsigned int ysize
27 |


Field Documentation

28 |

29 | 30 | 31 | 37 | 38 |
32 | 33 | 34 |
double* image_double_s::data 35 |
36 |
39 | 40 | 41 | 44 | 52 | 53 |
42 |   43 | 45 | 46 |

47 | 48 |

49 | Definition at line 471 of file lsd.c. 50 |

51 | Referenced by free_image_double(), gaussian_sampler(), get_theta(), isaligned(), LineSegmentDetection(), ll_angle(), new_image_double(), new_image_double_ptr(), reduce_region_radius(), refine(), region2rect(), and region_grow().

54 |

55 | 56 | 57 | 63 | 64 |
58 | 59 | 60 |
unsigned int image_double_s::xsize 61 |
62 |
65 | 66 | 67 | 70 | 78 | 79 |
68 |   69 | 71 | 72 |

73 | 74 |

75 | Definition at line 472 of file lsd.c. 76 |

77 | Referenced by gaussian_sampler(), get_theta(), isaligned(), LineSegmentDetection(), ll_angle(), new_image_double(), new_image_double_ptr(), rect_nfa(), refine(), region2rect(), and region_grow().

80 |

81 | 82 | 83 | 89 | 90 |
84 | 85 | 86 |
unsigned int image_double_s::ysize 87 |
88 |
91 | 92 | 93 | 96 | 104 | 105 |
94 |   95 | 97 | 98 |

99 | 100 |

101 | Definition at line 472 of file lsd.c. 102 |

103 | Referenced by gaussian_sampler(), isaligned(), LineSegmentDetection(), ll_angle(), new_image_double(), new_image_double_ptr(), rect_nfa(), and region_grow().

106 |


The documentation for this struct was generated from the following file: 108 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 109 | 110 | doxygen 111 | 1.3.4
112 | 113 | 114 | -------------------------------------------------------------------------------- /lsd_1.6/doc/structimage__int__s.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: image_int_s struct Reference 4 | 5 | 6 | 7 | 8 |

image_int_s Struct Reference


Detailed Description

9 | int image data type 10 |

11 | The pixel value at (x,y) is accessed by:

12 | image->data[ x + y * image->xsize ]

13 | with x and y integer. 14 |

15 | 16 |

17 | Definition at line 414 of file lsd.c. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |

Data Fields

int * data
unsigned int xsize
unsigned int ysize
27 |


Field Documentation

28 |

29 | 30 | 31 | 37 | 38 |
32 | 33 | 34 |
int* image_int_s::data 35 |
36 |
39 | 40 | 41 | 44 | 52 | 53 |
42 |   43 | 45 | 46 |

47 | 48 |

49 | Definition at line 416 of file lsd.c. 50 |

51 | Referenced by LineSegmentDetection(), new_image_int(), and new_image_int_ini().

54 |

55 | 56 | 57 | 63 | 64 |
58 | 59 | 60 |
unsigned int image_int_s::xsize 61 |
62 |
65 | 66 | 67 | 70 | 78 | 79 |
68 |   69 | 71 | 72 |

73 | 74 |

75 | Definition at line 417 of file lsd.c. 76 |

77 | Referenced by LineSegmentDetection(), and new_image_int().

80 |

81 | 82 | 83 | 89 | 90 |
84 | 85 | 86 |
unsigned int image_int_s::ysize 87 |
88 |
91 | 92 | 93 | 96 | 104 | 105 |
94 |   95 | 97 | 98 |

99 | 100 |

101 | Definition at line 417 of file lsd.c. 102 |

103 | Referenced by LineSegmentDetection(), and new_image_int().

106 |


The documentation for this struct was generated from the following file: 108 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 109 | 110 | doxygen 111 | 1.3.4
112 | 113 | 114 | -------------------------------------------------------------------------------- /lsd_1.6/doc/structntuple__list__s.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: ntuple_list_s struct Reference 4 | 5 | 6 | 7 | 8 |

ntuple_list_s Struct Reference


Detailed Description

9 | 'list of n-tuple' data type 10 |

11 | The i-th component of the j-th n-tuple of an n-tuple list 'ntl' is accessed with:

12 | ntl->values[ i + j * ntl->dim ]

13 | The dimension of the n-tuple (n) is:

14 | ntl->dim

15 | The number of n-tuples in the list is:

16 | ntl->size

17 | The maximum number of n-tuples that can be stored in the list with the allocated memory at a given time is given by:

18 | ntl->max_size 19 |

20 | 21 |

22 | Definition at line 238 of file lsd.c. 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |

Data Fields

unsigned int size
unsigned int max_size
unsigned int dim
double * values
34 |


Field Documentation

35 |

36 | 37 | 38 | 44 | 45 |
39 | 40 | 41 |
unsigned int ntuple_list_s::dim 42 |
43 |
46 | 47 | 48 | 51 | 59 | 60 |
49 |   50 | 52 | 53 |

54 | 55 |

56 | Definition at line 242 of file lsd.c. 57 |

58 | Referenced by add_7tuple(), enlarge_ntuple_list(), gaussian_kernel(), gaussian_sampler(), and new_ntuple_list().

61 |

62 | 63 | 64 | 70 | 71 |
65 | 66 | 67 |
unsigned int ntuple_list_s::max_size 68 |
69 |
72 | 73 | 74 | 77 | 85 | 86 |
75 |   76 | 78 | 79 |

80 | 81 |

82 | Definition at line 241 of file lsd.c. 83 |

84 | Referenced by add_7tuple(), enlarge_ntuple_list(), gaussian_kernel(), and new_ntuple_list().

87 |

88 | 89 | 90 | 96 | 97 |
91 | 92 | 93 |
unsigned int ntuple_list_s::size 94 |
95 |
98 | 99 | 100 | 103 | 111 | 112 |
101 |   102 | 104 | 105 |

106 | 107 |

108 | Definition at line 240 of file lsd.c. 109 |

110 | Referenced by add_7tuple(), gaussian_kernel(), LineSegmentDetection(), and new_ntuple_list().

113 |

114 | 115 | 116 | 122 | 123 |
117 | 118 | 119 |
double* ntuple_list_s::values 120 |
121 |
124 | 125 | 126 | 129 | 137 | 138 |
127 |   128 | 130 | 131 |

132 | 133 |

134 | Definition at line 243 of file lsd.c. 135 |

136 | Referenced by add_7tuple(), enlarge_ntuple_list(), free_ntuple_list(), gaussian_kernel(), gaussian_sampler(), LineSegmentDetection(), and new_ntuple_list().

139 |


The documentation for this struct was generated from the following file: 141 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 142 | 143 | doxygen 144 | 1.3.4
145 | 146 | 147 | -------------------------------------------------------------------------------- /lsd_1.6/doc/structpoint.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: point struct Reference 4 | 5 | 6 | 7 | 8 |

point Struct Reference


Detailed Description

9 | A point (or pixel). 10 |

11 | 12 |

13 | Definition at line 149 of file lsd.c. 14 | 15 | 16 | 17 | 18 | 19 | 20 |

Data Fields

int x
int y
21 |


Field Documentation

22 |

23 | 24 | 25 | 31 | 32 |
26 | 27 | 28 |
int point::x 29 |
30 |
33 | 34 | 35 | 38 | 46 | 47 |
36 |   37 | 39 | 40 |

41 | 42 |

43 | Definition at line 149 of file lsd.c. 44 |

45 | Referenced by get_theta(), reduce_region_radius(), refine(), region2rect(), and region_grow().

48 |

49 | 50 | 51 | 57 | 58 |
52 | 53 | 54 |
int point::y 55 |
56 |
59 | 60 | 61 | 64 | 72 | 73 |
62 |   63 | 65 | 66 |

67 | 68 |

69 | Definition at line 149 of file lsd.c. 70 |

71 | Referenced by get_theta(), reduce_region_radius(), refine(), region2rect(), and region_grow().

74 |


The documentation for this struct was generated from the following file: 76 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 77 | 78 | doxygen 79 | 1.3.4
80 | 81 | 82 | -------------------------------------------------------------------------------- /lsd_1.6/doc/structrect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: rect struct Reference 4 | 5 | 6 | 7 | 8 |

rect Struct Reference


Detailed Description

9 | Rectangle structure: line segment with width. 10 |

11 | 12 |

13 | Definition at line 1169 of file lsd.c. 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |

Data Fields

double x1
double y1
double x2
double y2
double width
double x
double y
double theta
double dx
double dy
double prec
double p
41 |


Field Documentation

42 |

43 | 44 | 45 | 51 | 52 |
46 | 47 | 48 |
double rect::dx 49 |
50 |
53 | 54 | 55 | 58 | 66 | 67 |
56 |   57 | 59 | 60 |

61 | 62 |

63 | Definition at line 1175 of file lsd.c. 64 |

65 | Referenced by rect_copy(), rect_improve(), region2rect(), and ri_ini().

68 |

69 | 70 | 71 | 77 | 78 |
72 | 73 | 74 |
double rect::dy 75 |
76 |
79 | 80 | 81 | 84 | 92 | 93 |
82 |   83 | 85 | 86 |

87 | 88 |

89 | Definition at line 1175 of file lsd.c. 90 |

91 | Referenced by rect_copy(), rect_improve(), region2rect(), and ri_ini().

94 |

95 | 96 | 97 | 103 | 104 |
98 | 99 | 100 |
double rect::p 101 |
102 |
105 | 106 | 107 | 110 | 118 | 119 |
108 |   109 | 111 | 112 |

113 | 114 |

115 | Definition at line 1177 of file lsd.c. 116 |

117 | Referenced by LineSegmentDetection(), rect_copy(), rect_improve(), rect_nfa(), and region2rect().

120 |

121 | 122 | 123 | 129 | 130 |
124 | 125 | 126 |
double rect::prec 127 |
128 |
131 | 132 | 133 | 136 | 144 | 145 |
134 |   135 | 137 | 138 |

139 | 140 |

141 | Definition at line 1176 of file lsd.c. 142 |

143 | Referenced by rect_copy(), rect_improve(), rect_nfa(), and region2rect().

146 |

147 | 148 | 149 | 155 | 156 |
150 | 151 | 152 |
double rect::theta 153 |
154 |
157 | 158 | 159 | 162 | 170 | 171 |
160 |   161 | 163 | 164 |

165 | 166 |

167 | Definition at line 1174 of file lsd.c. 168 |

169 | Referenced by rect_copy(), rect_nfa(), and region2rect().

172 |

173 | 174 | 175 | 181 | 182 |
176 | 177 | 178 |
double rect::width 179 |
180 |
183 | 184 | 185 | 188 | 196 | 197 |
186 |   187 | 189 | 190 |

191 | 192 |

193 | Definition at line 1172 of file lsd.c. 194 |

195 | Referenced by LineSegmentDetection(), rect_copy(), rect_improve(), reduce_region_radius(), refine(), region2rect(), and ri_ini().

198 |

199 | 200 | 201 | 207 | 208 |
202 | 203 | 204 |
double rect::x 205 |
206 |
209 | 210 | 211 | 214 | 222 | 223 |
212 |   213 | 215 | 216 |

217 | 218 |

219 | Definition at line 1173 of file lsd.c. 220 |

221 | Referenced by rect_copy(), and region2rect().

224 |

225 | 226 | 227 | 233 | 234 |
228 | 229 | 230 |
double rect::x1 231 |
232 |
235 | 236 | 237 | 240 | 248 | 249 |
238 |   239 | 241 | 242 |

243 | 244 |

245 | Definition at line 1171 of file lsd.c. 246 |

247 | Referenced by LineSegmentDetection(), rect_copy(), rect_improve(), reduce_region_radius(), refine(), region2rect(), and ri_ini().

250 |

251 | 252 | 253 | 259 | 260 |
254 | 255 | 256 |
double rect::x2 257 |
258 |
261 | 262 | 263 | 266 | 274 | 275 |
264 |   265 | 267 | 268 |

269 | 270 |

271 | Definition at line 1171 of file lsd.c. 272 |

273 | Referenced by LineSegmentDetection(), rect_copy(), rect_improve(), reduce_region_radius(), refine(), region2rect(), and ri_ini().

276 |

277 | 278 | 279 | 285 | 286 |
280 | 281 | 282 |
double rect::y 283 |
284 |
287 | 288 | 289 | 292 | 300 | 301 |
290 |   291 | 293 | 294 |

295 | 296 |

297 | Definition at line 1173 of file lsd.c. 298 |

299 | Referenced by rect_copy(), and region2rect().

302 |

303 | 304 | 305 | 311 | 312 |
306 | 307 | 308 |
double rect::y1 309 |
310 |
313 | 314 | 315 | 318 | 326 | 327 |
316 |   317 | 319 | 320 |

321 | 322 |

323 | Definition at line 1171 of file lsd.c. 324 |

325 | Referenced by LineSegmentDetection(), rect_copy(), rect_improve(), reduce_region_radius(), refine(), region2rect(), and ri_ini().

328 |

329 | 330 | 331 | 337 | 338 |
332 | 333 | 334 |
double rect::y2 335 |
336 |
339 | 340 | 341 | 344 | 352 | 353 |
342 |   343 | 345 | 346 |

347 | 348 |

349 | Definition at line 1171 of file lsd.c. 350 |

351 | Referenced by LineSegmentDetection(), rect_copy(), rect_improve(), reduce_region_radius(), refine(), region2rect(), and ri_ini().

354 |


The documentation for this struct was generated from the following file: 356 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 357 | 358 | doxygen 359 | 1.3.4
360 | 361 | 362 | -------------------------------------------------------------------------------- /lsd_1.6/doc/structrect__iter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | LSD: rect_iter struct Reference 4 | 5 | 6 | 7 | 8 |

rect_iter Struct Reference


Detailed Description

9 | Rectangle points iterator. 10 |

11 | The integer coordinates of pixels inside a rectangle are iteratively explored. This structure keep track of the process and functions ri_ini(), ri_inc(), ri_end(), and ri_del() are used in the process. An example of how to use the iterator is as follows:

      struct rect * rec = XXX; // some rectangle
 12 |       rect_iter * i;
 13 |       for( i=ri_ini(rec); !ri_end(i); ri_inc(i) )
 14 |         {
 15 |           // your code, using 'i->x' and 'i->y' as coordinates
 16 |         }
 17 |       ri_del(i); // delete iterator
 18 | 
The pixels are explored 'column' by 'column', where we call 'column' a set of pixels with the same x value that are inside the rectangle. The following is an schematic representation of a rectangle, the 'column' being explored is marked by colons, and the current pixel being explored is 'x,y'.
 19 | 
 20 |               vx[1],vy[1]
 21 |                  *   *
 22 |                 *       *
 23 |                *           *
 24 |               *               ye
 25 |              *                :  *
 26 |         vx[0],vy[0]           :     *
 27 |                *              :        *
 28 |                   *          x,y          *
 29 |                      *        :              *
 30 |                         *     :            vx[2],vy[2]
 31 |                            *  :                *
 32 |         y                     ys              *
 33 |         ^                        *           *
 34 |         |                           *       *
 35 |         |                              *   *
 36 |         +---> x                      vx[3],vy[3]
 37 | 
 38 |     
The first 'column' to be explored is the one with the smaller x value. Each 'column' is explored starting from the pixel of the 'column' (inside the rectangle) with the smallest y value.

39 | The four corners of the rectangle are stored in order that rotates around the corners at the arrays 'vx[]' and 'vy[]'. The first point is always the one with smaller x value.

40 | 'x' and 'y' are the coordinates of the pixel being explored. 'ys' and 'ye' are the start and end values of the current column being explored. So, 'ys' < 'ye'. 41 |

42 | 43 |

44 | Definition at line 1259 of file lsd.c. 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |

Data Fields

double vx [4]
double vy [4]
double ys
double ye
int x
int y
60 |


Field Documentation

61 |

62 | 63 | 64 | 70 | 71 |
65 | 66 | 67 |
double rect_iter::vx[4] 68 |
69 |
72 | 73 | 74 | 77 | 85 | 86 |
75 |   76 | 78 | 79 |

80 | 81 |

82 | Definition at line 1261 of file lsd.c. 83 |

84 | Referenced by ri_end(), ri_inc(), and ri_ini().

87 |

88 | 89 | 90 | 96 | 97 |
91 | 92 | 93 |
double rect_iter::vy[4] 94 |
95 |
98 | 99 | 100 | 103 | 111 | 112 |
101 |   102 | 104 | 105 |

106 | 107 |

108 | Definition at line 1262 of file lsd.c. 109 |

110 | Referenced by ri_inc(), and ri_ini().

113 |

114 | 115 | 116 | 122 | 123 |
117 | 118 | 119 |
int rect_iter::x 120 |
121 |
124 | 125 | 126 | 129 | 137 | 138 |
127 |   128 | 130 | 131 |

132 | 133 |

134 | Definition at line 1264 of file lsd.c. 135 |

136 | Referenced by rect_nfa(), ri_end(), ri_inc(), and ri_ini().

139 |

140 | 141 | 142 | 148 | 149 |
143 | 144 | 145 |
int rect_iter::y 146 |
147 |
150 | 151 | 152 | 155 | 163 | 164 |
153 |   154 | 156 | 157 |

158 | 159 |

160 | Definition at line 1264 of file lsd.c. 161 |

162 | Referenced by rect_nfa(), ri_inc(), and ri_ini().

165 |

166 | 167 | 168 | 174 | 175 |
169 | 170 | 171 |
double rect_iter::ye 172 |
173 |
176 | 177 | 178 | 181 | 189 | 190 |
179 |   180 | 182 | 183 |

184 | 185 |

186 | Definition at line 1263 of file lsd.c. 187 |

188 | Referenced by ri_inc(), and ri_ini().

191 |

192 | 193 | 194 | 200 | 201 |
195 | 196 | 197 |
double rect_iter::ys 198 |
199 |
202 | 203 | 204 | 207 | 215 | 216 |
205 |   206 | 208 | 209 |

210 | 211 |

212 | Definition at line 1263 of file lsd.c. 213 |

214 | Referenced by ri_inc(), and ri_ini().

217 |


The documentation for this struct was generated from the following file: 219 |
Generated on Fri Nov 11 11:11:11 2011 for LSD by 220 | 221 | doxygen 222 | 1.3.4
223 | 224 | 225 | -------------------------------------------------------------------------------- /lsd_1.6/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | # Add Libraries 4 | include_directories(${LSD_SOURCE_DIR}/libs) 5 | include_directories(${LSD_SOURCE_DIR}/include) 6 | 7 | find_package(OpenCV REQUIRED) 8 | 9 | add_executable(lsd_call_example lsd_call_example.cpp) 10 | target_link_libraries(lsd_call_example lsd) 11 | 12 | add_executable(lsd_cmd lsd_cmd.cpp) 13 | target_link_libraries(lsd_cmd lsd) 14 | 15 | add_executable(lsd_opencv_example lsd_opencv_example.cpp) 16 | target_link_libraries(lsd_opencv_example lsd_opencv ${OpenCV_LIBS}) 17 | 18 | add_executable(lsd_wrap_cmd lsd_wrap_cmd.cpp) 19 | target_link_libraries(lsd_wrap_cmd lsd_wrap ${OpenCV_LIBS}) 20 | 21 | add_executable(lsd_opencv_cmd lsd_opencv_cmd.cpp) 22 | target_link_libraries(lsd_opencv_cmd lsd_opencv ${OpenCV_LIBS}) 23 | 24 | add_executable(lsd_lines lsd_lines.cpp) 25 | target_link_libraries(lsd_lines lsd_opencv ${OpenCV_LIBS}) 26 | 27 | add_executable(lsd_filter lsd_filterAngle.cpp) 28 | target_link_libraries(lsd_filter lsd_opencv ${OpenCV_LIBS}) 29 | -------------------------------------------------------------------------------- /lsd_1.6/examples/lsd_call_example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "lsd.hpp" 4 | 5 | int main(void) 6 | { 7 | double * image; 8 | double * out; 9 | int x,y,i,j,n; 10 | int X = 128; /* x image size */ 11 | int Y = 128; /* y image size */ 12 | 13 | /* create a simple image: left half black, right half gray */ 14 | image = (double *) malloc( X * Y * sizeof(double) ); 15 | if( image == NULL ) 16 | { 17 | fprintf(stderr,"error: not enough memory\n"); 18 | exit(EXIT_FAILURE); 19 | } 20 | for(x=0;x 2 | #include 3 | #include 4 | 5 | #include "lsd_opencv.hpp" 6 | 7 | using namespace std; 8 | using namespace cv; 9 | 10 | const float ANGLE = 15; 11 | const float RANGE = 10; 12 | 13 | const float MIN_LEN = 30; 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | if (argc != 2) 18 | { 19 | std::cout << "lsd_filter [in_image]" << std::endl 20 | << "\tin - input image" << std::endl; 21 | return false; 22 | } 23 | 24 | std::string in = argv[1]; 25 | 26 | Mat image = imread(in, CV_LOAD_IMAGE_GRAYSCALE); 27 | 28 | // 29 | // LSD call 30 | // 31 | std::vector lines, filtered_lines, retained_lines, long_lines; 32 | std::vector width, prec, nfa; 33 | Ptr ls = createLineSegmentDetectorPtr(LSD_REFINE_STD); 34 | 35 | double start = double(getTickCount()); 36 | ls->detect(image, lines); 37 | ls->filterSize(lines, lines, MIN_LEN, LSD_NO_SIZE_LIMIT); // Remove all lines smaller than MIN_LEN pixels 38 | ls->filterOutAngle(lines,filtered_lines, ANGLE, RANGE); // remove all vertical lines 39 | ls->retainAngle(lines, retained_lines, ANGLE, RANGE); // take all vertical lines 40 | double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 41 | 42 | cout << "It took " << duration_ms << " ms." << endl; 43 | 44 | // 45 | // Show difference 46 | // 47 | Mat drawnLines(image); 48 | ls->drawSegments(drawnLines, lines); 49 | imshow("Drawing segments", drawnLines); 50 | 51 | Mat vertical(image); 52 | ls->drawSegments(vertical, retained_lines); 53 | imshow("Retained lines", vertical); 54 | 55 | Mat difference = Mat::zeros(image.size(), CV_8UC3); 56 | int d = ls->compareSegments(image.size(), lines, filtered_lines, difference); 57 | imshow("Segments difference", difference); 58 | 59 | waitKey(); 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /lsd_1.6/examples/lsd_lines.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "opencv2/core/core.hpp" 5 | #include "opencv2/imgproc/imgproc.hpp" 6 | #include "opencv2/highgui/highgui.hpp" 7 | 8 | #include "lsd_opencv.hpp" 9 | 10 | using namespace std; 11 | using namespace cv; 12 | 13 | int main(int argc, char** argv) 14 | { 15 | if (argc != 2) 16 | { 17 | std::cout << "lsd_lines [input image]" << std::endl; 18 | return false; 19 | } 20 | 21 | std::string in = argv[1]; 22 | 23 | Mat image = imread(in, CV_LOAD_IMAGE_GRAYSCALE); 24 | 25 | // Create and LSD detector with std refinement. 26 | Ptr lsd_std = createLineSegmentDetectorPtr(LSD_REFINE_STD); 27 | double start = double(getTickCount()); 28 | vector lines_std; 29 | lsd_std->detect(image, lines_std); 30 | double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 31 | std::cout << "OpenCV STD (blue) - " << duration_ms << " ms." << std::endl; 32 | 33 | // Create an LSD detector with no refinement applied. 34 | Ptr lsd_none = createLineSegmentDetectorPtr(LSD_REFINE_NONE); 35 | start = double(getTickCount()); 36 | vector lines_none; 37 | lsd_none->detect(image, lines_none); 38 | duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 39 | std::cout << "OpenCV NONE (red)- " << duration_ms << " ms." << std::endl; 40 | std::cout << "Overlapping pixels are shown in purple." << std::endl; 41 | 42 | Mat difference = Mat::zeros(image.size(), CV_8UC1); 43 | lsd_none->compareSegments(image.size(), lines_std, lines_none, difference); 44 | imshow("Line difference", difference); 45 | 46 | Mat drawnLines(image); 47 | lsd_none->drawSegments(drawnLines, lines_std); 48 | imshow("Standard refinement", drawnLines); 49 | 50 | waitKey(); 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /lsd_1.6/examples/lsd_opencv_cmd.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "lsd_opencv.hpp" 7 | 8 | using namespace std; 9 | using namespace cv; 10 | 11 | int main(int argc, char** argv) 12 | { 13 | if (argc != 3) 14 | { 15 | std::cout << "lsd_opencv_cmd [in] [out]" << std::endl 16 | << "\tin - input image" << std::endl 17 | << "\tout - output containing a line segment at each line [x1, y1, x2, y2, width, p, -log10(NFA)]" << std::endl; 18 | return false; 19 | } 20 | 21 | std::string in = argv[1]; 22 | std::string out = argv[2]; 23 | 24 | Mat image = imread(in, CV_LOAD_IMAGE_GRAYSCALE); 25 | 26 | // LSD call 27 | std::vector lines; 28 | std::vector width, prec; 29 | Ptr lsd = createLineSegmentDetectorPtr(); 30 | 31 | double start = double(getTickCount()); 32 | lsd->detect(image, lines, width, prec); 33 | double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 34 | 35 | std::cout << lines.size() <<" line segments found. For " << duration_ms << " ms." << std::endl; 36 | 37 | //Save to file 38 | ofstream segfile; 39 | segfile.open(out.c_str()); 40 | for (unsigned int i = 0; i < lines.size(); ++i) 41 | { 42 | cout << '\t' << "B: " << lines[i][0] << " " << lines[i][1] 43 | << " E: " << lines[i][2] << " " << lines[i][3] 44 | << " W: " << width[i] 45 | << " P:" << prec[i] << endl; 46 | segfile << '\t' << "B: " << lines[i][0] << " " << lines[i][1] 47 | << " E: " << lines[i][2] << " " << lines[i][3] 48 | << " W: " << width[i] 49 | << " P:" << prec[i] << endl; 50 | } 51 | segfile.close(); 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /lsd_1.6/examples/lsd_opencv_example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "lsd_opencv.hpp" 6 | 7 | using namespace std; 8 | using namespace cv; 9 | 10 | #define IMAGE_WIDTH 1280 11 | #define IMAGE_HEIGHT 720 12 | 13 | int main(void) 14 | { 15 | Mat img1(Size(IMAGE_WIDTH/2, IMAGE_HEIGHT), CV_8UC1, Scalar(255)); 16 | Mat img2(Size(IMAGE_WIDTH/2, IMAGE_HEIGHT), CV_8UC1, Scalar(0)); 17 | 18 | Mat img3(img1.size().height, img1.size().width + img2.size().width, CV_8UC1); 19 | Mat left(img3, Rect(0, 0, img1.size().width, img1.size().height)); 20 | img1.copyTo(left); 21 | Mat right(img3, Rect(img1.size().width, 0, img2.size().width, img2.size().height)); 22 | img2.copyTo(right); 23 | imshow("Image", img3); 24 | 25 | // LSD call 26 | std::vector lines; 27 | std::vector width, prec, nfa; 28 | Ptr ls = createLineSegmentDetectorPtr(LSD_REFINE_ADV); 29 | 30 | double start = double(getTickCount()); 31 | ls->detect(img3, lines, width, prec, nfa); 32 | double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 33 | 34 | std::cout << lines.size() <<" line segments found. For " << duration_ms << " ms." << std::endl; 35 | for (unsigned int i = 0; i < lines.size(); ++i) 36 | { 37 | cout << '\t' << "B: " << lines[i][0] << " " << lines[i][1] 38 | << " E: " << lines[i][2] << " " << lines[i][3] 39 | << " W: " << width[i] 40 | << " P:" << prec[i] 41 | << " NFA:" << nfa[i] << std::endl; 42 | } 43 | 44 | waitKey(); 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /lsd_1.6/examples/lsd_wrap_cmd.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "lsd_wrap.hpp" 6 | 7 | using namespace std; 8 | using namespace cv; 9 | using namespace lsdwrap; 10 | 11 | int main(int argc, char** argv) 12 | { 13 | if (argc != 3) 14 | { 15 | std::cout << "lsd_opencv_cmd [in] [out]" << std::endl 16 | << "\tin - input image" << std::endl 17 | << "\tout - output containing a line segment at each line [x1, y1, x2, y2, width, p, -log10(NFA)]" << std::endl; 18 | return false; 19 | } 20 | 21 | std::string in = argv[1]; 22 | std::string out = argv[2]; 23 | 24 | Mat image = imread(in, CV_LOAD_IMAGE_GRAYSCALE); 25 | 26 | LsdWrap lsd; 27 | vector segments; 28 | double start = double(getTickCount()); 29 | 30 | lsd.lsdw(image, segments); 31 | 32 | double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 33 | std::cout << segments.size() <<" line segments found. For " << duration_ms << " ms." << std::endl; 34 | 35 | lsd.imshow_segs(string("Image"), image, segments); 36 | 37 | //Save to file 38 | ofstream segfile; 39 | segfile.open(out.c_str()); 40 | vector::iterator it = segments.begin(), eit = segments.end(); 41 | for (; it!=eit; it++) 42 | { 43 | segfile << it->x1 << ' ' 44 | << it->y1 << ' ' 45 | << it->x2 << ' ' 46 | << it->y2 << ' ' 47 | << it->width << ' ' 48 | << it->p << ' ' 49 | << it->NFA << std::endl; 50 | } 51 | segfile.close(); 52 | waitKey(0); 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /lsd_1.6/images/board.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/images/board.jpg -------------------------------------------------------------------------------- /lsd_1.6/images/building.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/images/building.jpg -------------------------------------------------------------------------------- /lsd_1.6/images/left01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/23pointsNorth/lsd_opencv/fa34ed1cf22dda5090acb422690d5ddc2ee2745a/lsd_1.6/images/left01.jpg -------------------------------------------------------------------------------- /lsd_1.6/include/lsd.hpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------- 2 | 3 | LSD - Line Segment Detector on digital images 4 | 5 | This code is part of the following publication and was subject 6 | to peer review: 7 | 8 | "LSD: a Line Segment Detector" by Rafael Grompone von Gioi, 9 | Jeremie Jakubowicz, Jean-Michel Morel, and Gregory Randall, 10 | Image Processing On Line, 2012. DOI:10.5201/ipol.2012.gjmr-lsd 11 | http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd 12 | 13 | Copyright (c) 2007-2011 rafael grompone von gioi 14 | 15 | This program is free software: you can redistribute it and/or modify 16 | it under the terms of the GNU Affero General Public License as 17 | published by the Free Software Foundation, either version 3 of the 18 | License, or (at your option) any later version. 19 | 20 | This program is distributed in the hope that it will be useful, 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | GNU Affero General Public License for more details. 24 | 25 | You should have received a copy of the GNU Affero General Public License 26 | along with this program. If not, see . 27 | 28 | ----------------------------------------------------------------------------*/ 29 | 30 | /*----------------------------------------------------------------------------*/ 31 | /** @file lsd.h 32 | LSD module header 33 | @author rafael grompone von gioi 34 | */ 35 | /*----------------------------------------------------------------------------*/ 36 | #ifndef LSD_HEADER 37 | #define LSD_HEADER 38 | 39 | /*----------------------------------------------------------------------------*/ 40 | /** LSD Full Interface 41 | 42 | @param n_out Pointer to an int where LSD will store the number of 43 | line segments detected. 44 | 45 | @param img Pointer to input image data. It must be an array of 46 | doubles of size X x Y, and the pixel at coordinates 47 | (x,y) is obtained by img[x+y*X]. 48 | 49 | @param X X size of the image: the number of columns. 50 | 51 | @param Y Y size of the image: the number of rows. 52 | 53 | @param scale When different from 1.0, LSD will scale the input image 54 | by 'scale' factor by Gaussian filtering, before detecting 55 | line segments. 56 | Example: if scale=0.8, the input image will be subsampled 57 | to 80% of its size, before the line segment detector 58 | is applied. 59 | Suggested value: 0.8 60 | 61 | @param sigma_scale When scale!=1.0, the sigma of the Gaussian filter is: 62 | sigma = sigma_scale / scale, if scale < 1.0 63 | sigma = sigma_scale, if scale >= 1.0 64 | Suggested value: 0.6 65 | 66 | @param quant Bound to the quantization error on the gradient norm. 67 | Example: if gray levels are quantized to integer steps, 68 | the gradient (computed by finite differences) error 69 | due to quantization will be bounded by 2.0, as the 70 | worst case is when the error are 1 and -1, that 71 | gives an error of 2.0. 72 | Suggested value: 2.0 73 | 74 | @param ang_th Gradient angle tolerance in the region growing 75 | algorithm, in degrees. 76 | Suggested value: 22.5 77 | 78 | @param log_eps Detection threshold, accept if -log10(NFA) > log_eps. 79 | The larger the value, the more strict the detector is, 80 | and will result in less detections. 81 | (Note that the 'minus sign' makes that this 82 | behavior is opposite to the one of NFA.) 83 | The value -log10(NFA) is equivalent but more 84 | intuitive than NFA: 85 | - -1.0 gives an average of 10 false detections on noise 86 | - 0.0 gives an average of 1 false detections on noise 87 | - 1.0 gives an average of 0.1 false detections on nose 88 | - 2.0 gives an average of 0.01 false detections on noise 89 | . 90 | Suggested value: 0.0 91 | 92 | @param density_th Minimal proportion of 'supporting' points in a rectangle. 93 | Suggested value: 0.7 94 | 95 | @param n_bins Number of bins used in the pseudo-ordering of gradient 96 | modulus. 97 | Suggested value: 1024 98 | 99 | @param reg_img Optional output: if desired, LSD will return an 100 | int image where each pixel indicates the line segment 101 | to which it belongs. Unused pixels have the value '0', 102 | while the used ones have the number of the line segment, 103 | numbered 1,2,3,..., in the same order as in the 104 | output list. If desired, a non NULL int** pointer must 105 | be assigned, and LSD will make that the pointer point 106 | to an int array of size reg_x x reg_y, where the pixel 107 | value at (x,y) is obtained with (*reg_img)[x+y*reg_x]. 108 | Note that the resulting image has the size of the image 109 | used for the processing, that is, the size of the input 110 | image scaled by the given factor 'scale'. If scale!=1 111 | this size differs from XxY and that is the reason why 112 | its value is given by reg_x and reg_y. 113 | Suggested value: NULL 114 | 115 | @param reg_x Pointer to an int where LSD will put the X size 116 | 'reg_img' image, when asked for. 117 | Suggested value: NULL 118 | 119 | @param reg_y Pointer to an int where LSD will put the Y size 120 | 'reg_img' image, when asked for. 121 | Suggested value: NULL 122 | 123 | @return A double array of size 7 x n_out, containing the list 124 | of line segments detected. The array contains first 125 | 7 values of line segment number 1, then the 7 values 126 | of line segment number 2, and so on, and it finish 127 | by the 7 values of line segment number n_out. 128 | The seven values are: 129 | - x1,y1,x2,y2,width,p,-log10(NFA) 130 | . 131 | for a line segment from coordinates (x1,y1) to (x2,y2), 132 | a width 'width', an angle precision of p in (0,1) given 133 | by angle_tolerance/180 degree, and NFA value 'NFA'. 134 | If 'out' is the returned pointer, the 7 values of 135 | line segment number 'n+1' are obtained with 136 | 'out[7*n+0]' to 'out[7*n+6]'. 137 | */ 138 | double * LineSegmentDetection( int * n_out, 139 | double * img, int X, int Y, 140 | double scale, double sigma_scale, double quant, 141 | double ang_th, double log_eps, double density_th, 142 | int n_bins, 143 | int ** reg_img, int * reg_x, int * reg_y ); 144 | 145 | /*----------------------------------------------------------------------------*/ 146 | /** LSD Simple Interface with Scale and Region output. 147 | 148 | @param n_out Pointer to an int where LSD will store the number of 149 | line segments detected. 150 | 151 | @param img Pointer to input image data. It must be an array of 152 | doubles of size X x Y, and the pixel at coordinates 153 | (x,y) is obtained by img[x+y*X]. 154 | 155 | @param X X size of the image: the number of columns. 156 | 157 | @param Y Y size of the image: the number of rows. 158 | 159 | @param scale When different from 1.0, LSD will scale the input image 160 | by 'scale' factor by Gaussian filtering, before detecting 161 | line segments. 162 | Example: if scale=0.8, the input image will be subsampled 163 | to 80% of its size, before the line segment detector 164 | is applied. 165 | Suggested value: 0.8 166 | 167 | @param reg_img Optional output: if desired, LSD will return an 168 | int image where each pixel indicates the line segment 169 | to which it belongs. Unused pixels have the value '0', 170 | while the used ones have the number of the line segment, 171 | numbered 1,2,3,..., in the same order as in the 172 | output list. If desired, a non NULL int** pointer must 173 | be assigned, and LSD will make that the pointer point 174 | to an int array of size reg_x x reg_y, where the pixel 175 | value at (x,y) is obtained with (*reg_img)[x+y*reg_x]. 176 | Note that the resulting image has the size of the image 177 | used for the processing, that is, the size of the input 178 | image scaled by the given factor 'scale'. If scale!=1 179 | this size differs from XxY and that is the reason why 180 | its value is given by reg_x and reg_y. 181 | Suggested value: NULL 182 | 183 | @param reg_x Pointer to an int where LSD will put the X size 184 | 'reg_img' image, when asked for. 185 | Suggested value: NULL 186 | 187 | @param reg_y Pointer to an int where LSD will put the Y size 188 | 'reg_img' image, when asked for. 189 | Suggested value: NULL 190 | 191 | @return A double array of size 7 x n_out, containing the list 192 | of line segments detected. The array contains first 193 | 7 values of line segment number 1, then the 7 values 194 | of line segment number 2, and so on, and it finish 195 | by the 7 values of line segment number n_out. 196 | The seven values are: 197 | - x1,y1,x2,y2,width,p,-log10(NFA) 198 | . 199 | for a line segment from coordinates (x1,y1) to (x2,y2), 200 | a width 'width', an angle precision of p in (0,1) given 201 | by angle_tolerance/180 degree, and NFA value 'NFA'. 202 | If 'out' is the returned pointer, the 7 values of 203 | line segment number 'n+1' are obtained with 204 | 'out[7*n+0]' to 'out[7*n+6]'. 205 | */ 206 | double * lsd_scale_region( int * n_out, 207 | double * img, int X, int Y, double scale, 208 | int ** reg_img, int * reg_x, int * reg_y ); 209 | 210 | /*----------------------------------------------------------------------------*/ 211 | /** LSD Simple Interface with Scale 212 | 213 | @param n_out Pointer to an int where LSD will store the number of 214 | line segments detected. 215 | 216 | @param img Pointer to input image data. It must be an array of 217 | doubles of size X x Y, and the pixel at coordinates 218 | (x,y) is obtained by img[x+y*X]. 219 | 220 | @param X X size of the image: the number of columns. 221 | 222 | @param Y Y size of the image: the number of rows. 223 | 224 | @param scale When different from 1.0, LSD will scale the input image 225 | by 'scale' factor by Gaussian filtering, before detecting 226 | line segments. 227 | Example: if scale=0.8, the input image will be subsampled 228 | to 80% of its size, before the line segment detector 229 | is applied. 230 | Suggested value: 0.8 231 | 232 | @return A double array of size 7 x n_out, containing the list 233 | of line segments detected. The array contains first 234 | 7 values of line segment number 1, then the 7 values 235 | of line segment number 2, and so on, and it finish 236 | by the 7 values of line segment number n_out. 237 | The seven values are: 238 | - x1,y1,x2,y2,width,p,-log10(NFA) 239 | . 240 | for a line segment from coordinates (x1,y1) to (x2,y2), 241 | a width 'width', an angle precision of p in (0,1) given 242 | by angle_tolerance/180 degree, and NFA value 'NFA'. 243 | If 'out' is the returned pointer, the 7 values of 244 | line segment number 'n+1' are obtained with 245 | 'out[7*n+0]' to 'out[7*n+6]'. 246 | */ 247 | double * lsd_scale(int * n_out, double * img, int X, int Y, double scale); 248 | 249 | /*----------------------------------------------------------------------------*/ 250 | /** LSD Simple Interface 251 | 252 | @param n_out Pointer to an int where LSD will store the number of 253 | line segments detected. 254 | 255 | @param img Pointer to input image data. It must be an array of 256 | doubles of size X x Y, and the pixel at coordinates 257 | (x,y) is obtained by img[x+y*X]. 258 | 259 | @param X X size of the image: the number of columns. 260 | 261 | @param Y Y size of the image: the number of rows. 262 | 263 | @return A double array of size 7 x n_out, containing the list 264 | of line segments detected. The array contains first 265 | 7 values of line segment number 1, then the 7 values 266 | of line segment number 2, and so on, and it finish 267 | by the 7 values of line segment number n_out. 268 | The seven values are: 269 | - x1,y1,x2,y2,width,p,-log10(NFA) 270 | . 271 | for a line segment from coordinates (x1,y1) to (x2,y2), 272 | a width 'width', an angle precision of p in (0,1) given 273 | by angle_tolerance/180 degree, and NFA value 'NFA'. 274 | If 'out' is the returned pointer, the 7 values of 275 | line segment number 'n+1' are obtained with 276 | 'out[7*n+0]' to 'out[7*n+6]'. 277 | */ 278 | double * lsd(int * n_out, double * img, int X, int Y); 279 | 280 | #endif /* !LSD_HEADER */ 281 | /*----------------------------------------------------------------------------*/ 282 | -------------------------------------------------------------------------------- /lsd_1.6/include/lsd_opencv.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 3 | // 4 | // By downloading, copying, installing or using the software you agree to this license. 5 | // If you do not agree to this license, do not download, install, 6 | // copy or use the software. 7 | // 8 | // 9 | // License Agreement 10 | // For Open Source Computer Vision Library 11 | // 12 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 13 | // Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistributions of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistributions in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the Intel Corporation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef _OPENCV_LSD_HPP_ 43 | #define _OPENCV_LSD_HPP_ 44 | #ifdef __cplusplus 45 | 46 | #include 47 | 48 | namespace cv { 49 | 50 | enum {LSD_NO_SIZE_LIMIT = -1, 51 | LSD_REFINE_NONE = 0, 52 | LSD_REFINE_STD = 1, 53 | LSD_REFINE_ADV = 2, 54 | 55 | 56 | }; 57 | 58 | class LineSegmentDetector : public Algorithm 59 | { 60 | public: 61 | /** 62 | * Detect lines in the input image with the specified ROI. 63 | * 64 | * @param _image A grayscale(CV_8UC1) input image. 65 | * If only a roi needs to be selected, use 66 | * lsd_ptr->detect(image(roi), ..., lines); 67 | * lines += Scalar(roi.x, roi.y, roi.x, roi.y); 68 | * @param _lines Return: A vector of Vec4i elements specifying the beginning and ending point of a line. 69 | * Where Vec4i is (x1, y1, x2, y2), point 1 is the start, point 2 - end. 70 | * Returned lines are strictly oriented depending on the gradient. 71 | * @param _roi Return: ROI of the image, where lines are to be found. If specified, the returning 72 | * lines coordinates are image wise. 73 | * @param width Return: Vector of widths of the regions, where the lines are found. E.g. Width of line. 74 | * @param prec Return: Vector of precisions with which the lines are found. 75 | * @param nfa Return: Vector containing number of false alarms in the line region, with precision of 10%. 76 | * The bigger the value, logarithmically better the detection. 77 | * * -1 corresponds to 10 mean false alarms 78 | * * 0 corresponds to 1 mean false alarm 79 | * * 1 corresponds to 0.1 mean false alarms 80 | * This vector will be calculated _only_ when the objects type is REFINE_ADV 81 | */ 82 | virtual void detect(InputArray _image, OutputArray _lines, 83 | OutputArray width = noArray(), OutputArray prec = noArray(), 84 | OutputArray nfa = noArray()) = 0; 85 | 86 | /** 87 | * Draw lines on the given canvas. 88 | * 89 | * @param image The image, where lines will be drawn. 90 | * Should have the size of the image, where the lines were found 91 | * @param lines The lines that need to be drawn 92 | */ 93 | virtual void drawSegments(InputOutputArray _image, InputArray lines) = 0; 94 | 95 | /** 96 | * Draw both vectors on the image canvas. Uses blue for lines 1 and red for lines 2. 97 | * 98 | * @param image The image, where lines will be drawn. 99 | * Should have the size of the image, where the lines were found. 100 | * @param lines1 The first lines that need to be drawn. Color - Blue. 101 | * @param lines2 The second lines that need to be drawn. Color - Red. 102 | * @return The number of mismatching pixels between lines1 and lines2. 103 | */ 104 | virtual int compareSegments(const Size& size, InputArray lines1, InputArray lines2, InputOutputArray _image = noArray()) = 0; 105 | 106 | /** 107 | * Find all line elements that are *not* fullfilling the angle and range requirenmnets. 108 | * Take all lines, whose angle(line_segment) is outside [min_angle, max_angle] range. 109 | * 110 | * @param lines Input lines. 111 | * @param filtered The output vector of lines not containing those fulfilling the requirement. 112 | * @param min_angle The min angle to be considered in degrees. Should be in range [0..180]. 113 | * @param max_angle The max angle to be considered in degrees. Should be >= min_angle and widthin range [0..180]. 114 | * @return Returns the number of line segments not included in the output vector. 115 | */ 116 | CV_WRAP virtual int filterOutAngle(InputArray lines, OutputArray filtered, float min_angle, float max_angle) = 0; 117 | 118 | /** 119 | * Find all line elements that are fullfilling the angle and range requirenmnets. 120 | * Take all lines, whose angle(line_segment) is inside [min_angle, max_angle] range. 121 | * The opposite of the filterOutAngle method. 122 | * 123 | * @param lines Input lines. 124 | * @param filtered The output vector of lines not containing those fulfilling the requirement. 125 | * @param min_angle The min angle to be considered in degrees. Should be in range [0..180]. 126 | * @param max_angle The max angle to be considered in degrees. Should be >= min_angle and widthin range [0..180]. 127 | * @return Returns the number of line segments not included in the output vector. 128 | */ 129 | CV_WRAP virtual int retainAngle(InputArray lines, OutputArray filtered, float min_angle, float max_angle) = 0; 130 | 131 | /** 132 | * Find all line elements that *are* fullfilling the size requirenmnets. 133 | * Lines which are shorter than max_length and longer than min_length. 134 | * 135 | * @param lines Input lines. 136 | * @param filtered The output vector of lines containing those fulfilling the requirement. 137 | * @param max_length Maximum length of the line segment. 138 | * @param min_length Minimum length of the line segment. 139 | * @return Returns the number of line segments not included in the output vector. 140 | */ 141 | CV_WRAP virtual int filterSize(InputArray lines, OutputArray filtered, float min_length, float max_length = LSD_NO_SIZE_LIMIT) = 0; 142 | 143 | /* 144 | * Find itnersection point of 2 lines. 145 | * 146 | * @param line1 First line in format Vec4i(x1, y1, x2, y2). 147 | * @param line2 Second line in the same format as line1. 148 | * @param P The point where line1 and line2 intersect. 149 | * @return The value in variable P is only valid when the return value is true. 150 | * Otherwise, the lines are parallel and the value can be ignored. 151 | */ 152 | CV_WRAP virtual bool intersection(InputArray line1, InputArray line2, Point& P) = 0; 153 | 154 | virtual ~LineSegmentDetector() {}; 155 | }; 156 | 157 | //! Returns a pointer to a LineSegmentDetector class. 158 | CV_EXPORTS Ptr createLineSegmentDetectorPtr( 159 | int _refine = LSD_REFINE_STD, double _scale = 0.8, 160 | double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5, 161 | double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024); 162 | 163 | } 164 | #endif 165 | #endif 166 | -------------------------------------------------------------------------------- /lsd_1.6/include/lsd_wrap.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * lsd_wrap.hpp 3 | * 4 | * Created on: May 17, 2013 5 | * Author: gary 6 | * 7 | * Just a simple wrap of LSD for now. If LSD is used extensively, it needs a deep re-write. 8 | * published 9 | * 2012-03-24 10 | * reference 11 | * Rafael Grompone von Gioi, Jérémie Jakubowicz, Jean-Michel Morel, and Gregory Randall, 12 | * LSD: a Line Segment Detector, Image Processing On Line, 2012. http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd 13 | * 14 | * Notes 15 | * 5/18/2013 Author of LSD, rafael grompone von gioi , has allowed the code to be BSD for OpenCV. I will 16 | * allocate Google Summer of Code students on this. 17 | * 18 | * Calling example snippet: 19 | * ======================= 20 | namedWindow("ImageL"); 21 | namedWindow("ImageS"); 22 | namedWindow("Segs"); 23 | String sseg("Segs"); 24 | int num_images = file.size(); 25 | Mat I,Isegs; 26 | int64 t_; 27 | double sum_dt_ = 0, tick_freq_ = (double)getTickFrequency(); 28 | vector segmentsSub,segmentsWhole; 29 | // Mat foo; 30 | for(int i = 0; i 0) ls.CompareSegs(foo,segmentsSub,string("Segs"),&Isegs); //Blue L, Red S 44 | // foo = ls.segments_to_image8UC1(segmentsWhole,I.size()); 45 | // ls.CompareSegs(segmentsWhole,segmentsSub,I.size(),string("Segs"),&Isegs); //Blue L, Red S 46 | 47 | //HANDLE KEY INPUT AND PAUSE 48 | int k = 0xFF&waitKey(0); 49 | * 50 | * ================================ 51 | * 52 | */ 53 | 54 | #ifndef LSD_WRAP_HPP_ 55 | #define LSD_WRAP_HPP_ 56 | #include 57 | #include 58 | #include 59 | #include 60 | 61 | //#pragma hdrstop 62 | 63 | 64 | namespace lsdwrap { 65 | 66 | /** 67 | * seg Line segment structure 68 | * A double array of size 7 x n_out, containing the list 69 | * of line segments detected. The array contains first 70 | * 7 values of line segment number 1, then the 7 values 71 | * of line segment number 2, and so on, and it finish 72 | * by the 7 values of line segment number n_out. 73 | * The seven values are: 74 | * - x1,y1,x2,y2,width,p,-log10(NFA) 75 | * . 76 | * for a line segment from coordinates (x1,y1) to (x2,y2), 77 | * NOTE: This is an oriented dark to light edge from pt1 -> pt2. +90degrees from the angle pt1->pt2 is the dark side 78 | * a width 'width', 79 | * an angle precision of p in (0,1) given by angle_tolerance/180 degree, and 80 | * Number of False Alarms (NFA) 0 <= NFA <= 2. Smaller is better 81 | */ 82 | typedef struct seg_s 83 | { 84 | float x1; //Start point of a segment 85 | float y1; 86 | float x2; //End point of a segment. +90degree from the line from pt1 -> pt2 points into dark 87 | float y2; 88 | float width; //The width of the rectangle that bounds the segment. Smaller is better 89 | float p; //Angle tollerance, default is 22.5 deg/180 deg 90 | float NFA; //Number of False Alarms (NFA) 0 <= NFA <= 2. Smaller is better 91 | } seg; 92 | 93 | 94 | /** 95 | * For rotation invariance, this class calls BarPose 3 times: 0 deg, 45 deg and 90 deg 96 | */ 97 | 98 | /////////////////////////////////////////////////////////////////////////////////// 99 | // BARCODE DETECTION CLASS //////////////////////////////////////////////////////// 100 | /////////////////////////////////////////////////////////////////////////////////// 101 | 102 | class LsdWrap 103 | { 104 | public: 105 | cv::Mat I64F; //Will convert lsd(I,...) to a gray 64 bit image here. If not allocated or the wrong size, will reallocate 106 | cv::Mat Igray; //Convert or point to gray. On multiple use, if same size, it saves on allocation 107 | 108 | /** 109 | * Find line segments 110 | * 111 | * @param I Input image, will be converted to gray, CV_64C1 112 | * @param segments Return: Vector of found line segments "seg" 113 | * @param Roi Optional region of interest to compute segments in. Smaller the image, finer the segments found 114 | * @return Return number of segments found 115 | */ 116 | int lsdw(cv::Mat &I, std::vector &segments, cv::Rect *Roi = 0); 117 | 118 | /** 119 | * Subdivide image and call by parts 120 | * Basically, this just creates Rois to break up the image into div_factor x div_factor pieces, then calls lsd(I,segmetns,ROI) above 121 | * 122 | * @param I Input image, will be converted to gray, CV_64C1 123 | * @param segments Return: Vector of found line segments "seg" 124 | * @param div_factor How many parts should image be divided into in each dimension? 2 => 4 parts, 3=>9 etc. [1,I.rows()/2] 125 | * @return Return number of segments found 126 | */ 127 | int lsd_subdivided(cv::Mat &I, std::vector &segments, int div_factor = 1); 128 | 129 | /** 130 | * Visualize segments 131 | * 132 | * @param name Name of window to display in when you declared it outside with void namedWindow(const string& winname) 133 | * @param gray Image, CV_8UC1. Will convert it to color image so that it can paint segments in red 134 | * @param segments Segments found from a call to lsd(...) 135 | */ 136 | void imshow_segs(const std::string &name, cv::Mat &gray, std::vector &segments); 137 | 138 | /** 139 | * Pass in segments and image size, return segments drawn on 8UC1 image 140 | * @param seg1 Vector of segments to be drawn 141 | * @param size width & height of image 142 | * @return Drawn image segments on CV_8UC1 image 143 | */ 144 | cv::Mat segments_to_image8UC1(std::vector &seg1, cv::Size size); 145 | 146 | /** 147 | * To help in unit tests, compare 2 different segments, one from a gray image, 1 from a list & give number of differing pixels 148 | * @param Ig CV_8UC1 image of drawn segments (drawn in blue) 149 | * @param seg2 Vector2 of segments (drawn in red) 150 | * @param size Size of images that were used to find the segment 151 | * @param name Optional name of window to display results in 152 | * @param I Optional pointer. If not null, then draw image in namedWindow(name). 153 | * @return How many points do not overlap between segments in seg1 and seg2 154 | */ 155 | int CompareSegs(cv::Mat &Ig, std::vector &seg2, const std::string &name, cv::Mat *I = 0); 156 | 157 | 158 | /** 159 | * To help in unit tests, compare 2 different segment finds 160 | * @param seg1 Vector1 of segments (drawn in blue) 161 | * @param seg2 Vector2 of segments (drawn in red) 162 | * @param size Size of images that were used to find the segment 163 | * @param name Optional name of window to display results in 164 | * @param I Optional pointer. If not null, then draw image in namedWindow(name). 165 | * @return How many points do not overlap between segments in seg1 and seg2 166 | */ 167 | int CompareSegs(std::vector &seg1,std::vector &seg2, 168 | cv::Size size, const std::string &name, cv::Mat *I = 0); 169 | 170 | }; //end class 171 | 172 | } //Namespace lsdwrap 173 | 174 | #endif /* LSD_WRAP_HPP_ */ 175 | 176 | 177 | -------------------------------------------------------------------------------- /lsd_1.6/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | include_directories(${LSD_SOURCE_DIR}/include) 4 | 5 | find_package(OpenCV REQUIRED) 6 | 7 | # Add source code properties 8 | #set_source_files_properties(lsd.c lsd_call_example.c PROPERTIES LANGUAGE CXX) 9 | 10 | add_library(lsd ${LIBRARY_TYPE} lsd.cpp) 11 | 12 | add_library(lsd_opencv ${LIBRARY_TYPE} lsd_opencv.cpp) 13 | target_link_libraries(lsd_opencv ${OpenCV_LIBS}) 14 | 15 | add_library(lsd_wrap ${LIBRARY_TYPE} lsd_wrap.cpp) 16 | target_link_libraries(lsd_wrap lsd) 17 | -------------------------------------------------------------------------------- /lsd_1.6/src/lsd_wrap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * lsd_wrap.cpp 3 | * 4 | * Created on: May 20, 2013 5 | * Author: gary 6 | */ 7 | #include "lsd_wrap.hpp" 8 | #include "lsd.hpp" 9 | 10 | using namespace cv; 11 | using namespace std; 12 | using namespace lsdwrap; 13 | /** 14 | * Find line segments 15 | * 16 | * @param I Input image. CV_8UC1 or C3 (gray or color) allowed, will be converted to gray, CV_64C1 17 | * @param segments Return: Vector of found line segments "seg" 18 | * @param Roi Optional region of interest to compute segments in. Smaller the image, finer the segments found 19 | * @return Return number of segments found (-1 => error) 20 | */ 21 | int LsdWrap::lsdw(Mat &I, std::vector &segments, cv::Rect *Roi) 22 | { 23 | //CHECKS AND CONVERSTIONS 24 | if(I.empty()) 25 | return -1; 26 | if(I.channels() == 3) 27 | { 28 | cv::cvtColor(I, Igray, CV_BGR2GRAY); 29 | } 30 | else if (I.channels() == 1) 31 | { 32 | Igray = I; //Just point to it 33 | } 34 | else 35 | return -2; 36 | if(Roi) 37 | { 38 | Mat Itmp = Igray(*Roi).clone(); 39 | Igray = Itmp; 40 | } 41 | Igray.convertTo(I64F,CV_64FC1); 42 | 43 | //DO LSD 44 | double *dp = I64F.ptr(0); 45 | int X = I64F.cols; 46 | int Y = I64F.rows; 47 | int n; 48 | double *out = lsd(&n,dp,X,Y); 49 | double *op = out; 50 | 51 | //RECORD THE RESULTS: 52 | if(0 == n) { segments.clear(); return 0;} 53 | segments.resize(n); 54 | vector::iterator it = segments.begin(), eit = segments.end(); 55 | if(Roi) //Taking a subset of the image 56 | { 57 | float ox = (float)(Roi->x);//offsets to the original boundaries 58 | float oy = (float)(Roi->y); 59 | for(; it != eit; ++it) 60 | { 61 | (*it).x1 = (float)(*op++) + ox; 62 | (*it).y1 = (float)(*op++) + oy; 63 | (*it).x2 = (float)(*op++) + ox; 64 | (*it).y2 = (float)(*op++) + oy; 65 | (*it).width = (float)(*op++); 66 | (*it).p = (float)(*op++); 67 | (*it).NFA = (float)(*op++); 68 | } 69 | } 70 | else //Do the whole image 71 | { 72 | for(; it != eit; ++it) 73 | { 74 | (*it).x1 = (float)(*op++); 75 | (*it).y1 = (float)(*op++); 76 | (*it).x2 = (float)(*op++); 77 | (*it).y2 = (float)(*op++); 78 | (*it).width = (float)(*op++); 79 | (*it).p = (float)(*op++); 80 | (*it).NFA = (float)(*op++); 81 | } 82 | } 83 | free( (void *) out ); //Clean up internal allocations 84 | return n; 85 | } 86 | 87 | /** 88 | * Subdivide image and call by parts 89 | * Basically, this just creates Rois to break up the image into div_factor x div_factor pieces, then calls lsd(I,segmetns,ROI) above 90 | * 91 | * @param I Input image, will be converted to gray, CV_64C1 92 | * @param segments Return: Vector of found line segments "seg" 93 | * @param div_factor How many parts should image be divided into in each dimension? 2 => 4 parts, 3=>9 etc. [1,I.rows()/2] 94 | * @return Return number of segments found 95 | */ 96 | int LsdWrap::lsd_subdivided(Mat &I, std::vector &segments, int div_factor) 97 | { 98 | int width = I.cols; 99 | int height = I.rows; 100 | segments.clear(); 101 | if((div_factor < 1)||(div_factor > height/2)) 102 | div_factor = 1; 103 | int dw = width/div_factor; 104 | int dh = height/div_factor; 105 | int dwo = dw/20; //overlap 106 | int dho = dh/20; //overlap 107 | int N = 0; 108 | vector segs; 109 | for(int x = 0; x < width; x += dw) 110 | { 111 | int w = dw + dwo; 112 | if(x+w >= width) 113 | { 114 | int dx = x+w-width; 115 | x -= dx/2; 116 | w = width - 1 - x; 117 | } 118 | for(int y = 0; y < height; y += dh) 119 | { 120 | int h = dh + dho; 121 | if(h+y >= height) 122 | { 123 | int dy = h+y-height; 124 | y -= dy/2; 125 | h = height - 1 - y; 126 | } 127 | Rect R(x,y,w,h); 128 | N += lsdw(I,segs,&R); 129 | segments.insert(segments.end(),segs.begin(),segs.end()); 130 | } 131 | } 132 | return N; 133 | } 134 | 135 | /** 136 | * Visualize segments 137 | * 138 | * @param name Name of window to display in when you declared it outside with void namedWindow(const string& winname) 139 | * @param gray Image, CV_8UC1. Will convert it to color image so that it can paint segments in red 140 | * @param segments Segments found from a call to lsd(...) 141 | */ 142 | void LsdWrap::imshow_segs(const std::string &name, Mat &gray, std::vector &segments) 143 | { 144 | Mat Ig; 145 | if(gray.empty()) 146 | return; 147 | if(gray.channels() == 3) 148 | { 149 | cv::cvtColor(gray, Ig, CV_BGR2GRAY); 150 | } 151 | else if (gray.channels() == 1) 152 | { 153 | Ig = gray; //Just point to it 154 | } 155 | else 156 | return; 157 | //Create 3 channel image so we can draw colored line segments on the gray scale image 158 | vector planes; 159 | planes.push_back(Ig); 160 | planes.push_back(Ig); 161 | planes.push_back(Ig); 162 | //Merge them into a color image 163 | Mat combine; 164 | merge(planes,combine); 165 | //draw segments ... 166 | vector::iterator it = segments.begin(), eit = segments.end(); 167 | for(; it != eit; ++it) 168 | { 169 | Point p1((int)((*it).x1 + 0.5), (int)((*it).y1 + 0.5)); 170 | Point p2((int)((*it).x2 + 0.5), (int)((*it).y2 + 0.5)); 171 | line(combine,p1,p2,Scalar(0,0,255),2); 172 | } 173 | //and display ... 174 | imshow(name.c_str(),combine); 175 | } 176 | 177 | 178 | /** 179 | * To help in unit tests, compare 2 different segment finds 180 | * @param seg1 Vector1 of segments (in Blue) 181 | * @param seg2 Vector2 of segments (in Red) 182 | * @param size Size of images that were used to find the segment 183 | * @param name Optional name of window to display results in 184 | * @param I Optional pointer. If not null, then draw image in namedWindow(name). 185 | * @return How many points do not overlap between segments in seg1 and seg2 186 | */ 187 | int LsdWrap::CompareSegs(std::vector &seg1,std::vector &seg2, 188 | cv::Size size, const std::string &name, cv::Mat *I) 189 | { 190 | //SET UP AND SIZE 191 | Mat I1, I2; 192 | if(I && size != I->size()) size = I->size(); 193 | I1 = Mat(size,CV_8UC1,Scalar::all(0)); 194 | I2 = Mat(size,CV_8UC1,Scalar::all(0)); 195 | 196 | //DRAW SEGMENTS 197 | vector::iterator it = seg1.begin(), eit = seg1.end(); 198 | for(; it != eit; ++it) 199 | { 200 | Point p1((int)((*it).x1 + 0.5), (int)((*it).y1 + 0.5)); 201 | Point p2((int)((*it).x2 + 0.5), (int)((*it).y2 + 0.5)); 202 | line(I1,p1,p2,Scalar::all(255),1); 203 | } 204 | it = seg2.begin(); 205 | eit = seg2.end(); 206 | for(; it != eit; ++it) 207 | { 208 | Point p1((int)((*it).x1 + 0.5), (int)((*it).y1 + 0.5)); 209 | Point p2((int)((*it).x2 + 0.5), (int)((*it).y2 + 0.5)); 210 | line(I2,p1,p2,Scalar::all(255),1); 211 | } 212 | 213 | //MARKPLACES WHERE THEY DO NOT AGREE 214 | Mat Ixor; 215 | bitwise_xor(I1, I2, Ixor); 216 | int N = countNonZero(Ixor); //This is the missmatch number 217 | 218 | //DRAW IT IF ASKED 219 | if(I) 220 | { 221 | Mat Ig; 222 | if(size != I->size()) 223 | { 224 | *I = Mat(size,CV_8UC1,Scalar::all(0)); 225 | } 226 | if(I->channels() == 3) 227 | { 228 | cv::cvtColor(*I, Ig, CV_BGR2GRAY); 229 | } 230 | else if (I->channels() == 1) 231 | { 232 | Ig = *I; //Just point to it 233 | } 234 | else 235 | return -2; 236 | //Create 3 channel image so we can draw colored line segments on the gray scale image 237 | vector planes; 238 | planes.push_back(I1); 239 | planes.push_back(Ig); 240 | planes.push_back(I2); 241 | //Merge them into a color image 242 | Mat combine; 243 | merge(planes,combine); 244 | imshow(name.c_str(),combine); //Show it 245 | } 246 | 247 | //DONE 248 | return(N); 249 | } 250 | 251 | /** 252 | * To help in unit tests, compare 2 different segments, one from a gray image, 1 from a 253 | * list & give number of differing pixels 254 | * @param Ig CV_8UC1 image of drawn segments (Blue) 255 | * @param seg2 Vector2 of segments (Red) 256 | * @param size Size of images that were used to find the segment 257 | * @param name Optional name of window to display results in 258 | * @param I Optional pointer. If not null, then draw image in namedWindow(name). 259 | * @return How many points do not overlap between segments in seg1 and seg2 260 | */ 261 | int LsdWrap::CompareSegs(cv::Mat &Ig, std::vector &seg2, const std::string &name, cv::Mat *I) 262 | { 263 | //SET UP AND SIZE 264 | Mat I1,I2; 265 | 266 | //GET SEGMETNS 1 267 | if(Ig.empty()) 268 | return -1; 269 | if(Ig.channels() == 3) 270 | { 271 | cv::cvtColor(Ig, I1, CV_BGR2GRAY); 272 | } 273 | else if (Ig.channels() == 1) 274 | { 275 | I1 = Ig; //Just point to it 276 | } 277 | else 278 | return -2; 279 | I2 = Mat(Ig.size(),CV_8UC1,Scalar::all(0)); 280 | 281 | //DRAW SEGMENTS 2 282 | vector::iterator it = seg2.begin(), eit = seg2.end(); 283 | for(; it != eit; ++it) 284 | { 285 | Point p1((int)((*it).x1 + 0.5), (int)((*it).y1 + 0.5)); 286 | Point p2((int)((*it).x2 + 0.5), (int)((*it).y2 + 0.5)); 287 | line(I2,p1,p2,Scalar::all(255),1); 288 | } 289 | 290 | //MARKPLACES WHERE THEY DO NOT AGREE 291 | Mat Ixor; 292 | bitwise_xor(I1, I2, Ixor); 293 | int N = countNonZero(Ixor); //This is the missmatch number 294 | 295 | //DRAW IT IF ASKED 296 | if(I) 297 | { 298 | if(Ig.size() != I->size()) 299 | { 300 | *I = Ig.clone(); 301 | I->setTo(Scalar::all(0)); 302 | } 303 | Mat Igreen; 304 | if(I->channels() == 3) 305 | { 306 | cv::cvtColor(*I, Igreen, CV_BGR2GRAY); 307 | } 308 | else if (I->channels() == 1) 309 | { 310 | Igreen = *I; //Just point to it 311 | } 312 | else 313 | return -2; 314 | //Create 3 channel image so we can draw colored line segments on the gray scale image 315 | vector planes; 316 | planes.push_back(I1); 317 | planes.push_back(Igreen); 318 | planes.push_back(I2); 319 | //Merge them into a color image 320 | Mat combine; 321 | merge(planes,combine); 322 | imshow(name.c_str(),combine); //Show it 323 | } 324 | 325 | //DONE 326 | return(N); 327 | } 328 | 329 | 330 | /** 331 | * Pass in segments and image size, return segments drawn on 8UC1 image 332 | * @param seg1 Vector of segments to be drawn 333 | * @param size width & height of image 334 | * @return Drawn image segments on CV_8UC1 image 335 | */ 336 | cv::Mat LsdWrap::segments_to_image8UC1(std::vector &seg1, cv::Size size) 337 | { 338 | Mat I1(size,CV_8UC1,Scalar::all(0)); //allocate an image, set it to zero 339 | 340 | //DRAW SEGMENTS 341 | vector::iterator it = seg1.begin(), eit = seg1.end(); 342 | for(; it != eit; ++it) 343 | { 344 | Point p1((int)((*it).x1 + 0.5), (int)((*it).y1 + 0.5)); 345 | Point p2((int)((*it).x2 + 0.5), (int)((*it).y2 + 0.5)); 346 | line(I1,p1,p2,Scalar::all(255),1); 347 | } 348 | return I1; 349 | } 350 | 351 | -------------------------------------------------------------------------------- /lsd_1.6/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | # Add Libraries 4 | include_directories(${LSD_SOURCE_DIR}/libs) 5 | include_directories(${LSD_SOURCE_DIR}/include) 6 | 7 | find_package(OpenCV REQUIRED) 8 | 9 | add_executable(visual_test visual_test.cpp) 10 | target_link_libraries(visual_test lsd_opencv lsd_wrap ${OpenCV_LIBS}) 11 | 12 | add_executable(houghlines_cmp houghlines.cpp) 13 | target_link_libraries(houghlines_cmp ${OpenCV_LIBS}) 14 | 15 | add_executable(accuracy_test accuracy_test.cpp) 16 | target_link_libraries(accuracy_test ${OpenCV_LIBS} lsd_opencv) 17 | 18 | add_executable(perf_test perf_test.cpp) 19 | target_link_libraries(perf_test ${OpenCV_LIBS} lsd_opencv lsd_wrap) 20 | -------------------------------------------------------------------------------- /lsd_1.6/tests/accuracy_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | using namespace cv; 9 | 10 | const Size sz(640, 480); 11 | 12 | void checkConstantColor() 13 | { 14 | RNG rng(getTickCount()); 15 | Mat constColor(sz, CV_8UC1, Scalar::all(rng.uniform(0, 256))); 16 | 17 | vector lines; 18 | Ptr ls = createLineSegmentDetectorPtr(); 19 | ls->detect(constColor, lines); 20 | 21 | Mat drawnLines = Mat::zeros(constColor.size(), CV_8UC1); 22 | ls->drawSegments(drawnLines, lines); 23 | imshow("checkConstantColor", drawnLines); 24 | 25 | std::cout << "Constant Color - Number of lines: " << lines.size() << " - 0 Wanted." << std::endl; 26 | } 27 | 28 | void checkWhiteNoise() 29 | { 30 | //Generate white noise image 31 | Mat white_noise(sz, CV_8UC1); 32 | RNG rng(getTickCount()); 33 | rng.fill(white_noise, RNG::UNIFORM, 0, 256); 34 | 35 | vector lines; 36 | Ptr ls = createLineSegmentDetectorPtr(); 37 | ls->detect(white_noise, lines); 38 | 39 | Mat drawnLines = white_noise.clone(); //Mat::zeros(white_noise.size(), CV_8UC1); 40 | ls->drawSegments(drawnLines, lines); 41 | imshow("checkWhiteNoise", drawnLines); 42 | 43 | std::cout << "White Noise - Number of lines: " << lines.size() << " - 0 Wanted." << std::endl; 44 | } 45 | 46 | void checkRotatedRectangle() 47 | { 48 | RNG rng(getTickCount()); 49 | Mat filledRect = Mat::zeros(sz, CV_8UC1); 50 | 51 | Point center(rng.uniform(sz.width/4, sz.width*3/4), 52 | rng.uniform(sz.height/4, sz.height*3/4)); 53 | Size rect_size(rng.uniform(sz.width/8, sz.width/6), 54 | rng.uniform(sz.height/8, sz.height/6)); 55 | float angle = rng.uniform(0, 360); 56 | 57 | Point2f vertices[4]; 58 | 59 | RotatedRect rRect = RotatedRect(center, rect_size, angle); 60 | 61 | rRect.points(vertices); 62 | for (int i = 0; i < 4; i++) 63 | { 64 | line(filledRect, vertices[i], vertices[(i + 1) % 4], Scalar(255), 3); 65 | } 66 | 67 | vector lines; 68 | Ptr ls = createLineSegmentDetectorPtr(LSD_REFINE_ADV); 69 | ls->detect(filledRect, lines); 70 | 71 | Mat drawnLines = Mat::zeros(filledRect.size(), CV_8UC1); 72 | ls->drawSegments(drawnLines, lines); 73 | imshow("checkRotatedRectangle", drawnLines); 74 | 75 | std::cout << "Check Rectangle- Number of lines: " << lines.size() << " - >= 4 Wanted." << std::endl; 76 | } 77 | 78 | void checkLines() 79 | { 80 | RNG rng(getTickCount()); 81 | Mat horzLines(sz, CV_8UC1, Scalar::all(rng.uniform(0, 128))); 82 | 83 | const int numLines = 3; 84 | for(unsigned int i = 0; i < numLines; ++i) 85 | { 86 | int y = rng.uniform(10, sz.width - 10); 87 | Point p1(y, 10); 88 | Point p2(y, sz.height - 10); 89 | line(horzLines, p1, p2, Scalar(255), 3); 90 | } 91 | 92 | vector lines; 93 | Ptr ls = createLineSegmentDetectorPtr(LSD_REFINE_NONE); 94 | ls->detect(horzLines, lines); 95 | 96 | Mat drawnLines = Mat::zeros(horzLines.size(), CV_8UC1); 97 | ls->drawSegments(drawnLines, lines); 98 | imshow("checkLines", drawnLines); 99 | 100 | std::cout << "Lines Check - Number of lines: " << lines.size() << " - " << numLines * 2 << " Wanted." << std::endl; 101 | } 102 | 103 | int main() 104 | { 105 | checkWhiteNoise(); 106 | checkConstantColor(); 107 | checkRotatedRectangle(); 108 | for (int i = 0; i < 10; ++i) 109 | { 110 | checkLines(); 111 | } 112 | checkLines(); 113 | cv::waitKey(); 114 | return 0; 115 | } -------------------------------------------------------------------------------- /lsd_1.6/tests/houghlines.cpp: -------------------------------------------------------------------------------- 1 | #include "opencv2/highgui/highgui.hpp" 2 | #include "opencv2/imgproc/imgproc.hpp" 3 | 4 | #include 5 | 6 | using namespace cv; 7 | using namespace std; 8 | 9 | static void help() 10 | { 11 | cout << "\nThis program demonstrates line finding with the Hough transform.\n" 12 | "Usage:\n" 13 | "./houghlines , Default is chairs.pgm\n" << endl; 14 | } 15 | 16 | int main(int argc, char** argv) 17 | { 18 | const char* filename = argc >= 2 ? argv[1] : "./../images/chairs.pgm"; 19 | 20 | Mat src = imread(filename, 0); 21 | if(src.empty()) 22 | { 23 | help(); 24 | cout << "can not open " << filename << endl; 25 | return -1; 26 | } 27 | 28 | Mat dst, cdst; 29 | Canny(src, dst, 50, 200, 3); 30 | cvtColor(dst, cdst, COLOR_GRAY2BGR); 31 | 32 | #if 0 33 | vector lines; 34 | HoughLines(dst, lines, 1, CV_PI/180, 100, 0, 0 ); 35 | 36 | for( size_t i = 0; i < lines.size(); i++ ) 37 | { 38 | float rho = lines[i][0], theta = lines[i][1]; 39 | Point pt1, pt2; 40 | double a = cos(theta), b = sin(theta); 41 | double x0 = a*rho, y0 = b*rho; 42 | pt1.x = cvRound(x0 + 1000*(-b)); 43 | pt1.y = cvRound(y0 + 1000*(a)); 44 | pt2.x = cvRound(x0 - 1000*(-b)); 45 | pt2.y = cvRound(y0 - 1000*(a)); 46 | line( cdst, pt1, pt2, Scalar(0,0,255), 1, CV_AA); 47 | } 48 | #else 49 | vector lines; 50 | double start = double(getTickCount()); 51 | HoughLinesP(dst, lines, 1, CV_PI/180, 50, 50, 10 ); 52 | double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 53 | std::cout << "Hough Lines: " << lines.size() <<" segments found. For " << duration_ms << " ms." << std::endl; 54 | 55 | for( size_t i = 0; i < lines.size(); i++ ) 56 | { 57 | Vec4i l = lines[i]; 58 | line( cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0,0,255), 1, CV_AA); 59 | } 60 | #endif 61 | 62 | imshow("source", src); 63 | imshow("detected lines", cdst); 64 | 65 | waitKey(); 66 | 67 | return 0; 68 | } 69 | 70 | -------------------------------------------------------------------------------- /lsd_1.6/tests/perf_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "lsd_wrap.hpp" 6 | #include "lsd_opencv.hpp" 7 | #include "opencv2/core/core.hpp" 8 | 9 | using namespace std; 10 | using namespace cv; 11 | using namespace lsdwrap; 12 | 13 | const int REPEAT_CYCLE = 10; 14 | 15 | int main(int argc, char** argv) 16 | { 17 | if (argc != 2) 18 | { 19 | std::cout << "perf_test [in]" << std::endl 20 | << "\tin - input image" << std::endl; 21 | return false; 22 | } 23 | 24 | std::string in = argv[1]; 25 | 26 | Mat image = imread(in, CV_LOAD_IMAGE_GRAYSCALE); 27 | std::cout << "Input image size: " << image.size() << std::endl; 28 | std::cout << "Time averaged over " << REPEAT_CYCLE << " iterations." << std::endl; 29 | 30 | // 31 | // LSD 1.6 test 32 | // 33 | LsdWrap lsd_old; 34 | double start = double(getTickCount()); 35 | for(unsigned int i = 0; i < REPEAT_CYCLE; ++i) 36 | { 37 | vector seg_old; 38 | lsd_old.lsdw(image, seg_old); 39 | } 40 | double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 41 | std::cout << "lsd 1.6 - " << double(duration_ms)/REPEAT_CYCLE << " ms." << std::endl; 42 | 43 | // 44 | // OpenCV LSD ADV settings test 45 | // 46 | Ptr lsd_adv = createLineSegmentDetectorPtr(LSD_REFINE_ADV); 47 | start = double(getTickCount()); 48 | for(unsigned int i = 0; i < REPEAT_CYCLE; ++i) 49 | { 50 | vector lines; 51 | lsd_adv->detect(image, lines); 52 | } 53 | duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 54 | std::cout << "OpenCV ADV - " << double(duration_ms)/REPEAT_CYCLE << " ms." << std::endl; 55 | 56 | // 57 | // OpenCV LSD STD settings test 58 | // 59 | Ptr lsd_std = createLineSegmentDetectorPtr(LSD_REFINE_STD); 60 | start = double(getTickCount()); 61 | for(unsigned int i = 0; i < REPEAT_CYCLE; ++i) 62 | { 63 | vector lines; 64 | lsd_std->detect(image, lines); 65 | } 66 | duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 67 | std::cout << "OpenCV STD - " << double(duration_ms)/REPEAT_CYCLE << " ms." << std::endl; 68 | 69 | // 70 | // OpenCV LSD NO refinement settings test 71 | // 72 | Ptr lsd_no = createLineSegmentDetectorPtr(LSD_REFINE_NONE); // Do not refine lines 73 | start = double(getTickCount()); 74 | for(unsigned int i = 0; i < REPEAT_CYCLE; ++i) 75 | { 76 | vector lines; 77 | lsd_no->detect(image, lines); 78 | } 79 | duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 80 | std::cout << "OpenCV NO - " << double(duration_ms)/REPEAT_CYCLE << " ms." << std::endl; 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /lsd_1.6/tests/visual_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "lsd_wrap.hpp" 6 | #include "lsd_opencv.hpp" 7 | #include "opencv2/core/core.hpp" 8 | 9 | using namespace std; 10 | using namespace cv; 11 | using namespace lsdwrap; 12 | 13 | int main(int argc, char** argv) 14 | { 15 | if (argc != 2) 16 | { 17 | std::cout << "visual_test [in]" << std::endl 18 | << "\tin - input image" << std::endl; 19 | return false; 20 | } 21 | 22 | std::string in = argv[1]; 23 | 24 | Mat image = imread(in, CV_LOAD_IMAGE_GRAYSCALE); 25 | //imshow("Input image", image); 26 | 27 | // 28 | // LSD 1.6 test 29 | // 30 | LsdWrap lsd_old; 31 | vector seg_old; 32 | double start = double(getTickCount()); 33 | lsd_old.lsdw(image, seg_old); 34 | //lsd_old.lsd_subdivided(image, seg_old, 3); 35 | double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 36 | std::cout << "lsd 1.6 - blue\n\t" << seg_old.size() <<" line segments found. For " << duration_ms << " ms." << std::endl; 37 | 38 | // 39 | // OpenCV LSD 40 | // 41 | // LineSegmentDetector lsd_cv(LSD_NO_REFINE); // Do not refine lines 42 | Ptr lsd_cv = createLineSegmentDetectorPtr(); 43 | vector lines; 44 | 45 | std::vector width, prec, nfa; 46 | start = double(getTickCount()); 47 | 48 | std::cout << "Before" << std::endl; 49 | lsd_cv->detect(image, lines); 50 | std::cout << "After" << std::endl; 51 | 52 | duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); 53 | std::cout << "OpenCV lsd - red\n\t" << lines.size() <<" line segments found. For " << duration_ms << " ms." << std::endl; 54 | 55 | //Copy the old structure to the new 56 | vector seg_cvo(seg_old.size()); 57 | for(unsigned int i = 0; i < seg_old.size(); ++i) 58 | { 59 | seg_cvo[i][0] = seg_old[i].x1; 60 | seg_cvo[i][1] = seg_old[i].y1; 61 | seg_cvo[i][2] = seg_old[i].x2; 62 | seg_cvo[i][3] = seg_old[i].y2; 63 | } 64 | 65 | // 66 | // Show difference 67 | // 68 | Mat drawnLines(image); 69 | lsd_cv->drawSegments(drawnLines, lines); 70 | imshow("Drawing segments", drawnLines); 71 | 72 | Mat difference = Mat::zeros(image.size(), CV_8UC3); 73 | int d = lsd_cv->compareSegments(image.size(), seg_cvo, lines, difference); 74 | imshow("Segments difference", difference); 75 | std::cout << "There are " << d << " not overlapping pixels." << std::endl; 76 | waitKey(0); // wait for human action 77 | 78 | return 0; 79 | } 80 | --------------------------------------------------------------------------------