Skip to content
patrobic edited this page Oct 4, 2017 · 21 revisions

Welcome to the BlindAid wiki!

PROGRAM STRUCTURE PAGE HERE: https://github.com/patrobic/BlindAid/wiki/Program-Structure

Following is an outline I've put together of a few coding guidelines to help you all understand my code and in your own programming.

SOLID Principle

By far the most important is the SOLID principle (this will make you a better programmer!), available here: https://youtu.be/huEEkx5P5Hs

I will leave you to look it up (many articles available online), but here are the five points:

  • S — Single responsibility principle
  • O — Open closed principle
  • L — Liskov substitution principle
  • I — Interface segregation principle
  • D — Dependency Inversion principle

Functor Class Design

A class encompasses Functionality, Input and Output. the Functor Class Design Principle allows creating an object that behaves like a function. By definition it must have an operator()() function, which executes its funcitonality. You provide it input either as parameters, or through an "Input Class" (either through the operator or an Init(...) function). You can also access its internal members as results, or regroup it in a "Result Class".

Things to configure in VS

  • OpenCV include/library relative paths
  • dll storage and post build copy to execution folder.
  • ImageWatch plugin to view CV::Mat

Configuration Steps/Paths

Include Files

  • C/C++ -> General -> Additional Include Directories: $(ProjectDir)....\opencv\include
  • VC++ Directories -> Include Directories: $(ProjectDir)....\opencv\include

Libraries

  • -> Library Directories: $(ProjectDir)....\opencv\x64\vc14\lib
  • Linker -> General -> Additional Library Directories: $(ProjectDir)....\opencv\x64\vc14\lib;
  • -> Input -> Additional Dependencies: opencv_core330d.lib; opencv_highgui330d.lib;opencv_imgcodecs330d.lib; opencv_imgproc330d.lib; opencv_objdetect330d.lib; opencv_features2d330d.lib; opencv_videoio330d.lib

Data Passing/Storage by Pointer

I typically create data by value in the root module, and then pass it to subsequent modules or store it in dependent classes by pointer, to minimize data reallocation/unnecessary memory usage caused by passing by value. I also avoid passing by reference, because it gets tricky with constructor Member Initialization Lists (i.e. a reference value MUST be initialized in the constructor, whereas a pointer can be declared/passed as NULL).