├── .gitattributes ├── 3dmap_set-bckup.yml ├── 3dmap_set.yml ├── LICENSE ├── README.md ├── bin ├── frame.jpg ├── script1.bin ├── script2.bin ├── script3.bin ├── script4.bin ├── script5.bin ├── script51.bin ├── script6.bin └── script7.bin ├── bug-photos ├── left_47.png ├── right_47.png └── scene_1280x480_47.png ├── calibration_data ├── calibration_camera_240_left.yml ├── calibration_camera_240_right.yml └── stereo_camera_calibration240.yml ├── pairs ├── left_1.png ├── left_10.png ├── left_11.png ├── left_12.png ├── left_13.png ├── left_14.png ├── left_15.png ├── left_16.png ├── left_17.png ├── left_18.png ├── left_19.png ├── left_2.png ├── left_20.png ├── left_21.png ├── left_22.png ├── left_23.png ├── left_24.png ├── left_25.png ├── left_26.png ├── left_27.png ├── left_28.png ├── left_29.png ├── left_3.png ├── left_34.png ├── left_35.png ├── left_36.png ├── left_37.png ├── left_4.png ├── left_40.png ├── left_41.png ├── left_42.png ├── left_43.png ├── left_44.png ├── left_45.png ├── left_46.png ├── left_48.png ├── left_49.png ├── left_5.png ├── left_50.png ├── left_6.png ├── left_7.png ├── left_8.png ├── left_9.png ├── right_1.png ├── right_10.png ├── right_11.png ├── right_12.png ├── right_13.png ├── right_14.png ├── right_15.png ├── right_16.png ├── right_17.png ├── right_18.png ├── right_19.png ├── right_2.png ├── right_20.png ├── right_21.png ├── right_22.png ├── right_23.png ├── right_24.png ├── right_25.png ├── right_26.png ├── right_27.png ├── right_28.png ├── right_29.png ├── right_3.png ├── right_30.png ├── right_31.png ├── right_32.png ├── right_33.png ├── right_34.png ├── right_35.png ├── right_36.png ├── right_37.png ├── right_38.png ├── right_39.png ├── right_4.png ├── right_40.png ├── right_41.png ├── right_42.png ├── right_43.png ├── right_44.png ├── right_45.png ├── right_46.png ├── right_47.png ├── right_48.png ├── right_49.png ├── right_5.png ├── right_50.png ├── right_6.png ├── right_7.png ├── right_8.png └── right_9.png ├── scenes ├── scene_1280x480_1.png ├── scene_1280x480_10.png ├── scene_1280x480_11.png ├── scene_1280x480_12.png ├── scene_1280x480_13.png ├── scene_1280x480_14.png ├── scene_1280x480_15.png ├── scene_1280x480_16.png ├── scene_1280x480_17.png ├── scene_1280x480_18.png ├── scene_1280x480_19.png ├── scene_1280x480_2.png ├── scene_1280x480_20.png ├── scene_1280x480_21.png ├── scene_1280x480_22.png ├── scene_1280x480_23.png ├── scene_1280x480_24.png ├── scene_1280x480_25.png ├── scene_1280x480_26.png ├── scene_1280x480_27.png ├── scene_1280x480_28.png ├── scene_1280x480_29.png ├── scene_1280x480_3.png ├── scene_1280x480_30.png ├── scene_1280x480_31.png ├── scene_1280x480_32.png ├── scene_1280x480_33.png ├── scene_1280x480_34.png ├── scene_1280x480_35.png ├── scene_1280x480_36.png ├── scene_1280x480_37.png ├── scene_1280x480_38.png ├── scene_1280x480_39.png ├── scene_1280x480_4.png ├── scene_1280x480_40.png ├── scene_1280x480_41.png ├── scene_1280x480_42.png ├── scene_1280x480_43.png ├── scene_1280x480_44.png ├── scene_1280x480_45.png ├── scene_1280x480_46.png ├── scene_1280x480_47.png ├── scene_1280x480_48.png ├── scene_1280x480_49.png ├── scene_1280x480_5.png ├── scene_1280x480_50.png ├── scene_1280x480_6.png ├── scene_1280x480_7.png ├── scene_1280x480_8.png └── scene_1280x480_9.png ├── src ├── script1.cpp ├── script2.cpp ├── script4.cpp ├── script5.cpp ├── script6.cpp └── script7.cpp ├── undistorted_left.jpg └── undistorted_right.jpg /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /3dmap_set-bckup.yml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | --- 3 | SWS: 5 4 | PFS: 5 5 | preFiltCap: 29 6 | minDisp: -10 7 | numOfDisp: 32 8 | TxtrThrshld: 100 9 | unicRatio: 10 10 | SpcklRng: 15 11 | SpklWinSze: 100 12 | -------------------------------------------------------------------------------- /3dmap_set.yml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | --- 3 | SWS: 5 4 | PFS: 5 5 | preFiltCap: 29 6 | minDisp: -10 7 | numOfDisp: 32 8 | TxtrThrshld: 100 9 | unicRatio: 10 10 | SpcklRng: 15 11 | SpklWinSze: 100 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # stereopi-cpp-tutorial 2 | Basic C++ code for Python vs C++ OpenCV performance comparison 3 | 4 | This code is a port from Python scripts (https://github.com/realizator/stereopi-fisheye-robot) 5 | for this article: 6 | 7 | https://stereopi.com/blog/opencv-comparing-speed-c-and-python-code-raspberry-pi-stereo-vision 8 | 9 | Link to the Raspbian image (Buster, Python and C++ code): 10 | https://drive.google.com/file/d/1xlkvZMl9gJGm4Gy1oVlGknHywDnvy5gS/view?usp=sharing 11 | 12 | -------------------------------------------------------------------------------- /bin/frame.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bin/frame.jpg -------------------------------------------------------------------------------- /bin/script1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bin/script1.bin -------------------------------------------------------------------------------- /bin/script2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bin/script2.bin -------------------------------------------------------------------------------- /bin/script3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bin/script3.bin -------------------------------------------------------------------------------- /bin/script4.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bin/script4.bin -------------------------------------------------------------------------------- /bin/script5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bin/script5.bin -------------------------------------------------------------------------------- /bin/script51.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bin/script51.bin -------------------------------------------------------------------------------- /bin/script6.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bin/script6.bin -------------------------------------------------------------------------------- /bin/script7.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bin/script7.bin -------------------------------------------------------------------------------- /bug-photos/left_47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bug-photos/left_47.png -------------------------------------------------------------------------------- /bug-photos/right_47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bug-photos/right_47.png -------------------------------------------------------------------------------- /bug-photos/scene_1280x480_47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/bug-photos/scene_1280x480_47.png -------------------------------------------------------------------------------- /pairs/left_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_1.png -------------------------------------------------------------------------------- /pairs/left_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_10.png -------------------------------------------------------------------------------- /pairs/left_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_11.png -------------------------------------------------------------------------------- /pairs/left_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_12.png -------------------------------------------------------------------------------- /pairs/left_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_13.png -------------------------------------------------------------------------------- /pairs/left_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_14.png -------------------------------------------------------------------------------- /pairs/left_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_15.png -------------------------------------------------------------------------------- /pairs/left_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_16.png -------------------------------------------------------------------------------- /pairs/left_17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_17.png -------------------------------------------------------------------------------- /pairs/left_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_18.png -------------------------------------------------------------------------------- /pairs/left_19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_19.png -------------------------------------------------------------------------------- /pairs/left_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_2.png -------------------------------------------------------------------------------- /pairs/left_20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_20.png -------------------------------------------------------------------------------- /pairs/left_21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_21.png -------------------------------------------------------------------------------- /pairs/left_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_22.png -------------------------------------------------------------------------------- /pairs/left_23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_23.png -------------------------------------------------------------------------------- /pairs/left_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_24.png -------------------------------------------------------------------------------- /pairs/left_25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_25.png -------------------------------------------------------------------------------- /pairs/left_26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_26.png -------------------------------------------------------------------------------- /pairs/left_27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_27.png -------------------------------------------------------------------------------- /pairs/left_28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_28.png -------------------------------------------------------------------------------- /pairs/left_29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_29.png -------------------------------------------------------------------------------- /pairs/left_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_3.png -------------------------------------------------------------------------------- /pairs/left_34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_34.png -------------------------------------------------------------------------------- /pairs/left_35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_35.png -------------------------------------------------------------------------------- /pairs/left_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_36.png -------------------------------------------------------------------------------- /pairs/left_37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_37.png -------------------------------------------------------------------------------- /pairs/left_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_4.png -------------------------------------------------------------------------------- /pairs/left_40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_40.png -------------------------------------------------------------------------------- /pairs/left_41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_41.png -------------------------------------------------------------------------------- /pairs/left_42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_42.png -------------------------------------------------------------------------------- /pairs/left_43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_43.png -------------------------------------------------------------------------------- /pairs/left_44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_44.png -------------------------------------------------------------------------------- /pairs/left_45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_45.png -------------------------------------------------------------------------------- /pairs/left_46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_46.png -------------------------------------------------------------------------------- /pairs/left_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_48.png -------------------------------------------------------------------------------- /pairs/left_49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_49.png -------------------------------------------------------------------------------- /pairs/left_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_5.png -------------------------------------------------------------------------------- /pairs/left_50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_50.png -------------------------------------------------------------------------------- /pairs/left_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_6.png -------------------------------------------------------------------------------- /pairs/left_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_7.png -------------------------------------------------------------------------------- /pairs/left_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_8.png -------------------------------------------------------------------------------- /pairs/left_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/left_9.png -------------------------------------------------------------------------------- /pairs/right_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_1.png -------------------------------------------------------------------------------- /pairs/right_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_10.png -------------------------------------------------------------------------------- /pairs/right_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_11.png -------------------------------------------------------------------------------- /pairs/right_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_12.png -------------------------------------------------------------------------------- /pairs/right_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_13.png -------------------------------------------------------------------------------- /pairs/right_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_14.png -------------------------------------------------------------------------------- /pairs/right_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_15.png -------------------------------------------------------------------------------- /pairs/right_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_16.png -------------------------------------------------------------------------------- /pairs/right_17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_17.png -------------------------------------------------------------------------------- /pairs/right_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_18.png -------------------------------------------------------------------------------- /pairs/right_19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_19.png -------------------------------------------------------------------------------- /pairs/right_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_2.png -------------------------------------------------------------------------------- /pairs/right_20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_20.png -------------------------------------------------------------------------------- /pairs/right_21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_21.png -------------------------------------------------------------------------------- /pairs/right_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_22.png -------------------------------------------------------------------------------- /pairs/right_23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_23.png -------------------------------------------------------------------------------- /pairs/right_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_24.png -------------------------------------------------------------------------------- /pairs/right_25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_25.png -------------------------------------------------------------------------------- /pairs/right_26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_26.png -------------------------------------------------------------------------------- /pairs/right_27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_27.png -------------------------------------------------------------------------------- /pairs/right_28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_28.png -------------------------------------------------------------------------------- /pairs/right_29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_29.png -------------------------------------------------------------------------------- /pairs/right_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_3.png -------------------------------------------------------------------------------- /pairs/right_30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_30.png -------------------------------------------------------------------------------- /pairs/right_31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_31.png -------------------------------------------------------------------------------- /pairs/right_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_32.png -------------------------------------------------------------------------------- /pairs/right_33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_33.png -------------------------------------------------------------------------------- /pairs/right_34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_34.png -------------------------------------------------------------------------------- /pairs/right_35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_35.png -------------------------------------------------------------------------------- /pairs/right_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_36.png -------------------------------------------------------------------------------- /pairs/right_37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_37.png -------------------------------------------------------------------------------- /pairs/right_38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_38.png -------------------------------------------------------------------------------- /pairs/right_39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_39.png -------------------------------------------------------------------------------- /pairs/right_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_4.png -------------------------------------------------------------------------------- /pairs/right_40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_40.png -------------------------------------------------------------------------------- /pairs/right_41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_41.png -------------------------------------------------------------------------------- /pairs/right_42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_42.png -------------------------------------------------------------------------------- /pairs/right_43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_43.png -------------------------------------------------------------------------------- /pairs/right_44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_44.png -------------------------------------------------------------------------------- /pairs/right_45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_45.png -------------------------------------------------------------------------------- /pairs/right_46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_46.png -------------------------------------------------------------------------------- /pairs/right_47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_47.png -------------------------------------------------------------------------------- /pairs/right_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_48.png -------------------------------------------------------------------------------- /pairs/right_49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_49.png -------------------------------------------------------------------------------- /pairs/right_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_5.png -------------------------------------------------------------------------------- /pairs/right_50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_50.png -------------------------------------------------------------------------------- /pairs/right_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_6.png -------------------------------------------------------------------------------- /pairs/right_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_7.png -------------------------------------------------------------------------------- /pairs/right_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_8.png -------------------------------------------------------------------------------- /pairs/right_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/pairs/right_9.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_1.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_10.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_11.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_12.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_13.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_14.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_15.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_16.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_17.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_18.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_19.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_2.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_20.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_21.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_22.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_23.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_24.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_25.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_26.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_27.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_28.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_29.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_3.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_30.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_31.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_32.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_33.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_34.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_35.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_36.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_37.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_38.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_39.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_4.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_40.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_41.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_42.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_43.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_44.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_45.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_46.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_47.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_48.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_49.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_5.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_50.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_6.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_7.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_8.png -------------------------------------------------------------------------------- /scenes/scene_1280x480_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/scenes/scene_1280x480_9.png -------------------------------------------------------------------------------- /src/script1.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Eugene a.k.a. Realizator, stereopi.com, virt2real team 2 | // Ported from Python to C++ by Konstantin Ozernov on 10/10/2019. 3 | // 4 | // This file is part of StereoPi С++ tutorial scripts, and has been 5 | // ported from Pyton version (https://github.com/realizator/stereopi-fisheye-robot) 6 | // 7 | // StereoPi tutorial is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation, either version 3 of the 10 | // License, or (at your option) any later version. 11 | // 12 | // StereoPi tutorial is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with StereoPi tutorial. 19 | // If not, see . 20 | // 21 | 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | long long getTimestamp() 31 | { 32 | const std::chrono::time_point now = std::chrono::system_clock::now(); 33 | const std::chrono::microseconds epoch = std::chrono::duration_cast(now.time_since_epoch()); 34 | return epoch.count(); 35 | } 36 | 37 | std::string folder_name = "/home/pi/stereopi-cpp-tutorial/"; 38 | 39 | int main() 40 | { 41 | fprintf(stderr, "You can press 'Q' to quit this script.\n"); 42 | 43 | int imgWidth = 1280; 44 | int imgHeight = 480; 45 | 46 | fprintf(stderr, "Camera resolution: %d x %d\n", imgWidth, imgHeight); 47 | 48 | FILE *fp; 49 | if ((fp = fopen("/dev/stdin", "rb")) == NULL) 50 | { 51 | fprintf(stderr, "Cannot open input file!\n"); 52 | return 1; 53 | } 54 | 55 | int bufLen = imgWidth * imgHeight; 56 | char *buf = (char *)malloc(bufLen); 57 | int count = 0; 58 | long long framesNumber = 0; 59 | long long startTime = getTimestamp(); 60 | long long totalTime = 0; 61 | while (true) 62 | { 63 | fseek(fp, -bufLen, SEEK_END); 64 | count = fread(buf, sizeof(*buf), bufLen, fp); 65 | if (count == 0) 66 | break; 67 | cv::Mat frame(imgHeight, imgWidth, CV_8UC1, buf); 68 | cv::imshow("video", frame); 69 | framesNumber++; 70 | 71 | char k = cv::waitKey(1); 72 | if (k == 'q' || k == 'Q') 73 | { 74 | cv::imwrite(folder_name + "frame.jpg", frame); 75 | break; 76 | } 77 | } 78 | totalTime = getTimestamp(); 79 | float avgFPS = (totalTime -startTime)/ 1000 / framesNumber; 80 | fprintf(stderr, "Average FPS: %f\n", 1000 / avgFPS); 81 | return 0; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /src/script2.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Eugene a.k.a. Realizator, stereopi.com, virt2real team 2 | // Ported from Python to C++ by Konstantin Ozernov on 10/10/2019. 3 | // 4 | // This file is part of StereoPi С++ tutorial scripts, and has been 5 | // ported from Pyton version (https://github.com/realizator/stereopi-fisheye-robot) 6 | // 7 | // StereoPi tutorial is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation, either version 3 of the 10 | // License, or (at your option) any later version. 11 | // 12 | // StereoPi tutorial is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with StereoPi tutorial. 19 | // If not, see . 20 | // 21 | 22 | #include 23 | #include 24 | #include 25 | //#include 26 | #include 27 | 28 | 29 | long long getTimestamp() 30 | { 31 | const std::chrono::time_point now = std::chrono::system_clock::now(); 32 | const std::chrono::microseconds epoch = std::chrono::duration_cast(now.time_since_epoch()); 33 | return epoch.count(); 34 | } 35 | 36 | int main() 37 | { 38 | //User quit method message 39 | fprintf(stderr, "You can press 'Q' to quit this script.\n"); 40 | 41 | //Photo session settings 42 | int total_photos = 50;// # Number of images to take 43 | int countdown = 3;// # Interval for count-down timer, seconds 44 | int font = cv::FONT_HERSHEY_SIMPLEX;// # Cowntdown timer font 45 | std::string folder_name = "/home/pi/stereopi-cpp-tutorial/"; 46 | 47 | //Camera settimgs 48 | int cam_width = 1280;// # Cam sensor width settings 49 | int cam_height = 480;// # Cam sensor height settings 50 | 51 | int half_width = 640; 52 | int half_height = 480; 53 | 54 | //Final image capture settings 55 | float scale_ratio = 1;// 56 | 57 | // Camera resolution height must be dividable by 16, and width by 32 58 | 59 | cam_width = (int)(((cam_width+31)/32)*32); 60 | cam_height = (int)(((cam_height+15)/16)*16); 61 | fprintf(stderr, "Camera resolution: %d x %d\n", cam_width, cam_height); 62 | 63 | // Buffer for captured image settings 64 | int img_width = (int)((cam_width * scale_ratio)); 65 | int img_height = (int)((cam_height * scale_ratio)); 66 | // capture = np.zeros((img_height, img_width, 4), dtype=np.uint8) 67 | fprintf(stderr, "Scaled image resolution: %d x %d\n", img_width, img_height); 68 | 69 | // Initialize the camera 70 | //cv::VideoCapture cap(0);//"/dev/stdin"); 71 | 72 | FILE *fp; 73 | if ((fp = fopen("/dev/stdin", "rb")) == NULL) 74 | { 75 | fprintf(stderr, "Cannot open input file!\n"); 76 | return 1; 77 | } 78 | 79 | int bufLen = cam_width * cam_height; 80 | char *buf = (char *)malloc(bufLen); 81 | int count = 0; 82 | 83 | 84 | // Lets start taking photos! 85 | int counter = 0; 86 | long long t2 = getTimestamp(); 87 | fprintf(stderr, "Starting photo sequence\n"); 88 | cv::Mat frame; 89 | // while ((count = fread(buf, sizeof(*buf), bufLen, fp)) != 0) 90 | while (true) 91 | { 92 | fseek(fp, -bufLen, SEEK_END); 93 | count = fread(buf, sizeof(*buf), bufLen, fp); 94 | if (count == 0) 95 | break; 96 | cv::Mat frame(cam_height, cam_width, CV_8UC1, buf); 97 | long long t1 = getTimestamp(); 98 | int cntdwn_timer = countdown - (int)((t1-t2) / 1000000); 99 | 100 | 101 | // If cowntdown is zero - let's record next image 102 | if (cntdwn_timer == -1) 103 | { 104 | counter += 1; 105 | std::string filename = folder_name + "scenes/scene_" + std::to_string(img_width) + "x" + std::to_string(img_height) + "_" + std::to_string(counter) + ".png"; 106 | cv::imwrite(filename, frame); 107 | fprintf(stderr, "[%d of %d] %s\n", counter, total_photos, filename.c_str()); 108 | 109 | cv::Mat imgLeft = cv::Mat(frame, cv::Rect(0, 0 , half_width, half_height)); 110 | cv::Mat imgRight = cv::Mat(frame, cv::Rect(half_width, 0, half_width, half_height)); 111 | std::string leftName = folder_name + "pairs/left_" + std::to_string(counter) + ".png"; 112 | std::string rightName = folder_name + "pairs/right_" + std::to_string(counter) + ".png"; 113 | cv::imwrite(leftName, imgLeft); 114 | cv::imwrite(rightName, imgRight); 115 | 116 | t2 = getTimestamp(); 117 | sleep(1); 118 | cntdwn_timer = 0; // To avoid "-1" timer display 119 | } 120 | 121 | // Draw cowntdown counter, seconds 122 | cv::putText(frame, std::to_string(cntdwn_timer), cv::Point(50,50), font, 2.0, cv::Scalar(0,0,255), 4, 16 /*CV_AA*/); 123 | cv::imshow("pair", frame); 124 | char key = cv::waitKey(1); 125 | // Press 'Q' key to quit, or wait till all photos are taken 126 | if (key == 'q' || key == 'Q' || counter == total_photos) 127 | break; 128 | } 129 | 130 | fprintf(stderr, "Photo sequence finished\n"); 131 | 132 | return 0; 133 | } 134 | -------------------------------------------------------------------------------- /src/script4.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Eugene a.k.a. Realizator, stereopi.com, virt2real team 2 | // Ported from Python to C++ by Konstantin Ozernov on 10/10/2019. 3 | // 4 | // This file is part of StereoPi С++ tutorial scripts, and has been 5 | // ported from Pyton version (https://github.com/realizator/stereopi-fisheye-robot) 6 | // 7 | // StereoPi tutorial is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation, either version 3 of the 10 | // License, or (at your option) any later version. 11 | // 12 | // StereoPi tutorial is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with StereoPi tutorial. 19 | // If not, see . 20 | // 21 | 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | 38 | // Camera resolution 39 | int photo_width = 1280; 40 | int photo_height = 480; 41 | 42 | // Image resolution for processing 43 | int img_width = 320; 44 | int img_height = 240; 45 | 46 | // Global settings 47 | std::string folder_name = "/home/pi/stereopi-cpp-tutorial/"; 48 | std::string calibration_data_folder = folder_name + "calibration_data/"; 49 | 50 | void calibrate_one_camera(std::vector > objpoints, std::vector > imgpoints, std::string right_or_left) 51 | { 52 | int N_OK = (int)objpoints.size(); 53 | cv::Size DIM(img_width, img_height); 54 | 55 | cv::Mat K;// = cv::Mat::zeros(3, 3, CV_32FC1); 56 | cv::Mat D;// = cv::Mat::zeros(4, 1, CV_32FC1); 57 | 58 | cv::Vec3f pt(0, 0, 0); 59 | // std::vector rvecs(N_OK, pt); 60 | // std::vector tvecs(N_OK, pt); 61 | cv::Mat rvecs = cv::Mat::zeros(N_OK, 1, CV_32FC3); 62 | cv::Mat tvecs = cv::Mat::zeros(N_OK, 1, CV_32FC3); 63 | 64 | cv::TermCriteria calib_criteria(cv::TermCriteria::EPS + cv::TermCriteria::MAX_ITER, 10, 1e-6); 65 | int calibration_flags = cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC | cv::fisheye::CALIB_FIX_SKEW; 66 | double rms = cv::fisheye::calibrate(objpoints, imgpoints, DIM, K, D, rvecs, tvecs, calibration_flags, calib_criteria); 67 | cv::Mat map1, map2; 68 | cv::fisheye::initUndistortRectifyMap(K, D, pt, K, DIM, CV_16SC2, map1, map2); 69 | 70 | // Now we'll write our results to the file for the future use 71 | cv::FileStorage fs(calibration_data_folder + "calibration_camera_" + std::to_string(img_height) + "_" + right_or_left + ".yml", cv::FileStorage::WRITE); 72 | if (fs.isOpened()) 73 | { 74 | fs << "map1" << map1 << "map2" << map2 << "objpoints" << objpoints << "imgpoints" << 75 | imgpoints << "camera_matrix" << K << "distortion_coeff" << D; 76 | } 77 | 78 | 79 | } 80 | 81 | bool calibrate_stereo_cameras(int res_x = img_width, int res_y = img_height) 82 | { 83 | std::vector > objectPoints; 84 | 85 | std::vector >rightImagePoints; 86 | cv::Mat rightCameraMatrix; 87 | cv::Mat rightDistortionCoefficients; 88 | 89 | std::vector > leftImagePoints; 90 | cv::Mat leftCameraMatrix; 91 | cv::Mat leftDistortionCoefficients; 92 | 93 | cv::Mat rotationMatrix; 94 | cv::Mat translationVector; 95 | 96 | cv::Size imageSize(res_x, res_y); 97 | 98 | cv::TermCriteria TERMINATION_CRITERIA(cv::TermCriteria::EPS + cv::TermCriteria::MAX_ITER, 30, 0.01); 99 | std::string right_or_left = ""; 100 | 101 | for (int i = 0; i <= 1; i++) 102 | { 103 | if (i == 0) 104 | right_or_left = "left"; 105 | else 106 | right_or_left = "right"; 107 | 108 | cv::FileStorage fs(calibration_data_folder + "calibration_camera_" + std::to_string(img_height) + "_" + right_or_left + ".yml", cv::FileStorage::READ); 109 | if (fs.isOpened()) 110 | { 111 | cv::Mat map1, map2; 112 | fs["map1"] >> map1; 113 | fs["map2"] >> map2; 114 | fs["objpoints"] >> objectPoints; 115 | if (right_or_left == "left") 116 | { 117 | fs["imgpoints"] >> leftImagePoints; 118 | fs["camera_matrix"] >> leftCameraMatrix; 119 | fs["distortion_coeff"] >> leftDistortionCoefficients; 120 | } 121 | else 122 | { 123 | fs["imgpoints"] >> rightImagePoints; 124 | fs["camera_matrix"] >> rightCameraMatrix; 125 | fs["distortion_coeff"] >> rightDistortionCoefficients; 126 | } 127 | fs.release(); 128 | } 129 | else 130 | { 131 | fprintf(stderr, "Camera calibration data not found in cache.\n"); 132 | return false; 133 | } 134 | } 135 | fprintf(stderr, "Calibrating cameras together...\n"); 136 | int fisheyeFlags = 0; 137 | fisheyeFlags |= cv::fisheye::CALIB_FIX_INTRINSIC; 138 | //fisheyeFlags &= cv::fisheye::CALIB_CHECK_COND; 139 | double rms = cv::fisheye::stereoCalibrate(objectPoints, leftImagePoints, rightImagePoints, leftCameraMatrix, leftDistortionCoefficients, 140 | rightCameraMatrix, rightDistortionCoefficients, imageSize, rotationMatrix, translationVector, 141 | fisheyeFlags, TERMINATION_CRITERIA); 142 | 143 | fprintf(stderr, "<><><><><><><><><><><><><><>\n"); 144 | fprintf(stderr, "<><><> RMS is %f <><><><><><>\n", rms); 145 | fprintf(stderr, "<><><><><><><><><><><><><><>\n"); 146 | 147 | cv::Mat R1, R2, P1, P2, Q; 148 | cv::fisheye::stereoRectify(leftCameraMatrix, leftDistortionCoefficients, rightCameraMatrix, rightDistortionCoefficients, 149 | imageSize, rotationMatrix, translationVector, R1, R2, P1, P2, Q, cv::CALIB_ZERO_DISPARITY, cv::Size(0, 0), 0, 0); 150 | fprintf(stderr, "Saving calibration...\n"); 151 | cv::Mat leftMapX, leftMapY, rightMapX, rightMapY; 152 | cv::fisheye::initUndistortRectifyMap(leftCameraMatrix, leftDistortionCoefficients, R1, P1, imageSize, CV_16SC2, leftMapX, leftMapY); 153 | cv::fisheye::initUndistortRectifyMap(rightCameraMatrix, rightDistortionCoefficients, R2, P2, imageSize, CV_16SC2, rightMapX, rightMapY); 154 | 155 | cv::FileStorage fsWrite(calibration_data_folder + "stereo_camera_calibration" + std::to_string(img_height) + ".yml", cv::FileStorage::WRITE); 156 | if (fsWrite.isOpened()) 157 | fsWrite << "imageSize" << imageSize << "leftMapX" << leftMapX << "leftMapY" << leftMapY << "rightMapX" << rightMapX << 158 | "rightMapY" << rightMapY << "disparityToDepthMap" << Q; 159 | 160 | 161 | return true; 162 | 163 | } 164 | 165 | int main() 166 | { 167 | // Global variables preset 168 | int total_photos = 50; 169 | 170 | 171 | cv::Size image_size(img_width,img_height); 172 | 173 | // Chessboard parameters 174 | int rows = 6; 175 | int columns = 9; 176 | int square_size = 2.5; 177 | 178 | // Visualization options 179 | bool drawCorners = false; 180 | bool showSingleCamUndistortionResults = true; 181 | bool showStereoRectificationResults = true; 182 | bool writeUdistortedImages = true; 183 | std::string imageToDisp = folder_name + "scenes/scene_1280x480_1.png"; 184 | 185 | //Calibration settings 186 | cv::Size CHECKERBOARD(6,9); 187 | 188 | cv::Mat gray_small_left, gray_small_right; 189 | 190 | cv::TermCriteria subpix_criteria(cv::TermCriteria::EPS + cv::TermCriteria::MAX_ITER, 30, 0.1); 191 | // calibration_flags = cv2.fisheye.CALIB_RECOMPUTE_EXTRINSIC+cv2.fisheye.CALIB_FIX_SKEW 192 | 193 | cv::Vec3f pt(0, 0, 0); 194 | std::vector objp;//(CHECKERBOARD.width * CHECKERBOARD.height, pt); 195 | for (int i = 0; i < CHECKERBOARD.height; i++) 196 | { 197 | for (int j = 0; j < CHECKERBOARD.width; j++) 198 | { 199 | objp.push_back(cv::Vec3f(j, i, 0)); 200 | } 201 | } 202 | fprintf(stderr, "size: %d\n", objp.size()); 203 | std::vector > objpointsLeft; 204 | std::vector > imgpointsLeft; 205 | std::vector > objpointsRight; 206 | std::vector > imgpointsRight; 207 | // _img_shape; 208 | 209 | if (drawCorners) 210 | fprintf(stderr, "You can press 'Q' to quit this script.\n"); 211 | 212 | for (int photo_counter = 1; photo_counter <= total_photos; photo_counter++) 213 | { 214 | fprintf (stderr, "Import pair No %d\n", photo_counter); 215 | std::string leftName = folder_name + "pairs/left_"; 216 | leftName += std::to_string(photo_counter) + ".png"; 217 | std::string rightName = folder_name + "pairs/right_"; 218 | rightName += std::to_string(photo_counter) + ".png"; 219 | 220 | cv::Mat imgL = cv::imread(leftName); 221 | cv::Mat imgR = cv::imread(rightName); 222 | if (imgR.empty() || imgL.empty()) 223 | { 224 | fprintf(stderr, "There are no images in pair No %d\n", photo_counter); 225 | continue; 226 | } 227 | 228 | // If stereopair is complete - go to processing 229 | cv::Mat grayL; 230 | cv::cvtColor(imgL, grayL, cv::COLOR_BGR2GRAY); 231 | cv::resize (grayL, gray_small_left, cv::Size(img_width,img_height), cv::INTER_AREA); 232 | cv::Mat grayR; 233 | cv::cvtColor(imgR, grayR, cv::COLOR_BGR2GRAY); 234 | cv::resize(grayR, gray_small_right, cv::Size(img_width, img_height), cv::INTER_AREA); 235 | 236 | 237 | // Find the chessboard corners 238 | std::vector cornersL; 239 | bool retL = cv::findChessboardCorners(grayL, CHECKERBOARD, cornersL, cv::CALIB_CB_ADAPTIVE_THRESH + cv::CALIB_CB_FAST_CHECK + cv::CALIB_CB_NORMALIZE_IMAGE); 240 | std::vector cornersR; 241 | bool retR = cv::findChessboardCorners(grayR, CHECKERBOARD, cornersR, cv::CALIB_CB_ADAPTIVE_THRESH + cv::CALIB_CB_FAST_CHECK + cv::CALIB_CB_NORMALIZE_IMAGE); 242 | 243 | // Draw images with corners found 244 | if (drawCorners) 245 | { 246 | cv::drawChessboardCorners(imgL, CHECKERBOARD, cornersL, retL); 247 | cv::imshow("Corners LEFT", imgL); 248 | cv::drawChessboardCorners(imgR, CHECKERBOARD, cornersR, retR); 249 | cv::imshow("Corners RIGHT", imgR); 250 | char key = cv::waitKey(); 251 | if (key == 'q' || key == 'Q') 252 | exit(1); 253 | } 254 | 255 | // Here is our scaling trick! Hi res for calibration, low res for real work! 256 | // Scale corners X and Y to our working resolution 257 | if ((retL && retR) && (img_height <= photo_height)) 258 | { 259 | float scale_ratio = (float)img_height/photo_height; 260 | for (int i = 0; i < cornersL.size(); i++) 261 | cornersL[i] *= scale_ratio; 262 | for (int i = 0; i < cornersR.size(); i++) 263 | cornersR[i] *= scale_ratio; 264 | } 265 | else if (img_height > photo_height) 266 | { 267 | fprintf(stderr, "Image resolution is higher than photo resolution, upscale needed. Please check your photo and image parameters!\n"); 268 | exit (0); 269 | } 270 | 271 | // Refine corners and add to array for processing 272 | if (retL && retR) 273 | { 274 | objpointsLeft.push_back(objp); 275 | cv::cornerSubPix(gray_small_left,cornersL,cv::Size(3,3), cv::Size(-1,-1),subpix_criteria); 276 | imgpointsLeft.push_back(cornersL); 277 | objpointsRight.push_back(objp); 278 | cv::cornerSubPix(gray_small_right,cornersR, cv::Size(3,3), cv::Size(-1,-1), subpix_criteria); 279 | imgpointsRight.push_back(cornersR); 280 | } 281 | else 282 | { 283 | fprintf(stderr, "Pair No %d ignored, as no chessboard found\n", photo_counter); 284 | continue; 285 | } 286 | //fprintf(stderr, "End cycle\n"); 287 | } 288 | 289 | // Let's calibrate each camera, and than calibrate them together 290 | fprintf (stderr, "Left camera calibration...\n"); 291 | calibrate_one_camera(objpointsLeft, imgpointsLeft, "left"); 292 | fprintf(stderr, "Right camera calibration...\n"); 293 | calibrate_one_camera(objpointsRight, imgpointsRight, "right"); 294 | fprintf(stderr, "Stereoscopic calibration...\n"); 295 | bool result = calibrate_stereo_cameras(); 296 | fprintf(stderr, "Calibration complete!\n"); 297 | 298 | // The following code just shows you calibration results 299 | if (showSingleCamUndistortionResults) 300 | { 301 | int width = 320; 302 | int height = 240; 303 | 304 | cv::Mat map1, map2; 305 | 306 | fprintf(stderr, "Undistorting picture with width = %d, height = %d\n", width, height); 307 | cv::FileStorage fsLeft(calibration_data_folder + "calibration_camera_" + std::to_string(img_height) + "_left" + ".yml", cv::FileStorage::READ); 308 | if (fsLeft.isOpened()) 309 | { 310 | fsLeft["map1"] >> map1; 311 | fsLeft["map2"] >> map2; 312 | fsLeft.release(); 313 | } 314 | else 315 | { 316 | fprintf(stderr, "Left camera calibration data not found in cache.\n"); 317 | return false; 318 | } 319 | 320 | cv::Mat undistorted_left; 321 | cv::remap(gray_small_left, undistorted_left, map1, map2, cv::INTER_LINEAR, cv::BORDER_CONSTANT); 322 | 323 | cv::FileStorage fsRight(calibration_data_folder + "calibration_camera_" + std::to_string(img_height) + "_right" + ".yml", cv::FileStorage::READ); 324 | if (fsRight.isOpened()) 325 | { 326 | fsRight["map1"] >> map1; 327 | fsRight["map2"] >> map2; 328 | fsRight.release(); 329 | } 330 | else 331 | { 332 | fprintf(stderr, "Right camera calibration data not found in cache.\n"); 333 | return false; 334 | } 335 | 336 | cv::Mat undistorted_right; 337 | cv::remap(gray_small_right, undistorted_right, map1, map2, cv::INTER_LINEAR, cv::BORDER_CONSTANT); 338 | 339 | cv::imshow("Undistorted LEFT", undistorted_left); 340 | cv::imshow("Undistorted RIGHT", undistorted_right); 341 | cv::waitKey(0); 342 | if (writeUdistortedImages) 343 | { 344 | cv::imwrite(folder_name + "undistorted_left.jpg", undistorted_left); 345 | cv::imwrite(folder_name + "undistorted_right.jpg", undistorted_right); 346 | } 347 | 348 | } 349 | 350 | if (showStereoRectificationResults) 351 | { 352 | // lets rectify pair and look at the result 353 | 354 | // NOTICE: we use 320x240 as a working resolution, regardless of 355 | // calibration images resolution. So 320x240 parameters are hardcoded 356 | // now. 357 | cv::FileStorage fsStereo(calibration_data_folder + "stereo_camera_calibration" + std::to_string(img_height) + ".yml", cv::FileStorage::READ); 358 | if (!fsStereo.isOpened()) 359 | { 360 | fprintf(stderr, "Camera calibration data not found in cache\n"); 361 | exit(1); 362 | } 363 | cv::Mat leftMapX, leftMapY, rightMapX, rightMapY; 364 | fsStereo["leftMapX"] >> leftMapX; 365 | fsStereo["leftMapY"] >> leftMapY; 366 | fsStereo["rightMapX"] >> rightMapX; 367 | fsStereo["rightMapY"] >> rightMapY; 368 | 369 | cv::Mat imgPair = cv::imread(imageToDisp); 370 | if (imgPair.empty()) 371 | { 372 | fprintf(stderr, "Cannot load image!\n"); 373 | exit(1); 374 | } 375 | cv::resize(imgPair, imgPair, cv::Size(640, 240), cv::INTER_CUBIC); 376 | 377 | cv::Mat imgL = cv::Mat(imgPair, cv::Rect(0, 0, 320, 240)); 378 | cv::Mat imgR = cv::Mat(imgPair, cv::Rect(320, 0, 320, 240)); 379 | 380 | // Rectifying left and right images 381 | cv::remap(imgL, imgL, leftMapX, leftMapY, cv::INTER_LINEAR); 382 | cv::remap(imgR, imgR, rightMapX, rightMapY, cv::INTER_LINEAR); 383 | 384 | cv::imshow("Left STEREO CALIBRATED", imgL); 385 | cv::imshow("Right STEREO CALIBRATED", imgR); 386 | cv::imwrite("rectifyed_left.jpg", imgL); 387 | cv::imwrite("rectifyed_right.jpg", imgR); 388 | cv::waitKey(0); 389 | } 390 | 391 | 392 | return 0; 393 | } 394 | -------------------------------------------------------------------------------- /src/script5.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Eugene a.k.a. Realizator, stereopi.com, virt2real team 2 | // Ported from Python to C++ by Konstantin Ozernov on 10/10/2019. 3 | // 4 | // This file is part of StereoPi С++ tutorial scripts, and has been 5 | // ported from Pyton version (https://github.com/realizator/stereopi-fisheye-robot) 6 | // 7 | // StereoPi tutorial is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation, either version 3 of the 10 | // License, or (at your option) any later version. 11 | // 12 | // StereoPi tutorial is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with StereoPi tutorial. 19 | // If not, see . 20 | // 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | 37 | 38 | int SWS = 5; 39 | int PFS = 5; 40 | int preFiltCap = 29; 41 | int minDisp = -25; 42 | int numOfDisp = 128; 43 | int TxtrThrshld = 100; 44 | int unicRatio = 10; 45 | int SpcklRng = 15; 46 | int SpklWinSze = 100; 47 | 48 | // Global settings 49 | std::string folder_name = "/home/pi/stereopi-cpp-tutorial/"; 50 | std::string calibration_data_folder = folder_name + "calibration_data/"; 51 | 52 | cv::Mat left, right; 53 | 54 | long long getTimestamp() { 55 | const std::chrono::time_point now = std::chrono::system_clock::now(); 56 | const std::chrono::microseconds epoch = std::chrono::duration_cast(now.time_since_epoch()); 57 | return epoch.count(); 58 | } 59 | 60 | 61 | void loadParams() 62 | { 63 | fprintf(stderr, "Loading params...\n"); 64 | std::string filename = folder_name + "3dmap_set.yml"; 65 | cv::FileStorage fs; 66 | if (fs.open(filename, cv::FileStorage::READ)) 67 | { 68 | fs["SWS"] >> SWS; 69 | fs["PFS"] >> PFS; 70 | fs["preFiltCap"] >> preFiltCap; 71 | fs["minDisp"] >> minDisp; 72 | fs["numOfDisp"] >> numOfDisp; 73 | fs["TxtrThrshld"] >> TxtrThrshld; 74 | fs["unicRatio"] >> unicRatio; 75 | fs["SpcklRng"] >> SpcklRng; 76 | fs["SpklWinSze"] >> SpklWinSze; 77 | } 78 | 79 | fprintf(stderr, "pfs = %d\n", PFS); 80 | 81 | } 82 | 83 | void saveParams() 84 | { 85 | fprintf(stderr, "Saving params...\n"); 86 | std::string filename = folder_name + "3dmap_set.yml"; 87 | cv::FileStorage fs(filename, cv::FileStorage::WRITE); 88 | fs << "SWS" << SWS << "PFS" << PFS << "preFiltCap" << preFiltCap << "minDisp" << minDisp << "numOfDisp" << numOfDisp 89 | << "TxtrThrshld" << TxtrThrshld << "unicRatio" << unicRatio << "SpcklRng" << SpcklRng << "SpklWinSze" << SpklWinSze; 90 | } 91 | 92 | void stereo_depth_map(cv::Mat left, cv::Mat right) 93 | { 94 | cv::Ptr bm = cv::StereoBM::create(16,9); 95 | 96 | if (SWS < 5) 97 | SWS = 5; 98 | if (SWS % 2 == 0) 99 | SWS += 1; 100 | if (SWS > left.rows) 101 | SWS = left.rows - 1; 102 | 103 | if (numOfDisp < 16) 104 | numOfDisp = 16; 105 | if (numOfDisp % 16 != 0) 106 | { 107 | numOfDisp -= (numOfDisp % 16); 108 | } 109 | 110 | if (preFiltCap < 1) 111 | preFiltCap = 1; 112 | 113 | bm->setPreFilterCap(preFiltCap); 114 | bm->setBlockSize(SWS); 115 | bm->setMinDisparity(minDisp); 116 | bm->setNumDisparities(numOfDisp); 117 | bm->setTextureThreshold(TxtrThrshld); 118 | bm->setUniquenessRatio(unicRatio); 119 | bm->setSpeckleWindowSize(SpklWinSze); 120 | bm->setSpeckleRange(SpcklRng); 121 | bm->setDisp12MaxDiff(1); 122 | 123 | cv::Mat disp, disp8, colored; 124 | bm->compute( left, right, disp); 125 | disp.convertTo(disp8, CV_8U); 126 | cv::applyColorMap(disp8, colored, cv::COLORMAP_JET); 127 | cv::imshow("Image", colored); 128 | 129 | 130 | } 131 | 132 | void onTrackbar(int, void *) 133 | { 134 | stereo_depth_map(left, right); 135 | // fprintf(stderr, "%d %d %d %d %d %d %d %d\n", preFiltCap, SWS, minDisp, numOfDisp, TxtrThrshld, unicRatio, SpklWinSze, SpcklRng); 136 | } 137 | 138 | void onMinDisp(int, void *) 139 | { 140 | minDisp -= 40; 141 | // fprintf(stderr, "%d %d %d %d %d %d %d %d\n", preFiltCap, SWS, minDisp, numOfDisp, TxtrThrshld, unicRatio, SpklWinSze, SpcklRng); 142 | stereo_depth_map(left, right); 143 | } 144 | 145 | int main() 146 | { 147 | std::string imageToDisp = "scenes/dm-tune-example.jpg"; 148 | int photo_width = 640; 149 | int photo_height = 240; 150 | int image_width = 320; 151 | int image_height = 240; 152 | 153 | cv::Size image_size(image_width,image_height); 154 | 155 | FILE *fp; 156 | if ((fp = fopen("/dev/stdin", "rb")) == NULL) 157 | { 158 | fprintf(stderr, "Cannot open input file!\n"); 159 | return 1; 160 | } 161 | 162 | int bufLen = photo_width * photo_height; 163 | char *buf = (char *)malloc(bufLen); 164 | int count = 0; 165 | 166 | cv::FileStorage fsStereo(calibration_data_folder + "stereo_camera_calibration" + std::to_string(image_height) + ".yml", cv::FileStorage::READ); 167 | if (!fsStereo.isOpened()) 168 | { 169 | fprintf(stderr, "Camera calibration data not found in cache\n"); 170 | exit(1); 171 | } 172 | cv::Mat leftMapX, leftMapY, rightMapX, rightMapY; 173 | fsStereo["leftMapX"] >> leftMapX; 174 | fsStereo["leftMapY"] >> leftMapY; 175 | fsStereo["rightMapX"] >> rightMapX; 176 | fsStereo["rightMapY"] >> rightMapY; 177 | 178 | loadParams(); 179 | 180 | cv::namedWindow("Image"); 181 | cv::moveWindow("Image", 50, 100); 182 | cv::namedWindow("Left"); 183 | cv::moveWindow("Left", 450, 100); 184 | cv::namedWindow("Right"); 185 | cv::moveWindow("Right", 850, 100); 186 | 187 | 188 | 189 | cv::createTrackbar("SWS", "Image", &SWS, 255, onTrackbar); 190 | cv::createTrackbar("PFS", "Image", &PFS, 255, onTrackbar); 191 | cv::createTrackbar("PreFiltCap", "Image", &preFiltCap, 63, onTrackbar); 192 | cv::createTrackbar("MinDISP", "Image", &minDisp, 100, onMinDisp); 193 | cv::createTrackbar("NumOfDisp", "Image", &numOfDisp, 256, onTrackbar); 194 | cv::createTrackbar("TxtrThrshld", "Image", &TxtrThrshld, 100, onTrackbar); 195 | cv::createTrackbar("UnicRatio", "Image", &unicRatio, 100, onTrackbar); 196 | cv::createTrackbar("SpcklRng", "Image", &SpcklRng, 40, onTrackbar); 197 | cv::createTrackbar("SpklWinSze", "Image", &SpklWinSze, 300, onTrackbar); 198 | 199 | long long prevTime = getTimestamp(); 200 | float avgFps = 0.0; 201 | int frameNumber = 0; 202 | int prevFrameNumber = 0; 203 | while (true) 204 | { 205 | fseek(fp, -bufLen, SEEK_END); 206 | count = fread(buf, sizeof(*buf), bufLen, fp); 207 | if (count == 0) 208 | break; 209 | 210 | cv::Mat img(photo_height, photo_width, CV_8UC1, buf); 211 | left = cv::Mat(img, cv::Rect(0, 0, image_width, image_height)); 212 | right = cv::Mat(img, cv::Rect(image_width, 0, image_width, image_height)); 213 | 214 | // Rectifying left and right images 215 | cv::remap(left, left, leftMapX, leftMapY, cv::INTER_LINEAR); 216 | cv::remap(right, right, rightMapX, rightMapY, cv::INTER_LINEAR); 217 | 218 | stereo_depth_map(left, right); 219 | 220 | cv::imshow("Left", left); 221 | cv::imshow("Right", right); 222 | 223 | char k = cv::waitKey(1); 224 | if (k == 's' || k == 'S') 225 | { 226 | fprintf(stderr, "k = %c\n", k); 227 | saveParams(); 228 | break; 229 | } 230 | else if (k == 'q' || k == 'Q') 231 | break; 232 | 233 | frameNumber++; 234 | long long currTime = getTimestamp(); 235 | if (currTime - prevTime > 1000000) 236 | { 237 | fprintf(stderr, "FPS: %d\n", frameNumber - prevFrameNumber); 238 | prevFrameNumber = frameNumber; 239 | prevTime = currTime; 240 | } 241 | 242 | } 243 | return 0; 244 | } 245 | -------------------------------------------------------------------------------- /src/script6.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Eugene a.k.a. Realizator, stereopi.com, virt2real team 2 | // Ported from Python to C++ by Konstantin Ozernov on 10/10/2019. 3 | // 4 | // This file is part of StereoPi С++ tutorial scripts, and has been 5 | // ported from Pyton version (https://github.com/realizator/stereopi-fisheye-robot) 6 | // 7 | // StereoPi tutorial is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation, either version 3 of the 10 | // License, or (at your option) any later version. 11 | // 12 | // StereoPi tutorial is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with StereoPi tutorial. 19 | // If not, see . 20 | // 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | 37 | int SWS = 5; 38 | int PFS = 5; 39 | int preFiltCap = 29; 40 | int minDisp = -25; 41 | int numOfDisp = 16; 42 | int TxtrThrshld = 100; 43 | int unicRatio = 10; 44 | int SpcklRng = 15; 45 | int SpklWinSze = 100; 46 | float actualFPS = 0.0; 47 | 48 | // Global settings 49 | std::string folder_name = "/home/pi/stereopi-cpp-tutorial/"; 50 | std::string calibration_data_folder = folder_name + "calibration_data/"; 51 | 52 | long long getTimestamp() { 53 | const std::chrono::time_point now = std::chrono::system_clock::now(); 54 | const std::chrono::microseconds epoch = std::chrono::duration_cast(now.time_since_epoch()); 55 | return epoch.count(); 56 | } 57 | 58 | 59 | void loadParams() 60 | { 61 | fprintf(stderr, "Loading params...\n"); 62 | std::string filename = folder_name + "3dmap_set.yml"; 63 | cv::FileStorage fs; 64 | if (fs.open(filename, cv::FileStorage::READ)) 65 | { 66 | fs["SWS"] >> SWS; 67 | fs["PFS"] >> PFS; 68 | fs["preFiltCap"] >> preFiltCap; 69 | fs["minDisp"] >> minDisp; 70 | fs["numOfDisp"] >> numOfDisp; 71 | fs["TxtrThrshld"] >> TxtrThrshld; 72 | fs["unicRatio"] >> unicRatio; 73 | fs["SpcklRng"] >> SpcklRng; 74 | fs["SpklWinSze"] >> SpklWinSze; 75 | } 76 | 77 | 78 | } 79 | 80 | bool stereo_depth_map(cv::Mat &left, cv::Mat &right, cv::Ptr bm, 81 | float &time1, float &time2, float &time3, float &time4) 82 | { 83 | 84 | 85 | // cv::cvtColor(left, left, cv::COLOR_BGR2GRAY); 86 | // cv::cvtColor(right, right, cv::COLOR_BGR2GRAY); 87 | 88 | cv::Mat disp, disp8, colored; 89 | long long startT = getTimestamp(); 90 | bm->compute( left, right, disp); 91 | long long computeTime = getTimestamp(); 92 | time1 += computeTime - startT; 93 | disp.convertTo(disp8, CV_8U); 94 | long long ucharConvertTime = getTimestamp(); 95 | time2 += ucharConvertTime - computeTime; 96 | cv::applyColorMap(disp8, colored, cv::COLORMAP_JET); 97 | long long colorizeTime = getTimestamp(); 98 | time3 += colorizeTime - ucharConvertTime; 99 | cv::imshow("map", colored); 100 | long long showtime = getTimestamp(); 101 | time4 += showtime - colorizeTime; 102 | char k = cv::waitKey(1); 103 | if (k == 'q' || k == 'Q') 104 | return false; 105 | 106 | return true; 107 | } 108 | 109 | int main() 110 | { 111 | int imgHeight = 240; 112 | int imgWidth = 640; 113 | 114 | FILE *fp; 115 | if ((fp = fopen("/dev/stdin", "rb")) == NULL) 116 | { 117 | fprintf(stderr, "Cannot open input file!\n"); 118 | return 1; 119 | } 120 | 121 | int bufLen = imgWidth * imgHeight; 122 | char *buf = (char *)malloc(bufLen); 123 | int count = 0; 124 | 125 | cv::FileStorage fsStereo(calibration_data_folder + "stereo_camera_calibration" + std::to_string(imgHeight) + ".yml", cv::FileStorage::READ); 126 | if (!fsStereo.isOpened()) 127 | { 128 | fprintf(stderr, "Camera calibration data not found in cache\n"); 129 | exit(1); 130 | } 131 | cv::Mat leftMapX, leftMapY, rightMapX, rightMapY; 132 | fsStereo["leftMapX"] >> leftMapX; 133 | fsStereo["leftMapY"] >> leftMapY; 134 | fsStereo["rightMapX"] >> rightMapX; 135 | fsStereo["rightMapY"] >> rightMapY; 136 | 137 | loadParams(); 138 | 139 | cv::namedWindow("map"); 140 | cv::moveWindow("map", 50, 100); 141 | cv::namedWindow("Left"); 142 | cv::moveWindow("Left", 450, 100); 143 | cv::namedWindow("Right"); 144 | cv::moveWindow("Right", 850, 100); 145 | 146 | cv::Ptr bm = cv::StereoBM::create(16,9); 147 | 148 | if (SWS < 5) 149 | SWS = 5; 150 | if (SWS % 2 == 0) 151 | SWS += 1; 152 | if (SWS > 80) 153 | SWS = 79; 154 | 155 | if (numOfDisp % 16 != 0) 156 | { 157 | numOfDisp -= (numOfDisp % 16); 158 | } 159 | 160 | bm->setPreFilterCap(preFiltCap); 161 | bm->setBlockSize(SWS); 162 | bm->setMinDisparity(minDisp); 163 | bm->setNumDisparities(numOfDisp); 164 | bm->setTextureThreshold(TxtrThrshld); 165 | bm->setUniquenessRatio(unicRatio); 166 | bm->setSpeckleWindowSize(SpklWinSze); 167 | bm->setSpeckleRange(SpcklRng); 168 | bm->setDisp12MaxDiff(1); 169 | 170 | float time1 = 0, time2 = 0, time3 = 0, time4 = 0, time5 = 0, time6 = 0, time7 = 0, time8 = 0, time9 = 0, time10 = 0, time11 = 0; 171 | int frameNumber = 0; 172 | 173 | // while ((count = fread(buf, sizeof(*buf), bufLen, fp)) != 0) 174 | // { 175 | while (true) 176 | { 177 | fseek(fp, -bufLen, SEEK_END); 178 | count = fread(buf, sizeof(*buf), bufLen, fp); 179 | if (count == 0) 180 | break; 181 | long long starttime = getTimestamp(); 182 | 183 | cv::Mat frame(imgHeight, imgWidth, CV_8UC1, buf); 184 | 185 | long long timeReadFrame = getTimestamp(); 186 | time1 += timeReadFrame - starttime; 187 | 188 | cv::Mat left = cv::Mat(frame, cv::Rect(0, 0, imgWidth / 2, imgHeight)); 189 | cv::Mat right = cv::Mat(frame, cv::Rect(imgWidth / 2, 0, imgWidth / 2, imgHeight)); 190 | 191 | long long timeSplitLeftRight = getTimestamp(); 192 | time2 += timeSplitLeftRight - timeReadFrame; 193 | 194 | 195 | // Rectifying left and right images 196 | cv::remap(left, left, leftMapX, leftMapY, cv::INTER_LINEAR); 197 | cv::remap(right, right, rightMapX, rightMapY, cv::INTER_LINEAR); 198 | 199 | long long timeRectify = getTimestamp(); 200 | time3 += timeRectify - timeSplitLeftRight; 201 | 202 | cv::imshow("Left", left); 203 | cv::imshow("Right", right); 204 | 205 | long long timeShow = getTimestamp(); 206 | time4 += timeShow - timeRectify; 207 | 208 | 209 | // Taking a strip from our image for lidar-like mode (and saving CPU) 210 | // cv::Mat imgLCut = cv::Mat(left, cv::Rect(0, 80, left.cols, 80)); 211 | // cv::Mat imgRCut = cv::Mat(right, cv::Rect(0, 80, right.cols, 80)); 212 | 213 | // cv::resize(left, left, cv::Size(176, 132)); 214 | // cv::resize(right, right, cv::Size(176, 132)); 215 | 216 | long long timeStrip = getTimestamp(); 217 | time5 += timeStrip - timeShow; 218 | 219 | bool depth = stereo_depth_map(left, right, bm, time8, time9, time10, time11); 220 | 221 | long long timeDepth = getTimestamp(); 222 | time6 += timeDepth - timeStrip; 223 | 224 | time7 += timeDepth - starttime; 225 | 226 | frameNumber++; 227 | if (!depth) 228 | break; 229 | } 230 | 231 | time1 = time1 / (frameNumber * 1000); 232 | time2 = time2 / (frameNumber * 1000); 233 | time3 = time3 / (frameNumber * 1000); 234 | time4 = time4 / (frameNumber * 1000); 235 | time5 = time5 / (frameNumber * 1000); 236 | time6 = time6 / (frameNumber * 1000); 237 | time7 = time7 / (frameNumber * 1000); 238 | time8 = time8 / (frameNumber * 1000); 239 | time9 = time9 / (frameNumber * 1000); 240 | time10 = time10 / (frameNumber * 1000); 241 | time11 = time11 / (frameNumber * 1000); 242 | actualFPS = 1000.0/time7; 243 | 244 | fprintf(stderr, "Avg time (milliseconds):\nread frame: %f\nsplit to left and right: %f\nrectify: %f\nshow left and right: %f\nget strips: %f\nget depth map: %f\ncompute map: %f\nconvert to uchar: %f\ncolorize: %f\nshow map: %f\ntotal: %f\nactual FPS: %f\n", time1, time2, time3, time4, time5, time6, time8, time9, time10, time11, time7, actualFPS); 245 | 246 | return 0; 247 | } 248 | -------------------------------------------------------------------------------- /src/script7.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Eugene a.k.a. Realizator, stereopi.com, virt2real team 2 | // Ported from Python to C++ by Konstantin Ozernov on 10/10/2019. 3 | // 4 | // This file is part of StereoPi С++ tutorial scripts, and has been 5 | // ported from Pyton version (https://github.com/realizator/stereopi-fisheye-robot) 6 | // 7 | // StereoPi tutorial is free software: you can redistribute it 8 | // and/or modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation, either version 3 of the 10 | // License, or (at your option) any later version. 11 | // 12 | // StereoPi tutorial is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with StereoPi tutorial. 19 | // If not, see . 20 | // 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | int SWS = 7; 38 | int PFS = 7; 39 | int preFiltCap = 5; 40 | int minDisp = 1; 41 | int numOfDisp = 32; 42 | int TxtrThrshld = 13; 43 | int unicRatio = 19; 44 | int SpcklRng = 0; 45 | int SpklWinSze = 0; 46 | float min_y = 10000.0; 47 | float max_y = -10000.0; 48 | float min_x = 10000.0; 49 | float max_x = -10000.0; 50 | float map_zoom_x = 100; 51 | float map_zoom_y = 100; 52 | float map_zoom = 50; 53 | // Comfort and debug flags 54 | bool auto_zoom = true; //try to fit all points on 2D map display if true 55 | bool show_debug = true; //will show additional info like max and min of X and Y 56 | // Global settings 57 | std::string folder_name = "/home/pi/stereopi-cpp-tutorial/"; 58 | std::string calibration_data_folder = folder_name + "calibration_data/"; 59 | 60 | 61 | // Visualization settings 62 | bool showDisparity = true; 63 | bool showUndistortedImages = true; 64 | bool showColorizedDistanceLine = true; 65 | 66 | 67 | void loadParams() 68 | { 69 | fprintf(stderr, "Loading params...\n"); 70 | std::string filename = folder_name + "3dmap_set.yml"; 71 | cv::FileStorage fs; 72 | if (fs.open(filename, cv::FileStorage::READ)) 73 | { 74 | fs["SWS"] >> SWS; 75 | fs["PFS"] >> PFS; 76 | fs["preFiltCap"] >> preFiltCap; 77 | fs["minDisp"] >> minDisp; 78 | fs["numOfDisp"] >> numOfDisp; 79 | fs["TxtrThrshld"] >> TxtrThrshld; 80 | fs["unicRatio"] >> unicRatio; 81 | fs["SpcklRng"] >> SpcklRng; 82 | fs["SpklWinSze"] >> SpklWinSze; 83 | } 84 | 85 | 86 | } 87 | 88 | cv::Mat stereo_depth_map(cv::Ptr bm, cv::Mat left, cv::Mat right) 89 | { 90 | cv::Mat disparity; 91 | bm->compute( left, right, disparity); 92 | disparity.convertTo(disparity, CV_8U); 93 | return disparity; 94 | } 95 | 96 | int main() 97 | { 98 | int imgHeight = 240; 99 | int imgWidth = 640; 100 | 101 | 102 | int map_width = 320; 103 | int map_height = 240; 104 | 105 | FILE *fp; 106 | if ((fp = fopen("/dev/stdin", "rb")) == NULL) 107 | { 108 | fprintf(stderr, "Cannot open input file!\n"); 109 | return 1; 110 | } 111 | 112 | int bufLen = imgWidth * imgHeight; 113 | char *buf = (char *)malloc(bufLen); 114 | int count = 0; 115 | long long framesNumber = 0; 116 | 117 | cv::FileStorage fsStereo(calibration_data_folder + "stereo_camera_calibration" + std::to_string(imgHeight) + ".yml", cv::FileStorage::READ); 118 | if (!fsStereo.isOpened()) 119 | { 120 | fprintf(stderr, "Camera calibration data not found in cache\n"); 121 | exit(1); 122 | } 123 | cv::Mat leftMapX, leftMapY, rightMapX, rightMapY, QQ; 124 | fsStereo["leftMapX"] >> leftMapX; 125 | fsStereo["leftMapY"] >> leftMapY; 126 | fsStereo["rightMapX"] >> rightMapX; 127 | fsStereo["rightMapY"] >> rightMapY; 128 | fsStereo["disparityToDepthMap"] >> QQ; 129 | 130 | loadParams(); 131 | 132 | cv::Ptr bm = cv::StereoBM::create(16,9); 133 | 134 | if (SWS < 5) 135 | SWS = 5; 136 | if (SWS % 2 == 0) 137 | SWS += 1; 138 | if (SWS > map_height) 139 | SWS = map_height - 1; 140 | 141 | if (numOfDisp % 16 != 0) 142 | { 143 | numOfDisp -= (numOfDisp % 16); 144 | } 145 | 146 | bm->setPreFilterCap(preFiltCap); 147 | bm->setBlockSize(SWS); 148 | bm->setMinDisparity(minDisp); 149 | bm->setNumDisparities(numOfDisp); 150 | bm->setTextureThreshold(TxtrThrshld); 151 | bm->setUniquenessRatio(unicRatio); 152 | bm->setSpeckleWindowSize(SpklWinSze); 153 | bm->setSpeckleRange(SpcklRng); 154 | bm->setDisp12MaxDiff(1); 155 | 156 | // while ((count = fread(buf, sizeof(*buf), bufLen, fp)) != 0) 157 | // { 158 | 159 | while (true) 160 | { 161 | fseek(fp, -bufLen, SEEK_END); 162 | count = fread(buf, sizeof(*buf), bufLen, fp); 163 | if (count == 0) 164 | break; 165 | cv::Mat frame(imgHeight, imgWidth, CV_8UC1, buf); 166 | cv::Mat left = cv::Mat(frame, cv::Rect(0, 0, imgWidth / 2, imgHeight)); 167 | cv::Mat right = cv::Mat(frame, cv::Rect(imgWidth / 2, 0, imgWidth / 2, imgHeight)); 168 | 169 | // Rectifying left and right images 170 | cv::remap(left, left, leftMapX, leftMapY, cv::INTER_LINEAR); 171 | cv::remap(right, right, rightMapX, rightMapY, cv::INTER_LINEAR); 172 | 173 | // Taking a strip from our image for lidar-like mode (and saving CPU) 174 | cv::Mat imgLCut = cv::Mat(left, cv::Rect(0, 80, left.cols, 80)); 175 | cv::Mat imgRCut = cv::Mat(right, cv::Rect(0, 80, right.cols, 80)); 176 | 177 | cv::Mat native_disparity = stereo_depth_map(bm, imgLCut, imgRCut); 178 | 179 | cv::imshow("depth", native_disparity); 180 | 181 | cv::Mat maximized_line = native_disparity.clone(); 182 | 183 | cv::Mat maxInColumns = cv::Mat::zeros(native_disparity.cols, 1, CV_8UC1); 184 | int matMax = INT_MIN; 185 | int matMin = INT_MAX; 186 | for (int i = 0; i < native_disparity.cols; i++) 187 | { 188 | int max = INT_MIN; 189 | int min = INT_MAX; 190 | for (int j = 0; j < native_disparity.rows; j++) 191 | { 192 | int val = (int)(native_disparity.at(j, i)); 193 | if (val > max) 194 | max = val; 195 | if (val < min) 196 | min = val; 197 | } 198 | //fprintf(stderr, "%d\n", max); 199 | maxInColumns.at(i, 0) = max; 200 | if (max > matMax) 201 | matMax = max; 202 | if (min < matMin) 203 | matMin = min; 204 | } 205 | 206 | cv::Mat points; 207 | cv::reprojectImageTo3D(maxInColumns, points, QQ); 208 | cv::Mat xy_projection = cv::Mat::zeros(map_height, map_width, CV_8UC1); 209 | 210 | 211 | //choose "closest" points in each column 212 | for (int i = 0; i < maximized_line.rows; i++) 213 | { 214 | for (int j = 0; j < maximized_line.cols; j++) 215 | { 216 | maximized_line.at(i, j) = maxInColumns.at(j, 0); 217 | } 218 | } 219 | 220 | // Put all points to the 2D map 221 | 222 | // Change map_zoom to adjust visible range! 223 | map_zoom_y = (map_height/(max_y-min_y)); 224 | map_zoom_x = (map_width/(max_x-min_x)); 225 | // prevent manual/autozoom to set extremely small numbers caused by values spike 226 | map_zoom_x = std::max(float(10.0), map_zoom_x); 227 | map_zoom_y = std::max(float(10.0), map_zoom_y); 228 | if (show_debug) 229 | { 230 | fprintf(stderr, "\nX and Y before zoom: \nmax_y = %.2f, min_y = %.2f, max_x = %.2f, min_x = %.2f \n", max_y, min_y, max_x, min_x ); 231 | fprintf(stderr, "map_height = %d, map_width = %d, Autozoom: %s, zoom X = %.2f, zoom Y = %.2f\n", map_height, map_width, auto_zoom ? "On" : "Off", map_zoom_x, map_zoom_y ); 232 | } 233 | for (int i = 0; i < points.rows; i++) 234 | { 235 | float cur_y = -points.at(i, 0)[0]; 236 | float cur_x = points.at(i, 0)[1]; 237 | if (!isinf(cur_y)) 238 | { 239 | min_y = std::min(cur_y, min_y); 240 | max_y = std::max(cur_y, max_y); 241 | 242 | } 243 | if (!isinf(cur_x)) 244 | { 245 | max_x = std::max(cur_x, max_x); 246 | min_x = std::min(cur_x, min_x); 247 | } 248 | if (!auto_zoom) {map_zoom_x = map_zoom; map_zoom_y = map_zoom;} 249 | 250 | int xx = (int)((cur_x) * map_zoom_x) + (int)(map_width/2); // zero point is in the middle of the map 251 | int yy = map_height - (int)((cur_y-min_y) * map_zoom_y); // zero point is at the bottom of the map 252 | 253 | // If the point fits on our 2D map - let's draw it! 254 | if (xx < map_width && xx >= 0 && yy < map_height && yy >= 0) 255 | xy_projection.at(yy, xx) = maxInColumns.at(i, 0);//maximized_line.at(i, 0); 256 | } 257 | 258 | cv::Mat xy_projection_color, max_line_color, disparity_color; 259 | cv::applyColorMap(native_disparity, disparity_color, cv::COLORMAP_JET); 260 | cv::applyColorMap(xy_projection, xy_projection_color, cv::COLORMAP_JET); 261 | cv::applyColorMap(maximized_line, max_line_color, cv::COLORMAP_JET); 262 | 263 | 264 | // show the frame 265 | if (showUndistortedImages) 266 | { 267 | cv::imshow("left", imgLCut); 268 | cv::imshow("right", imgRCut); 269 | } 270 | if (showColorizedDistanceLine) 271 | cv::imshow("Max distance line", max_line_color); 272 | cv::imshow("XY projection", xy_projection_color) ; 273 | cv::imshow("image", disparity_color); 274 | char k = cv::waitKey(1); 275 | if (k == 'q' || k == 'Q') 276 | exit(1); 277 | } 278 | 279 | return 0; 280 | } 281 | -------------------------------------------------------------------------------- /undistorted_left.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/undistorted_left.jpg -------------------------------------------------------------------------------- /undistorted_right.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realizator/stereopi-cpp-tutorial/aee832896937ce91fe0a330dd0ddcdcdb01a9cf6/undistorted_right.jpg --------------------------------------------------------------------------------