├── __init__.py ├── icon.c4d ├── icon.icns ├── faces ├── v.png ├── bean.png ├── mask.png ├── hannibal.png ├── norton.png └── watson.png ├── other ├── qt.conf ├── mask.png └── libqcocoa.dylib ├── assets ├── next.png ├── play.png ├── pause.png ├── refresh.png └── detection_icon.png ├── docs ├── epydoc │ ├── crarr.png │ ├── frames.html │ ├── index.html │ ├── toc-detection-module.html │ ├── toc-clustering-module.html │ ├── toc-clustering.setup-module.html │ ├── toc-detection.tree-module.html │ ├── toc-clustering.voronoi-module.html │ ├── toc-detection.window_ui-module.html │ ├── toc-clustering.voronoi1-module.html │ ├── toc-detection.detector-module.html │ ├── toc-clustering.clusterer-module.html │ ├── toc-detection.detection-module.html │ ├── toc-clustering.clustering-module.html │ ├── toc-detection.setup-module.html │ ├── toc-detection.common-module.html │ ├── redirect.html │ ├── toc.html │ ├── detection-pysrc.html │ ├── clustering-pysrc.html │ ├── module-tree.html │ ├── epydoc.css │ ├── detection.tree-module.html │ ├── detection.window_ui-module.html │ ├── detection.detector-module.html │ ├── clustering-module.html │ ├── detection-module.html │ ├── detection.common.CustomException-class.html │ ├── toc-everything.html │ ├── detection.detector.ClassifierParameters-class.html │ ├── clustering.voronoi1-module.html │ ├── clustering.setup-module.html │ ├── clustering.voronoi-module.html │ ├── detection.detection-module.html │ ├── detection.tree.Node-class.html │ ├── clustering.clustering-module.html │ ├── clustering.clusterer-module.html │ ├── clustering.setup-pysrc.html │ └── detection.common.EmittingStream-class.html ├── epydoc.conf └── epydoc.css ├── haarcascades ├── haarcascade_mcs_leftear.xml └── haarcascade_mcs_rightear.xml ├── clean.sh ├── .gitignore ├── src ├── flip.py ├── createsamples.pl └── mergevec.cpp ├── setup.py ├── tree.py ├── common.py └── README.md /__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /icon.c4d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/icon.c4d -------------------------------------------------------------------------------- /icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/icon.icns -------------------------------------------------------------------------------- /faces/v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/faces/v.png -------------------------------------------------------------------------------- /other/qt.conf: -------------------------------------------------------------------------------- 1 | ; Qt Configuration file 2 | [Paths] 3 | Plugins = PlugIns 4 | -------------------------------------------------------------------------------- /assets/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/assets/next.png -------------------------------------------------------------------------------- /assets/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/assets/play.png -------------------------------------------------------------------------------- /faces/bean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/faces/bean.png -------------------------------------------------------------------------------- /faces/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/faces/mask.png -------------------------------------------------------------------------------- /other/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/other/mask.png -------------------------------------------------------------------------------- /assets/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/assets/pause.png -------------------------------------------------------------------------------- /assets/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/assets/refresh.png -------------------------------------------------------------------------------- /faces/hannibal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/faces/hannibal.png -------------------------------------------------------------------------------- /faces/norton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/faces/norton.png -------------------------------------------------------------------------------- /faces/watson.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/faces/watson.png -------------------------------------------------------------------------------- /docs/epydoc/crarr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/docs/epydoc/crarr.png -------------------------------------------------------------------------------- /other/libqcocoa.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/other/libqcocoa.dylib -------------------------------------------------------------------------------- /assets/detection_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/assets/detection_icon.png -------------------------------------------------------------------------------- /haarcascades/haarcascade_mcs_leftear.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/haarcascades/haarcascade_mcs_leftear.xml -------------------------------------------------------------------------------- /haarcascades/haarcascade_mcs_rightear.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsyann/detection/HEAD/haarcascades/haarcascade_mcs_rightear.xml -------------------------------------------------------------------------------- /docs/epydoc.conf: -------------------------------------------------------------------------------- 1 | [epydoc] 2 | 3 | name: OCR 4 | url: https://github.com/xsyann/ocr 5 | modules: ./ 6 | 7 | output: html 8 | target: docs/epydoc/ 9 | 10 | css: docs/epydoc.css 11 | 12 | graph: all 13 | 14 | 15 | verbosity: 3 16 | debug: 1 17 | -------------------------------------------------------------------------------- /clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # clean.sh 3 | # 4 | # Author: Yann KOETH 5 | # Created: Tue Jul 22 20:27:47 2014 (+0200) 6 | # Last-Updated: Tue Jul 22 20:30:43 2014 (+0200) 7 | # By: Yann KOETH 8 | # Update #: 12 9 | # 10 | 11 | sudo rm -rvf *.egg *.pyc illum/ build/ *~ 12 | -------------------------------------------------------------------------------- /docs/epydoc/frames.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | OCR 7 | 8 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/epydoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | OCR 7 | 8 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | bin/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # Installer logs 26 | pip-log.txt 27 | pip-delete-this-directory.txt 28 | 29 | # Unit test / coverage reports 30 | htmlcov/ 31 | .tox/ 32 | .coverage 33 | .cache 34 | nosetests.xml 35 | coverage.xml 36 | 37 | # Translations 38 | *.mo 39 | 40 | # Mr Developer 41 | .mr.developer.cfg 42 | .project 43 | .pydevproject 44 | 45 | # Rope 46 | .ropeproject 47 | 48 | # Django stuff: 49 | *.log 50 | *.pot 51 | 52 | # Sphinx documentation 53 | docs/_build/ 54 | 55 | # Misc 56 | .DS_Store 57 | *~ 58 | tex/ 59 | illum/ 60 | test/ 61 | classifier 62 | positives* 63 | samples* 64 | negatives* 65 | -------------------------------------------------------------------------------- /src/flip.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # flip.py 4 | # 5 | # Author: Yann KOETH 6 | # Created: Sun Jul 20 15:13:51 2014 (+0200) 7 | # Last-Updated: Wed Jul 23 10:04:03 2014 (+0200) 8 | # By: Yann KOETH 9 | # Update #: 26 10 | # 11 | 12 | import os 13 | import glob 14 | import cv2 15 | import argparse, sys 16 | 17 | def main(): 18 | 19 | parser = argparse.ArgumentParser(description="Flip all images in folder.") 20 | parser.add_argument("folder", help="Folder path") 21 | args = parser.parse_args() 22 | 23 | samples = glob.glob(args.folder + "/*.jpg") 24 | for sample in samples: 25 | img = cv2.imread(sample) 26 | flipped = cv2.flip(img, 1, img) 27 | fn, ext = os.path.splitext(sample) 28 | name = fn + "-flipped" + ext 29 | cv2.imshow("flipped", flipped) 30 | print name 31 | cv2.imwrite(name, flipped) 32 | 33 | if __name__ == '__main__': 34 | main() 35 | -------------------------------------------------------------------------------- /docs/epydoc/toc-detection-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection 7 | 8 | 9 | 10 | 11 | 13 |

Module detection

14 |
15 |

Variables

16 | __package__

18 | [hide private] 20 | 21 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/epydoc/toc-clustering-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering 7 | 8 | 9 | 10 | 11 | 13 |

Module clustering

14 |
15 |

Variables

16 | __package__

18 | [hide private] 20 | 21 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/epydoc/toc-clustering.setup-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | setup 7 | 8 | 9 | 10 | 11 | 13 |

Module setup

14 |
15 |

Variables

16 | APP
DATA_FILES
OPTIONS

20 | [hide private] 22 | 23 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/epydoc/toc-detection.tree-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | tree 7 | 8 | 9 | 10 | 11 | 13 |

Module tree

14 |
15 |

Classes

16 | Node
Tree

Variables

19 | __package__

21 | [hide private] 23 | 24 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/epydoc/toc-clustering.voronoi-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | voronoi 7 | 8 | 9 | 10 | 11 | 13 |

Module voronoi

14 |
15 |

Functions

16 | circumCircle
voronoi

Variables

19 | __package__

21 | [hide private] 23 | 24 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/epydoc/toc-detection.window_ui-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | window_ui 7 | 8 | 9 | 10 | 11 | 13 |

Module window_ui

14 |
15 |

Classes

16 | QTreeView
WindowUI

Variables

19 | __package__

21 | [hide private] 23 | 24 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/epydoc/toc-clustering.voronoi1-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | voronoi1 7 | 8 | 9 | 10 | 11 | 13 |

Module voronoi1

14 |
15 |

Functions

16 | circumCircle
voronoi

Variables

19 | __package__

21 | [hide private] 23 | 24 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/epydoc/toc-detection.detector-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detector 7 | 8 | 9 | 10 | 11 | 13 |

Module detector

14 |
15 |

Classes

16 | ClassifierParameters
Detector

Variables

19 | __package__

21 | [hide private] 23 | 24 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/epydoc/toc-clustering.clusterer-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clusterer 7 | 8 | 9 | 10 | 11 | 13 |

Module clusterer

14 |
15 |

Classes

16 | Clusterer
Graph

Variables

19 | __package__
__warningregistry__

22 | [hide private] 24 | 25 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /docs/epydoc/toc-detection.detection-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection 7 | 8 | 9 | 10 | 11 | 13 |

Module detection

14 |
15 |

Classes

16 | MediaThread
Window

Functions

19 | main

Variables

21 | __package__

23 | [hide private] 25 | 26 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/epydoc/toc-clustering.clustering-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering 7 | 8 | 9 | 10 | 11 | 13 |

Module clustering

14 |
15 |

Classes

16 | ClustererThread
EmittingStream
Window

Functions

20 | main

Variables

22 | __package__

24 | [hide private] 26 | 27 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """ 2 | This is a setup.py script generated by py2applet 3 | 4 | Usage: 5 | python setup.py py2app 6 | """ 7 | 8 | import os 9 | from sys import platform 10 | 11 | NAME = "Detection" 12 | VERSION = "0.1" 13 | MAIN = "detection.py" 14 | ICON = "icon.icns" 15 | 16 | PWD = os.path.dirname(os.path.realpath(__file__)) 17 | 18 | if platform == "darwin": 19 | from setuptools import setup 20 | extra_options = dict( 21 | setup_requires=['py2app'], 22 | app=[MAIN], 23 | options=dict( 24 | py2app=dict( 25 | argv_emulation=True, 26 | iconfile=ICON, 27 | includes=['PyQt5', 'PyQt5.QtCore', 28 | 'PyQt5.QtGui', 'PyQt5.QtWidgets'], 29 | resources=['haarcascades'], 30 | plist=dict( 31 | CFBundleName=NAME, 32 | CFBundleShortVersionString=VERSION, 33 | CFBundleIconFile=ICON 34 | ) 35 | ) 36 | ) 37 | ) 38 | 39 | def delete_old_app(): 40 | import shutil 41 | BUILD_PATH = os.path.join(PWD, "build") 42 | DIST_PATH = os.path.join(PWD, "dist") 43 | if os.path.exists(BUILD_PATH): 44 | shutil.rmtree(BUILD_PATH) 45 | if os.path.exists(DIST_PATH): 46 | shutil.rmtree(DIST_PATH) 47 | 48 | if __name__ == "__main__": 49 | delete_old_app() 50 | setup( 51 | name=NAME, 52 | version=VERSION, 53 | author="Yann KOETH", 54 | data_files=[ICON], 55 | **extra_options 56 | ) 57 | if platform == "darwin": 58 | from os import chmod, makedirs 59 | from shutil import copyfile 60 | makedirs('dist/' + NAME + '.app/Contents/PlugIns/platforms') 61 | copyfile('other/libqcocoa.dylib', 'dist/' + NAME + '.app/Contents/PlugIns/platforms/libqcocoa.dylib') 62 | -------------------------------------------------------------------------------- /docs/epydoc/toc-detection.setup-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | setup 7 | 8 | 9 | 10 | 11 | 13 |

Module setup

14 |
15 |

Functions

16 | delete_old_app

Variables

18 | ICON
MAIN
NAME
PWD
VERSION
__package__
extra_options

26 | [hide private] 28 | 29 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/epydoc/toc-detection.common-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | common 7 | 8 | 9 | 10 | 11 | 13 |

Module common

14 |
15 |

Classes

16 | CustomException
EmittingStream

Functions

19 | blurPixmap
checkerboard
fitImageToScreen
getObjectsTree
np2Qt
scaleRect
setPickerColor

Variables

27 | __package__

29 | [hide private] 31 | 32 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /tree.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # tree.py 4 | # 5 | # Author: Yann KOETH 6 | # Created: Wed Jul 16 16:20:49 2014 (+0200) 7 | # Last-Updated: Thu Jul 24 10:36:34 2014 (+0200) 8 | # By: Yann KOETH 9 | # Update #: 74 10 | # 11 | 12 | from collections import defaultdict 13 | 14 | class Tree(defaultdict): 15 | 16 | def __init__(self, parent=None): 17 | self.parent = parent 18 | super(Tree, self).__init__(lambda: Tree()) 19 | 20 | def walk(self): 21 | for node, children in self.iteritems(): 22 | yield node 23 | for n in children.walk(): 24 | yield n 25 | 26 | def map(self, param, func): 27 | for node, children in self.iteritems(): 28 | children.map(func(node, param), func) 29 | 30 | def fromQStandardItemModel(self, model, table, indexes, extract): 31 | self.extracted = None 32 | def getChildren(node, extract): 33 | """Return the children tree of node. 34 | """ 35 | tree = Tree() 36 | childCount = node.rowCount() 37 | for i in xrange(childCount): 38 | child = node.child(i) 39 | selected = model.indexFromItem(child) in indexes or not indexes 40 | treeNode = Node(child.text(), (selected, table[child.data()])) 41 | if child == extract: 42 | self.extracted = treeNode 43 | tree[treeNode] = getChildren(child, extract) 44 | return tree 45 | 46 | for i in xrange(model.rowCount()): 47 | rootItem = model.itemFromIndex(model.index(i, 0)) 48 | selected = model.index(i, 0) in indexes or not indexes 49 | node = Node(rootItem.text(), (selected, table[rootItem.data()])) 50 | if rootItem == extract: 51 | self.extracted = node 52 | self[node] = getChildren(rootItem, extract) 53 | 54 | return self.extracted 55 | 56 | class Node: 57 | def __init__(self, name, data=None): 58 | self.name = name 59 | self.data = data 60 | 61 | def __hash__(self): 62 | return hash((self.name, str(self.data))) 63 | 64 | def __eq__(self, other): 65 | return (self.name == other.name) and (self.data == other.data) 66 | 67 | def __repr__(self): 68 | return '[Node name={} data={}]'.format(self.name, self.data) 69 | -------------------------------------------------------------------------------- /docs/epydoc/redirect.html: -------------------------------------------------------------------------------- 1 | Epydoc Redirect Page 2 | 3 | 4 | 5 | 6 | 7 | 8 | 18 | 19 |

Epydoc Auto-redirect page

20 | 21 |

When javascript is enabled, this page will redirect URLs of 22 | the form redirect.html#dotted.name to the 23 | documentation for the object with the given fully-qualified 24 | dotted name.

25 |

 

26 | 27 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/epydoc/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Table of Contents 7 | 8 | 9 | 10 | 11 | 13 |

Table of Contents

14 |
15 | Everything 16 |
17 |

Modules

18 | detection
detection.common
detection.detection
detection.detector
detection.setup
detection.tree
detection.window_ui

26 | [hide private] 28 | 29 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/createsamples.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use File::Basename; 3 | use strict; 4 | ########################################################################## 5 | # Create samples from an image applying distortions repeatedly 6 | # (create many many samples from many images applying distortions) 7 | # 8 | # perl createtrainsamples.pl 9 | # [] [] 10 | # ex) perl createtrainsamples.pl positives.dat negatives.dat samples 11 | # 12 | # Author: Naotoshi Seo 13 | # Date : 09/12/2008 Add and options 14 | # Date : 06/02/2007 15 | # Date : 03/12/2006 16 | ######################################################################### 17 | my $cmd = './createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 20 -h 20'; 18 | my $totalnum = 7000; 19 | my $tmpfile = 'tmp'; 20 | 21 | if ($#ARGV < 2) { 22 | print "Usage: perl createtrainsamples.pl\n"; 23 | print " \n"; 24 | print " \n"; 25 | print " \n"; 26 | print " []\n"; 27 | print " []\n"; 28 | exit; 29 | } 30 | my $positive = $ARGV[0]; 31 | my $negative = $ARGV[1]; 32 | my $outputdir = $ARGV[2]; 33 | $totalnum = $ARGV[3] if ($#ARGV > 2); 34 | $cmd = $ARGV[4] if ($#ARGV > 3); 35 | 36 | open(POSITIVE, "< $positive"); 37 | my @positives = ; 38 | close(POSITIVE); 39 | 40 | open(NEGATIVE, "< $negative"); 41 | my @negatives = ; 42 | close(NEGATIVE); 43 | 44 | # number of generated images from one image so that total will be $totalnum 45 | my $numfloor = int($totalnum / $#positives); 46 | my $numremain = $totalnum - $numfloor * $#positives; 47 | 48 | # Get the directory name of positives 49 | my $first = $positives[0]; 50 | my $last = $positives[$#positives]; 51 | while ($first ne $last) { 52 | $first = dirname($first); 53 | $last = dirname($last); 54 | if ( $first eq "" ) { last; } 55 | } 56 | my $imgdir = $first; 57 | my $imgdirlen = length($first); 58 | 59 | for (my $k = 0; $k < $#positives; $k++ ) { 60 | my $img = $positives[$k]; 61 | my $num = ($k < $numremain) ? $numfloor + 1 : $numfloor; 62 | 63 | # Pick up negative images randomly 64 | my @localnegatives = (); 65 | for (my $i = 0; $i < $num; $i++) { 66 | my $ind = int(rand($#negatives)); 67 | push(@localnegatives, $negatives[$ind]); 68 | } 69 | open(TMP, "> $tmpfile"); 70 | print TMP @localnegatives; 71 | close(TMP); 72 | #system("cat $tmpfile"); 73 | 74 | !chomp($img); 75 | my $vec = $outputdir . substr($img, $imgdirlen) . ".vec" ; 76 | print "$cmd -img $img -bg $tmpfile -vec $vec -num $num" . "\n"; 77 | system("$cmd -img $img -bg $tmpfile -vec $vec -num $num"); 78 | } 79 | unlink($tmpfile); 80 | -------------------------------------------------------------------------------- /common.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # common.py 4 | # 5 | # Author: Yann KOETH 6 | # Created: Wed Jul 16 19:11:21 2014 (+0200) 7 | # Last-Updated: Thu Jul 24 10:33:48 2014 (+0200) 8 | # By: Yann KOETH 9 | # Update #: 148 10 | # 11 | 12 | import cv2 13 | import os 14 | import numpy as np 15 | from PyQt5 import QtCore, QtGui, QtWidgets 16 | from PyQt5.QtGui import QImage, QPixmap 17 | from PyQt5.QtWidgets import QDesktopWidget, QLabel, QGraphicsBlurEffect, QGraphicsPixmapItem 18 | 19 | from tree import Tree 20 | 21 | class CustomException(Exception): 22 | pass 23 | 24 | class EmittingStream(QtCore.QObject): 25 | textWritten = QtCore.pyqtSignal(str) 26 | 27 | def write(self, text): 28 | self.textWritten.emit(str(text)) 29 | 30 | def setPickerColor(color, colorPicker): 31 | """Set the color picker color. 32 | """ 33 | css = 'QWidget { background-color: %s; border-width: 0; \ 34 | border-radius: 2px; border-color: #555; border-style: outset; }' 35 | colorPicker.setStyleSheet(css % color.name()) 36 | 37 | def checkerboard(size): 38 | """Create a checkboard. 39 | """ 40 | h, w = size.height(), size.width() 41 | c0 = (191, 191, 191, 255) 42 | c1 = (255, 255, 255, 255) 43 | blocksize = 8 44 | coords = np.ogrid[0:h,0:w] 45 | idx = (coords[0] // blocksize + coords[1] // blocksize) % 2 46 | vals = np.array([c0, c1], dtype=np.uint8) 47 | return np2Qt(vals[idx]) 48 | 49 | def np2Qt(image): 50 | """Convert numpy array to QPixmap. 51 | """ 52 | height, width, bytesPerComponent = image.shape 53 | bytesPerLine = 4 * width 54 | 55 | if bytesPerComponent == 3: 56 | image = cv2.cvtColor(image, cv2.COLOR_RGB2RGBA) 57 | qimg = QImage(image.data, width, height, 58 | bytesPerLine, QImage.Format_ARGB32) 59 | return QPixmap.fromImage(qimg) 60 | 61 | def fitImageToScreen(pixmap): 62 | """Fit pixmap to screen. 63 | """ 64 | resolution = QDesktopWidget().screenGeometry() 65 | h, w = resolution.width(), resolution.height() 66 | w = min(pixmap.width(), w) 67 | h = min(pixmap.height(), h) 68 | return pixmap.scaled(QtCore.QSize(w, h), QtCore.Qt.KeepAspectRatio) 69 | 70 | def blurPixmap(pixmap, radius): 71 | effect = QGraphicsBlurEffect() 72 | effect.setBlurRadius(radius) 73 | buffer = QPixmap(pixmap) 74 | item = QGraphicsPixmapItem(buffer) 75 | item.setGraphicsEffect(effect) 76 | output = QPixmap(pixmap.width(), pixmap.height()) 77 | painter = QtGui.QPainter(output) 78 | scene = QtWidgets.QGraphicsScene() 79 | view = QtWidgets.QGraphicsView(scene) 80 | scene.addItem(item) 81 | scene.render(painter) 82 | return output 83 | 84 | def scaleRect(rect, scale): 85 | """Scale 'rect' with a factor of 'scale'. 86 | """ 87 | x, y, w, h = rect 88 | return (x * scale, y * scale, w * scale, h * scale) 89 | 90 | def getObjectsTree(qTreeView, table, indexes, extract): 91 | """Create an object tree representation from QTreeView. 92 | """ 93 | tree = Tree() 94 | model = qTreeView.model() 95 | extracted = tree.fromQStandardItemModel(model, table, indexes, extract) 96 | return tree, extracted 97 | -------------------------------------------------------------------------------- /docs/epydoc/detection-pysrc.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 48 | 59 | 60 |
44 | 45 | Package detection 46 | 47 | 49 | 50 | 51 | 53 | 57 |
[hide private]
[frames] | no frames]
58 |
61 |

Source Code for Package detection

62 |
 63 | 1   
 64 | 2   
 69 | 
70 |
71 | 72 | 74 | 75 | 76 | 78 | 79 | 80 | 82 | 83 | 84 | 86 | 87 | 88 | 90 | 91 | 92 | 97 | 98 | 99 | 100 | 101 | 105 | 109 | 110 |
111 | 112 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /docs/epydoc/clustering-pysrc.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 48 | 59 | 60 |
44 | 45 | Package clustering 46 | 47 | 49 | 50 | 51 | 53 | 57 |
[hide private]
[frames] | no frames]
58 |
61 |

Source Code for Package clustering

62 |
 63 | 1   
 64 | 2   
 69 | 
70 |
71 | 72 | 74 | 75 | 76 | 78 | 79 | 80 | 82 | 83 | 84 | 86 | 87 | 88 | 90 | 91 | 92 | 97 | 98 | 99 | 100 | 101 | 105 | 109 | 110 |
111 | 112 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /docs/epydoc/module-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Module Hierarchy 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 55 | 56 |
  45 | 46 | 47 | 49 | 53 |
[hide private]
[frames] | no frames]
54 |
57 |
58 | [ Module Hierarchy 59 | | Class Hierarchy ] 60 |

61 |

Module Hierarchy

62 | 74 | 75 | 77 | 78 | 79 | 81 | 82 | 83 | 85 | 86 | 87 | 89 | 90 | 91 | 93 | 94 | 95 | 100 | 101 | 102 | 103 | 104 | 108 | 112 | 113 |
114 | 115 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /docs/epydoc.css: -------------------------------------------------------------------------------- 1 | html { background: #4b4d4d url(images/bkgnd_pattern.png); margin: 0; 2 | padding: 1em 1em 3em; 3 | } 4 | body { background: #fff url(images/vertbars.png) repeat-x; 5 | border: 1px solid #000; color: #000; margin: 1em 0; padding: 0 1em 1em; 6 | } 7 | body, th, td { 8 | font: normal small Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif; 9 | } 10 | h1, h2, h3, h4 { 11 | font-family: Arial,Verdana,'Bitstream Vera Sans',Helvetica,sans-serif; 12 | font-weight: bold; letter-spacing: -0.018em; 13 | } 14 | h1 { font-size: 19px; margin: 2em 0 .5em; } 15 | h2 { font-size: 16px; margin: 1.5em 0 .5em; } 16 | h3 { font-size: 14px; margin: 1.2em 0 .5em; } 17 | hr { border: none; border-top: 1px solid #ccb; margin: 2em 0; } 18 | p { margin: 0 0 1em; } 19 | :link, :visited { text-decoration: none; border-bottom: 1px dotted #bbb; 20 | color: #b00; 21 | } 22 | :link:hover, :visited:hover { background-color: #eee; color: #555; } 23 | 24 | table { border: none; border-collapse: collapse; } 25 | 26 | table.navbar { background: #000; color: #fff; margin: 2em 0 .33em; } 27 | table.navbar th { border: 1px solid #000; font-weight: bold; padding: 1px; } 28 | table.navbar :link, table.navbar :visited { border: none; color: #fff; } 29 | table.navbar :link:hover, table.navbar :visited:hover { background: none; 30 | text-decoration: underline overline; 31 | } 32 | table.navbar th.navbar-select { background: #fff; color: #000; } 33 | span.breadcrumbs { color: #666; font-size: 95%; } 34 | h1.epydoc { border: none; color: #666; 35 | font-size: x-large; margin: 1em 0 0; padding: 0; 36 | } 37 | pre.base-tree { color: #666; margin: 0; padding: 0; } 38 | pre.base-tree :link, pre.base-tree :visited { border: none; } 39 | pre.py-doctest, pre.variable, pre.rst-literal-block { background: #eee; 40 | border: 1px solid #e6e6e6; color: #000; margin: 1em; padding: .25em; 41 | overflow: auto; 42 | } 43 | pre.variable { margin: 0; } 44 | 45 | /* Summary tables */ 46 | 47 | table.summary { margin: .5em 0; } 48 | table.summary tr.table-header { background: #f7f7f0; } 49 | table.summary td.table-header { color: #666; font-weight: bold; } 50 | table.summary th.group-header { background: #f7f7f0; color: #666; 51 | font-size: 90%; font-weight: bold; text-align: left; 52 | } 53 | table.summary th, table.summary td { border: 1px solid #d7d7d7; } 54 | table.summary th th, table.summary td td { border: none; } 55 | table.summary td.summary table td { color: #666; font-size: 90%; } 56 | table.summary td.summary table br { display: none; } 57 | table.summary td.summary span.summary-type { font-family: monospace; 58 | font-size: 90%; 59 | } 60 | table.summary td.summary span.summary-type code { font-size: 110%; } 61 | p.indent-wrapped-lines { color: #999; font-size: 85%; margin: 0; 62 | padding: 0 0 0 7em; text-indent: -7em; 63 | } 64 | p.indent-wrapped-lines code { color: #999; font-size: 115%; } 65 | p.indent-wrapped-lines :link, p.indent-wrapped-lines :visited { border: none; } 66 | .summary-sig { display: block; font-family: monospace; font-size: 120%; 67 | margin-bottom: .5em; 68 | } 69 | .summary-sig-name { font-weight: bold; } 70 | .summary-sig-arg { color: #333; } 71 | .summary-sig :link, .summary-sig :visited { border: none; } 72 | .summary-name { font-family: monospace; font-weight: bold; } 73 | 74 | /* Details tables */ 75 | 76 | table.details { margin: 2em 0 0; } 77 | div table.details { margin-top: 0; } 78 | table.details tr.table-header { background: transparent; } 79 | table.details td.table-header { border-bottom: 1px solid #ccc; padding: 2em 0 0; } 80 | table.details span.table-header { 81 | font: bold 140% Arial,Verdana,'Bitstream Vera Sans',Helvetica,sans-serif; 82 | letter-spacing: -0.018em; 83 | } 84 | table.details th, table.details td { border: none; } 85 | table.details th th, table.details td td { border: none; } 86 | table.details td { padding-left: 2em; } 87 | table.details td td { padding-left: 0; } 88 | table.details h3.epydoc { margin-left: -2em; } 89 | table.details h3.epydoc .sig { color: #999; font-family: monospace; } 90 | table.details h3.epydoc .sig-name { color: #000; } 91 | table.details h3.epydoc .sig-arg { color: #666; } 92 | table.details h3.epydoc .sig-default { font-size: 95%; font-weight: normal; } 93 | table.details h3.epydoc .sig-default code { font-weight: normal; } 94 | table.details h3.epydoc .fname { color: #999; font-size: 90%; 95 | font-style: italic; font-weight: normal; line-height: 1.6em; 96 | } 97 | 98 | dl dt { color: #666; margin-top: 1em; } 99 | dl dd { margin: 0; padding-left: 2em; } 100 | dl.fields { margin: 1em 0; padding: 0; } 101 | dl.fields dt { color: #666; margin-top: 1em; } 102 | dl.fields dd ul { margin: 0; padding: 0; } 103 | div.fields { font-size: 90%; margin: 0 0 2em 2em; } 104 | div.fields p { margin-bottom: 0.5em; } 105 | 106 | table td.footer { color: #999; font-size: 85%; margin-top: 3em; 107 | padding: 0 3em 1em; position: absolute; width: 80%; } 108 | table td.footer :link, table td.footer :visited { border: none; color: #999; } 109 | table td.footer :link:hover, table td.footer :visited:hover { 110 | background: transparent; text-decoration: underline; 111 | } 112 | 113 | /* Syntax highlighting */ 114 | 115 | .py-prompt, .py-more, .variable-ellipsis, .variable-op { color: #999; } 116 | .variable-group { color: #666; font-weight: bold; } 117 | .py-string, .variable-string, .variable-quote { color: #093; } 118 | .py-comment { color: #06f; font-style: italic; } 119 | .py-keyword { color: #00f; } 120 | .py-output { background: #f6f6f0; color: #666; font-weight: bold; } 121 | 122 | /* Index */ 123 | 124 | table.link-index { background: #f6f6f0; border: none; margin-top: 1em; } 125 | table.link-index td.link-index { border: none; font-family: monospace; 126 | font-weight: bold; padding: .5em 1em; 127 | } 128 | table.link-index td table, table.link-index td td { border: none; } 129 | table.link-index .index-where { color: #999; 130 | font-family: Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif; 131 | font-size: 90%; font-weight: normal; line-height: 1.6em; 132 | } 133 | table.link-index .index-where :link, table.link-index .index-where :visited { 134 | border: none; color: #666; 135 | } 136 | h2.epydoc { color: #999; font-size: 200%; line-height: 10px; } -------------------------------------------------------------------------------- /docs/epydoc/epydoc.css: -------------------------------------------------------------------------------- 1 | html { background: #4b4d4d url(images/bkgnd_pattern.png); margin: 0; 2 | padding: 1em 1em 3em; 3 | } 4 | body { background: #fff url(images/vertbars.png) repeat-x; 5 | border: 1px solid #000; color: #000; margin: 1em 0; padding: 0 1em 1em; 6 | } 7 | body, th, td { 8 | font: normal small Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif; 9 | } 10 | h1, h2, h3, h4 { 11 | font-family: Arial,Verdana,'Bitstream Vera Sans',Helvetica,sans-serif; 12 | font-weight: bold; letter-spacing: -0.018em; 13 | } 14 | h1 { font-size: 19px; margin: 2em 0 .5em; } 15 | h2 { font-size: 16px; margin: 1.5em 0 .5em; } 16 | h3 { font-size: 14px; margin: 1.2em 0 .5em; } 17 | hr { border: none; border-top: 1px solid #ccb; margin: 2em 0; } 18 | p { margin: 0 0 1em; } 19 | :link, :visited { text-decoration: none; border-bottom: 1px dotted #bbb; 20 | color: #b00; 21 | } 22 | :link:hover, :visited:hover { background-color: #eee; color: #555; } 23 | 24 | table { border: none; border-collapse: collapse; } 25 | 26 | table.navbar { background: #000; color: #fff; margin: 2em 0 .33em; } 27 | table.navbar th { border: 1px solid #000; font-weight: bold; padding: 1px; } 28 | table.navbar :link, table.navbar :visited { border: none; color: #fff; } 29 | table.navbar :link:hover, table.navbar :visited:hover { background: none; 30 | text-decoration: underline overline; 31 | } 32 | table.navbar th.navbar-select { background: #fff; color: #000; } 33 | span.breadcrumbs { color: #666; font-size: 95%; } 34 | h1.epydoc { border: none; color: #666; 35 | font-size: x-large; margin: 1em 0 0; padding: 0; 36 | } 37 | pre.base-tree { color: #666; margin: 0; padding: 0; } 38 | pre.base-tree :link, pre.base-tree :visited { border: none; } 39 | pre.py-doctest, pre.variable, pre.rst-literal-block { background: #eee; 40 | border: 1px solid #e6e6e6; color: #000; margin: 1em; padding: .25em; 41 | overflow: auto; 42 | } 43 | pre.variable { margin: 0; } 44 | 45 | /* Summary tables */ 46 | 47 | table.summary { margin: .5em 0; } 48 | table.summary tr.table-header { background: #f7f7f0; } 49 | table.summary td.table-header { color: #666; font-weight: bold; } 50 | table.summary th.group-header { background: #f7f7f0; color: #666; 51 | font-size: 90%; font-weight: bold; text-align: left; 52 | } 53 | table.summary th, table.summary td { border: 1px solid #d7d7d7; } 54 | table.summary th th, table.summary td td { border: none; } 55 | table.summary td.summary table td { color: #666; font-size: 90%; } 56 | table.summary td.summary table br { display: none; } 57 | table.summary td.summary span.summary-type { font-family: monospace; 58 | font-size: 90%; 59 | } 60 | table.summary td.summary span.summary-type code { font-size: 110%; } 61 | p.indent-wrapped-lines { color: #999; font-size: 85%; margin: 0; 62 | padding: 0 0 0 7em; text-indent: -7em; 63 | } 64 | p.indent-wrapped-lines code { color: #999; font-size: 115%; } 65 | p.indent-wrapped-lines :link, p.indent-wrapped-lines :visited { border: none; } 66 | .summary-sig { display: block; font-family: monospace; font-size: 120%; 67 | margin-bottom: .5em; 68 | } 69 | .summary-sig-name { font-weight: bold; } 70 | .summary-sig-arg { color: #333; } 71 | .summary-sig :link, .summary-sig :visited { border: none; } 72 | .summary-name { font-family: monospace; font-weight: bold; } 73 | 74 | /* Details tables */ 75 | 76 | table.details { margin: 2em 0 0; } 77 | div table.details { margin-top: 0; } 78 | table.details tr.table-header { background: transparent; } 79 | table.details td.table-header { border-bottom: 1px solid #ccc; padding: 2em 0 0; } 80 | table.details span.table-header { 81 | font: bold 140% Arial,Verdana,'Bitstream Vera Sans',Helvetica,sans-serif; 82 | letter-spacing: -0.018em; 83 | } 84 | table.details th, table.details td { border: none; } 85 | table.details th th, table.details td td { border: none; } 86 | table.details td { padding-left: 2em; } 87 | table.details td td { padding-left: 0; } 88 | table.details h3.epydoc { margin-left: -2em; } 89 | table.details h3.epydoc .sig { color: #999; font-family: monospace; } 90 | table.details h3.epydoc .sig-name { color: #000; } 91 | table.details h3.epydoc .sig-arg { color: #666; } 92 | table.details h3.epydoc .sig-default { font-size: 95%; font-weight: normal; } 93 | table.details h3.epydoc .sig-default code { font-weight: normal; } 94 | table.details h3.epydoc .fname { color: #999; font-size: 90%; 95 | font-style: italic; font-weight: normal; line-height: 1.6em; 96 | } 97 | 98 | dl dt { color: #666; margin-top: 1em; } 99 | dl dd { margin: 0; padding-left: 2em; } 100 | dl.fields { margin: 1em 0; padding: 0; } 101 | dl.fields dt { color: #666; margin-top: 1em; } 102 | dl.fields dd ul { margin: 0; padding: 0; } 103 | div.fields { font-size: 90%; margin: 0 0 2em 2em; } 104 | div.fields p { margin-bottom: 0.5em; } 105 | 106 | table td.footer { color: #999; font-size: 85%; margin-top: 3em; 107 | padding: 0 3em 1em; position: absolute; width: 80%; } 108 | table td.footer :link, table td.footer :visited { border: none; color: #999; } 109 | table td.footer :link:hover, table td.footer :visited:hover { 110 | background: transparent; text-decoration: underline; 111 | } 112 | 113 | /* Syntax highlighting */ 114 | 115 | .py-prompt, .py-more, .variable-ellipsis, .variable-op { color: #999; } 116 | .variable-group { color: #666; font-weight: bold; } 117 | .py-string, .variable-string, .variable-quote { color: #093; } 118 | .py-comment { color: #06f; font-style: italic; } 119 | .py-keyword { color: #00f; } 120 | .py-output { background: #f6f6f0; color: #666; font-weight: bold; } 121 | 122 | /* Index */ 123 | 124 | table.link-index { background: #f6f6f0; border: none; margin-top: 1em; } 125 | table.link-index td.link-index { border: none; font-family: monospace; 126 | font-weight: bold; padding: .5em 1em; 127 | } 128 | table.link-index td table, table.link-index td td { border: none; } 129 | table.link-index .index-where { color: #999; 130 | font-family: Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif; 131 | font-size: 90%; font-weight: normal; line-height: 1.6em; 132 | } 133 | table.link-index .index-where :link, table.link-index .index-where :visited { 134 | border: none; color: #666; 135 | } 136 | h2.epydoc { color: #999; font-size: 200%; line-height: 10px; } -------------------------------------------------------------------------------- /docs/epydoc/detection.tree-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection.tree 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package detection :: 46 | Module tree 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module tree

source code

64 | 65 | 66 | 68 | 69 | 80 | 81 | 82 | 85 | 86 | 87 | 90 | 91 |
70 | 71 | 72 | 73 | 77 | 78 |
Classes[hide private]
79 |
83 | Tree 84 |
88 | Node 89 |
92 | 93 | 94 | 96 | 97 | 108 | 109 | 110 | 115 | 116 |
98 | 99 | 100 | 101 | 105 | 106 |
Variables[hide private]
107 |
111 |   112 | 113 | __package__ = 'detection' 114 |
117 | 118 | 120 | 121 | 122 | 124 | 125 | 126 | 128 | 129 | 130 | 132 | 133 | 134 | 136 | 137 | 138 | 143 | 144 | 145 | 146 | 147 | 151 | 155 | 156 |
157 | 158 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/epydoc/detection.window_ui-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection.window_ui 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package detection :: 46 | Module window_ui 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module window_ui

source code

64 | 65 | 66 | 68 | 69 | 80 | 81 | 82 | 85 | 86 | 87 | 90 | 91 |
70 | 71 | 72 | 73 | 77 | 78 |
Classes[hide private]
79 |
83 | QTreeView 84 |
88 | WindowUI 89 |
92 | 93 | 94 | 96 | 97 | 108 | 109 | 110 | 115 | 116 |
98 | 99 | 100 | 101 | 105 | 106 |
Variables[hide private]
107 |
111 |   112 | 113 | __package__ = 'detection' 114 |
117 | 118 | 120 | 121 | 122 | 124 | 125 | 126 | 128 | 129 | 130 | 132 | 133 | 134 | 136 | 137 | 138 | 143 | 144 | 145 | 146 | 147 | 151 | 155 | 156 |
157 | 158 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/epydoc/detection.detector-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection.detector 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package detection :: 46 | Module detector 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module detector

source code

64 | 65 | 66 | 68 | 69 | 80 | 81 | 82 | 85 | 86 | 87 | 90 | 91 |
70 | 71 | 72 | 73 | 77 | 78 |
Classes[hide private]
79 |
83 | ClassifierParameters 84 |
88 | Detector 89 |
92 | 93 | 94 | 96 | 97 | 108 | 109 | 110 | 115 | 116 |
98 | 99 | 100 | 101 | 105 | 106 |
Variables[hide private]
107 |
111 |   112 | 113 | __package__ = 'detection' 114 |
117 | 118 | 120 | 121 | 122 | 124 | 125 | 126 | 128 | 129 | 130 | 132 | 133 | 134 | 136 | 137 | 138 | 143 | 144 | 145 | 146 | 147 | 151 | 155 | 156 |
157 | 158 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/epydoc/clustering-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 48 | 59 | 60 |
44 | 45 | Package clustering 46 | 47 | 49 | 50 | 51 | 53 | 57 |
[hide private]
[frames] | no frames]
58 |
61 | 62 |

Package clustering

source code

63 | 64 | 65 | 67 | 68 | 79 | 80 | 87 |
69 | 70 | 71 | 72 | 76 | 77 |
Submodules[hide private]
78 |
81 |
88 | 89 |
90 | 91 | 92 | 94 | 95 | 106 | 107 | 108 | 113 | 114 |
96 | 97 | 98 | 99 | 103 | 104 |
Variables[hide private]
105 |
109 |   110 | 111 | __package__ = None 112 |
115 | 116 | 118 | 119 | 120 | 122 | 123 | 124 | 126 | 127 | 128 | 130 | 131 | 132 | 134 | 135 | 136 | 141 | 142 | 143 | 144 | 145 | 149 | 153 | 154 |
155 | 156 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /src/mergevec.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include <_cvhaartraining.h> // Load CvVecFile 9 | // Write a vec header into the vec file (located at cvsamples.cpp) 10 | void icvWriteVecHeader( FILE* file, int count, int width, int height ); 11 | // Write a sample image into file in the vec format (located at cvsamples.cpp) 12 | void icvWriteVecSample( FILE* file, CvArr* sample ); 13 | // Append the body of the input vec to the ouput vec 14 | void icvAppendVec( CvVecFile &in, CvVecFile &out, int *showsamples, int winwidth, int winheight ); 15 | // Merge vec files 16 | void icvMergeVecs( char* infoname, const char* outvecname, int showsamples, int width, int height ); 17 | 18 | // Append the body of the input vec to the ouput vec 19 | void icvAppendVec( CvVecFile &in, CvVecFile &out, int *showsamples, int winwidth, int winheight ) 20 | { 21 | CvMat* sample; 22 | 23 | if( *showsamples ) 24 | { 25 | cvNamedWindow( "Sample", CV_WINDOW_AUTOSIZE ); 26 | } 27 | if( !feof( in.input ) ) 28 | { 29 | in.last = 0; 30 | in.vector = (short*) cvAlloc( sizeof( *in.vector ) * in.vecsize ); 31 | if ( *showsamples ) 32 | { 33 | if ( in.vecsize != winheight * winwidth ) 34 | { 35 | fprintf( stderr, "ERROR: -show: the size of images inside of vec files does not match with %d x %d, but %d\n", winheight, winwidth, in.vecsize ); 36 | exit(1); 37 | } 38 | sample = cvCreateMat( winheight, winwidth, CV_8UC1 ); 39 | } 40 | else 41 | { 42 | sample = cvCreateMat( in.vecsize, 1, CV_8UC1 ); 43 | } 44 | for( int i = 0; i < in.count; i++ ) 45 | { 46 | icvGetHaarTraininDataFromVecCallback( sample, &in ); 47 | icvWriteVecSample ( out.input, sample ); 48 | if( *showsamples ) 49 | { 50 | cvShowImage( "Sample", sample ); 51 | if( cvWaitKey( 0 ) == 27 ) 52 | { 53 | *showsamples = 0; 54 | } 55 | } 56 | } 57 | cvReleaseMat( &sample ); 58 | cvFree( (void**) &in.vector ); 59 | } 60 | } 61 | 62 | void icvMergeVecs( char* infoname, const char* outvecname, int showsamples, int width, int height ) 63 | { 64 | char onevecname[PATH_MAX]; 65 | int i = 0; 66 | int filenum = 0; 67 | short tmp; 68 | FILE *info; 69 | CvVecFile outvec; 70 | CvVecFile invec; 71 | int prev_vecsize; 72 | 73 | // fopen input and output file 74 | info = fopen( infoname, "r" ); 75 | if ( info == NULL ) 76 | { 77 | fprintf( stderr, "ERROR: Input file %s does not exist or not readable.\n", infoname ); 78 | exit(1); 79 | } 80 | outvec.input = fopen( outvecname, "wb" ); 81 | if ( outvec.input == NULL ) 82 | { 83 | fprintf( stderr, "ERROR: Output file %s is not writable.\n", outvecname ); 84 | exit(1); 85 | } 86 | 87 | // Header 88 | rewind( info ); 89 | outvec.count = 0; 90 | for ( filenum = 0; ; filenum++ ) 91 | { 92 | if ( fscanf( info, "%s", onevecname ) == EOF ) 93 | { 94 | break; 95 | } 96 | invec.input = fopen( onevecname, "rb" ); 97 | if ( invec.input == NULL ) 98 | { 99 | fprintf( stderr, "ERROR: Input file %s does not exist or not readable.\n", onevecname ); 100 | exit(1); 101 | } 102 | fread( &invec.count, sizeof( invec.count ) , 1, invec.input ); 103 | fread( &invec.vecsize, sizeof( invec.vecsize ), 1, invec.input ); 104 | fread( &tmp, sizeof( tmp ), 1, invec.input ); 105 | fread( &tmp, sizeof( tmp ), 1, invec.input ); 106 | 107 | outvec.count += invec.count; 108 | if( i > 0 && invec.vecsize != prev_vecsize ) 109 | { 110 | fprintf( stderr, "ERROR: The size of images in %s(%d) is different with the previous vec file(%d).\n", onevecname, invec.vecsize, prev_vecsize ); 111 | exit(1); 112 | } 113 | prev_vecsize = invec.vecsize; 114 | fclose( invec.input ); 115 | } 116 | outvec.vecsize = invec.vecsize; 117 | icvWriteVecHeader( outvec.input, outvec.count, outvec.vecsize, 1); 118 | 119 | // Contents 120 | rewind( info ); 121 | outvec.count = 0; 122 | for ( i = 0; i < filenum ; i++ ) 123 | { 124 | if (fscanf( info, "%s", onevecname ) == EOF) { 125 | break; 126 | } 127 | invec.input = fopen( onevecname, "rb" ); 128 | fread( &invec.count, sizeof( invec.count ) , 1, invec.input ); 129 | fread( &invec.vecsize, sizeof( invec.vecsize ), 1, invec.input ); 130 | fread( &tmp, sizeof( tmp ), 1, invec.input ); 131 | fread( &tmp, sizeof( tmp ), 1, invec.input ); 132 | 133 | icvAppendVec( invec, outvec, &showsamples, width, height ); 134 | fclose( invec.input ); 135 | } 136 | fclose( outvec.input ); 137 | } 138 | 139 | int main( int argc, char **argv ) 140 | { 141 | int i; 142 | char *infoname = NULL; 143 | char *outvecname = NULL; 144 | int showsamples = 0; 145 | int width = 24; 146 | int height = 24; 147 | 148 | if( argc == 1 ) 149 | { 150 | printf( "Usage: %s\n \n" 151 | " \n" 152 | " [-show] [-w ] [-h ]\n", 153 | argv[0], width, height ); 154 | return 0; 155 | } 156 | for( i = 1; i < argc; ++i ) 157 | { 158 | if( !strcmp( argv[i], "-show" ) ) 159 | { 160 | showsamples = 1; 161 | // width = atoi( argv[++i] ); // obsolete -show width height 162 | // height = atoi( argv[++i] ); 163 | } 164 | else if( !strcmp( argv[i], "-w" ) ) 165 | { 166 | width = atoi( argv[++i] ); 167 | } 168 | else if( !strcmp( argv[i], "-h" ) ) 169 | { 170 | height = atoi( argv[++i] ); 171 | } 172 | else if( argv[i][0] == '-' ) 173 | { 174 | fprintf( stderr, "ERROR: The option %s does not exist. n", argv[i] ); 175 | exit(1); 176 | } 177 | else if( infoname == NULL ) 178 | { 179 | infoname = argv[i]; 180 | } 181 | else if( outvecname == NULL ) 182 | { 183 | outvecname = argv[i]; 184 | } 185 | } 186 | if( infoname == NULL ) 187 | { 188 | fprintf( stderr, "ERROR: No input file\n" ); 189 | exit(1); 190 | } 191 | if( outvecname == NULL ) 192 | { 193 | fprintf( stderr, "ERROR: No output file\n" ); 194 | exit(1); 195 | } 196 | icvMergeVecs( infoname, outvecname, showsamples, width, height ); 197 | return 0; 198 | } 199 | -------------------------------------------------------------------------------- /docs/epydoc/detection-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 48 | 59 | 60 |
44 | 45 | Package detection 46 | 47 | 49 | 50 | 51 | 53 | 57 |
[hide private]
[frames] | no frames]
58 |
61 | 62 |

Package detection

source code

63 | 64 | 65 | 67 | 68 | 79 | 80 | 89 |
69 | 70 | 71 | 72 | 76 | 77 |
Submodules[hide private]
78 |
81 |
90 | 91 |
92 | 93 | 94 | 96 | 97 | 108 | 109 | 110 | 115 | 116 |
98 | 99 | 100 | 101 | 105 | 106 |
Variables[hide private]
107 |
111 |   112 | 113 | __package__ = None 114 |
117 | 118 | 120 | 121 | 122 | 124 | 125 | 126 | 128 | 129 | 130 | 132 | 133 | 134 | 136 | 137 | 138 | 143 | 144 | 145 | 146 | 147 | 151 | 155 | 156 |
157 | 158 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/epydoc/detection.common.CustomException-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection.common.CustomException 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 50 | 61 | 62 |
44 | 45 | Package detection :: 46 | Module common :: 47 | Class CustomException 48 | 49 | 51 | 52 | 53 | 55 | 59 |
[hide private]
[frames] | no frames]
60 |
63 | 64 |

type CustomException

source code

65 |
66 | 67 |
68 |
69 | 70 | 71 | 73 | 74 | 85 | 86 | 87 | 105 | 106 |
75 | 76 | 77 | 78 | 82 | 83 |
Instance Methods[hide private]
84 |
88 |

Inherited from exceptions.Exception: 89 | __init__, 90 | __new__ 91 |

92 |

Inherited from exceptions.BaseException: 93 | __delattr__, 94 | __getattribute__, 95 | __getitem__, 96 | __getslice__, 97 | __reduce__, 98 | __repr__, 99 | __setattr__, 100 | __setstate__, 101 | __str__, 102 | __unicode__ 103 |

104 |
107 | 108 | 109 | 111 | 112 | 123 | 124 | 125 | 131 | 132 |
113 | 114 | 115 | 116 | 120 | 121 |
Properties[hide private]
122 |
126 |

Inherited from exceptions.BaseException: 127 | args, 128 | message 129 |

130 |
133 | 134 | 136 | 137 | 138 | 140 | 141 | 142 | 144 | 145 | 146 | 148 | 149 | 150 | 152 | 153 | 154 | 159 | 160 | 161 | 162 | 163 | 167 | 171 | 172 |
173 | 174 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /docs/epydoc/toc-everything.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Everything 7 | 8 | 9 | 10 | 11 | 13 |

Everything

14 |
15 |

All Classes

16 | PyQt5.QtCore.QThread.Priority
PyQt5.QtGui.QPaintDevice.PaintDeviceMetric
PyQt5.QtWidgets.QAbstractItemView.CursorAction
PyQt5.QtWidgets.QAbstractItemView.DragDropMode
PyQt5.QtWidgets.QAbstractItemView.DropIndicatorPosition
PyQt5.QtWidgets.QAbstractItemView.EditTrigger
PyQt5.QtWidgets.QAbstractItemView.EditTriggers
PyQt5.QtWidgets.QAbstractItemView.ScrollHint
PyQt5.QtWidgets.QAbstractItemView.ScrollMode
PyQt5.QtWidgets.QAbstractItemView.SelectionBehavior
PyQt5.QtWidgets.QAbstractItemView.SelectionMode
PyQt5.QtWidgets.QAbstractItemView.State
PyQt5.QtWidgets.QAbstractScrollArea.SizeAdjustPolicy
PyQt5.QtWidgets.QFrame.Shadow
PyQt5.QtWidgets.QFrame.Shape
PyQt5.QtWidgets.QFrame.StyleMask
PyQt5.QtWidgets.QWidget.RenderFlag
PyQt5.QtWidgets.QWidget.RenderFlags
detection.common.CustomException
detection.common.EmittingStream
detection.detection.MediaThread
detection.detection.Window
detection.detector.ClassifierParameters
detection.detector.Detector
detection.tree.Node
detection.tree.Tree
detection.window_ui.QTreeView
detection.window_ui.WindowUI

All Functions

45 | detection.common.blurPixmap
detection.common.checkerboard
detection.common.fitImageToScreen
detection.common.getObjectsTree
detection.common.np2Qt
detection.common.scaleRect
detection.common.setPickerColor
detection.detection.main
detection.setup.delete_old_app

All Variables

55 | detection.__package__
detection.common.__package__
detection.detection.__package__
detection.detector.__package__
detection.setup.ICON
detection.setup.MAIN
detection.setup.NAME
detection.setup.PWD
detection.setup.VERSION
detection.setup.__package__
detection.setup.extra_options
detection.tree.__package__
detection.window_ui.__package__

69 | [hide private] 71 | 72 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /docs/epydoc/detection.detector.ClassifierParameters-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection.detector.ClassifierParameters 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 50 | 61 | 62 |
44 | 45 | Package detection :: 46 | Module detector :: 47 | Class ClassifierParameters 48 | 49 | 51 | 52 | 53 | 55 | 59 |
[hide private]
[frames] | no frames]
60 |
63 | 64 |

classobj ClassifierParameters

source code

65 | 66 | 67 | 69 | 70 | 81 | 82 | 83 | 110 | 111 |
71 | 72 | 73 | 74 | 78 | 79 |
Instance Methods[hide private]
80 |
84 |   85 | 86 | 87 | 88 | 102 | 106 | 107 |
__init__(self, 89 | hash, 90 | classifier, 91 | name, 92 | color, 93 | shape, 94 | fill, 95 | fillPath='', 96 | stabilize=False, 97 | tracking=False, 98 | showName=True, 99 | scaleFactor=1.3, 100 | minNeighbors=4, 101 | minSize=(0, 0)) 103 | source code 104 | 105 |
108 | 109 |
112 | 113 | 115 | 116 | 117 | 119 | 120 | 121 | 123 | 124 | 125 | 127 | 128 | 129 | 131 | 132 | 133 | 138 | 139 | 140 | 141 | 142 | 146 | 150 | 151 |
152 | 153 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /docs/epydoc/clustering.voronoi1-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering.voronoi1 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package clustering :: 46 | Module voronoi1 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module voronoi1

64 | 65 | 66 | 68 | 69 | 80 | 81 | 82 | 98 | 99 | 100 | 115 | 116 |
70 | 71 | 72 | 73 | 77 | 78 |
Functions[hide private]
79 |
83 |   84 | 85 | 86 | 87 | 90 | 94 | 95 |
circumCircle(pts)
88 | Return the center of the circumcircle of the triangle defined by 89 | points.
91 | 92 | 93 |
96 | 97 |
101 |   102 | 103 | 104 | 105 | 107 | 111 | 112 |
voronoi(points)
106 | Return line segments describing the voronoi diagram of points.
108 | 109 | 110 |
113 | 114 |
117 | 118 | 119 | 121 | 122 | 133 | 134 | 135 | 140 | 141 |
123 | 124 | 125 | 126 | 130 | 131 |
Variables[hide private]
132 |
136 |   137 | 138 | __package__ = 'clustering' 139 |
142 | 143 | 145 | 146 | 147 | 149 | 150 | 151 | 153 | 154 | 155 | 157 | 158 | 159 | 161 | 162 | 163 | 168 | 169 | 170 | 171 | 172 | 176 | 180 | 181 |
182 | 183 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /docs/epydoc/clustering.setup-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering.setup 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package clustering :: 46 | Module setup 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module setup

source code

64 |
 65 | 
 66 | This is a setup.py script generated by py2applet
 67 | 
 68 | Usage:
 69 |     python setup.py py2app
 70 | 
 71 | 
72 | 73 | 74 | 75 | 77 | 78 | 89 | 90 | 91 | 96 | 97 | 98 | 103 | 104 | 105 | 111 | 112 |
79 | 80 | 81 | 82 | 86 | 87 |
Variables[hide private]
88 |
92 |   93 | 94 | APP = ['clustering.py'] 95 |
99 |   100 | 101 | DATA_FILES = [] 102 |
106 |   107 | 108 | OPTIONS = {'argv_emulation': True, 'includes': ['PyQt5'], 'pli... 110 |
113 | 114 | 115 | 117 | 118 | 129 | 130 |
119 | 120 | 121 | 122 | 126 | 127 |
Variables Details[hide private]
128 |
131 | 132 |
133 | 135 |
136 |

OPTIONS

137 | 138 |
139 |
140 |
141 |
Value:
142 |
143 | {'argv_emulation': True, 'includes': ['PyQt5'], 'plist': {'CFBundleSho\
144 | rtVersionString': '0.1.0',}, 'iconfile': 'icon.icns'}
145 | 
146 |
147 |
148 |
149 |
150 |
151 | 152 | 154 | 155 | 156 | 158 | 159 | 160 | 162 | 163 | 164 | 166 | 167 | 168 | 170 | 171 | 172 | 177 | 178 | 179 | 180 | 181 | 185 | 189 | 190 |
191 | 192 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /docs/epydoc/clustering.voronoi-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering.voronoi 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package clustering :: 46 | Module voronoi 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module voronoi

source code

64 | 65 | 66 | 68 | 69 | 80 | 81 | 82 | 98 | 99 | 100 | 115 | 116 |
70 | 71 | 72 | 73 | 77 | 78 |
Functions[hide private]
79 |
83 |   84 | 85 | 86 | 87 | 90 | 94 | 95 |
circumCircle(pts)
88 | Return the center of the circumcircle of the triangle defined by 89 | points.
91 | source code 92 | 93 |
96 | 97 |
101 |   102 | 103 | 104 | 105 | 107 | 111 | 112 |
voronoi(points)
106 | Return line segments describing the voronoi diagram of points.
108 | source code 109 | 110 |
113 | 114 |
117 | 118 | 119 | 121 | 122 | 133 | 134 | 135 | 140 | 141 |
123 | 124 | 125 | 126 | 130 | 131 |
Variables[hide private]
132 |
136 |   137 | 138 | __package__ = 'clustering' 139 |
142 | 143 | 145 | 146 | 147 | 149 | 150 | 151 | 153 | 154 | 155 | 157 | 158 | 159 | 161 | 162 | 163 | 168 | 169 | 170 | 171 | 172 | 176 | 180 | 181 |
182 | 183 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /docs/epydoc/detection.detection-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection.detection 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package detection :: 46 | Module detection 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module detection

source code

64 | 65 | 66 | 68 | 69 | 80 | 81 | 82 | 85 | 86 | 87 | 90 | 91 |
70 | 71 | 72 | 73 | 77 | 78 |
Classes[hide private]
79 |
83 | MediaThread 84 |
88 | Window 89 |
92 | 93 | 94 | 96 | 97 | 108 | 109 | 110 | 124 | 125 |
98 | 99 | 100 | 101 | 105 | 106 |
Functions[hide private]
107 |
111 |   112 | 113 | 114 | 115 | 116 | 120 | 121 |
main() 117 | source code 118 | 119 |
122 | 123 |
126 | 127 | 128 | 130 | 131 | 142 | 143 | 144 | 149 | 150 |
132 | 133 | 134 | 135 | 139 | 140 |
Variables[hide private]
141 |
145 |   146 | 147 | __package__ = 'detection' 148 |
151 | 152 | 154 | 155 | 156 | 158 | 159 | 160 | 162 | 163 | 164 | 166 | 167 | 168 | 170 | 171 | 172 | 177 | 178 | 179 | 180 | 181 | 185 | 189 | 190 |
191 | 192 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /docs/epydoc/detection.tree.Node-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection.tree.Node 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 50 | 61 | 62 |
44 | 45 | Package detection :: 46 | Module tree :: 47 | Class Node 48 | 49 | 51 | 52 | 53 | 55 | 59 |
[hide private]
[frames] | no frames]
60 |
63 | 64 |

classobj Node

source code

65 | 66 | 67 | 69 | 70 | 81 | 82 | 83 | 99 | 100 | 101 | 115 | 116 | 117 | 132 | 133 | 134 | 148 | 149 |
71 | 72 | 73 | 74 | 78 | 79 |
Instance Methods[hide private]
80 |
84 |   85 | 86 | 87 | 88 | 91 | 95 | 96 |
__init__(self, 89 | name, 90 | data=None) 92 | source code 93 | 94 |
97 | 98 |
102 |   103 | 104 | 105 | 106 | 107 | 111 | 112 |
__hash__(self) 108 | source code 109 | 110 |
113 | 114 |
118 |   119 | 120 | 121 | 122 | 124 | 128 | 129 |
__eq__(self, 123 | other) 125 | source code 126 | 127 |
130 | 131 |
135 |   136 | 137 | 138 | 139 | 140 | 144 | 145 |
__repr__(self) 141 | source code 142 | 143 |
146 | 147 |
150 | 151 | 153 | 154 | 155 | 157 | 158 | 159 | 161 | 162 | 163 | 165 | 166 | 167 | 169 | 170 | 171 | 176 | 177 | 178 | 179 | 180 | 184 | 188 | 189 |
190 | 191 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /docs/epydoc/clustering.clustering-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering.clustering 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package clustering :: 46 | Module clustering 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module clustering

source code

64 | 65 | 66 | 68 | 69 | 80 | 81 | 82 | 85 | 86 | 87 | 90 | 91 | 92 | 95 | 96 |
70 | 71 | 72 | 73 | 77 | 78 |
Classes[hide private]
79 |
83 | EmittingStream 84 |
88 | ClustererThread 89 |
93 | Window 94 |
97 | 98 | 99 | 101 | 102 | 113 | 114 | 115 | 129 | 130 |
103 | 104 | 105 | 106 | 110 | 111 |
Functions[hide private]
112 |
116 |   117 | 118 | 119 | 120 | 121 | 125 | 126 |
main() 122 | source code 123 | 124 |
127 | 128 |
131 | 132 | 133 | 135 | 136 | 147 | 148 | 149 | 154 | 155 |
137 | 138 | 139 | 140 | 144 | 145 |
Variables[hide private]
146 |
150 |   151 | 152 | __package__ = 'clustering' 153 |
156 | 157 | 159 | 160 | 161 | 163 | 164 | 165 | 167 | 168 | 169 | 171 | 172 | 173 | 175 | 176 | 177 | 182 | 183 | 184 | 185 | 186 | 190 | 194 | 195 |
196 | 197 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /docs/epydoc/clustering.clusterer-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering.clusterer 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package clustering :: 46 | Module clusterer 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module clusterer

source code

64 | 65 | 66 | 68 | 69 | 80 | 81 | 82 | 85 | 86 | 87 | 91 | 92 |
70 | 71 | 72 | 73 | 77 | 78 |
Classes[hide private]
79 |
83 | Graph 84 |
88 | Clusterer
89 | Extract image clusters. 90 |
93 | 94 | 95 | 97 | 98 | 109 | 110 | 111 | 116 | 117 | 118 | 126 | 127 |
99 | 100 | 101 | 102 | 106 | 107 |
Variables[hide private]
108 |
112 |   113 | 114 | __package__ = 'clustering' 115 |
119 |   120 | 121 | __warningregistry__ = {('Not importing directory \'/Users/xs_y... 125 |
128 | 129 | 130 | 132 | 133 | 144 | 145 |
134 | 135 | 136 | 137 | 141 | 142 |
Variables Details[hide private]
143 |
146 | 147 |
148 | 150 |
151 |

__warningregistry__

152 | 153 |
154 |
155 |
156 |
Value:
157 |
158 | {('Not importing directory \'/Users/xs_yann/scm/matplotlib\': missing \
159 | __init__.py',
160 |   <type 'exceptions.ImportWarning'>,
161 |   17): True}
162 | 
163 |
164 |
165 |
166 |
167 |
168 | 169 | 171 | 172 | 173 | 175 | 176 | 177 | 179 | 180 | 181 | 183 | 184 | 185 | 187 | 188 | 189 | 194 | 195 | 196 | 197 | 198 | 202 | 206 | 207 |
208 | 209 | 218 | 219 | 220 | -------------------------------------------------------------------------------- /docs/epydoc/clustering.setup-pysrc.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | clustering.setup 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package clustering :: 46 | Module setup 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 |

Source Code for Module clustering.setup

63 |
 64 |  1  """ 
 65 |  2  This is a setup.py script generated by py2applet 
 66 |  3   
 67 |  4  Usage: 
 68 |  5      python setup.py py2app 
 69 |  6  """ 
 70 |  7   
 71 |  8  from setuptools import setup 
 72 |  9   
 73 | 10  APP = ['clustering.py'] 
 74 | 11  DATA_FILES = [] 
 75 | 12  OPTIONS = {'argv_emulation': True, 'includes': ['PyQt5'], 
 76 | 13             'plist': {'CFBundleShortVersionString':'0.1.0',}, 
 77 | 14             'iconfile':'icon.icns'} 
 78 | 15   
 79 | 16  setup(name='Clustering', 
 80 | 17      app=APP, 
 81 | 18      data_files=DATA_FILES, 
 82 | 19      options={'py2app': OPTIONS}, 
 83 | 20      setup_requires=['py2app'], 
 84 | 21  ) 
 85 | 22   
 90 | 
91 |
92 | 93 | 95 | 96 | 97 | 99 | 100 | 101 | 103 | 104 | 105 | 107 | 108 | 109 | 111 | 112 | 113 | 118 | 119 | 120 | 121 | 122 | 126 | 130 | 131 |
132 | 133 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Detection 2 | ========= 3 | 4 | Object detection using OpenCV Haar Feature-based Cascade Classifiers 5 | 6 | ![screen](http://www.xsyann.com/epitech/detection.png) 7 | 8 | ### Install 9 | 10 | git clone https://github.com/xsyann/detection.git 11 | 12 | ### Usage 13 | 14 | python detection.py 15 | 16 | 17 | ### Requirements 18 | 19 | cv2, numpy, PyQt5 20 | 21 | ### Features 22 | 23 | ![icon](http://www.xsyann.com/epitech/detection_icon.png) 24 | 25 | **Source** 26 | 27 | * `File` : Image / video path or url 28 | * `Camera` 29 | 30 | **Pre-processing** 31 | 32 | * `Input` : Display source image 33 | * `Pre-processed` : Display pre-processed image 34 | * `Equalize histogram` : Equalize the source histogram before detecting 35 | 36 | **Detect** 37 | 38 | Select classifiers by add / removing classifiers with arrows. 39 | Hierarchize the tree by dragging classifiers. 40 | 41 | **Classifier display** 42 | 43 | * `Show name` 44 | * `Shape` : Rectangle / Ellipse 45 | * `Transparent` : The outline of the selected shape is displayed 46 | * `Color` : A filled shape is displayed 47 | * `Image` : The selected image source is displayed inside the shape 48 | * `Blur` : The shape is blurred 49 | 50 | **Classifier parameters** 51 | 52 | * `Stabilize` : Store detected objects when checked and try to retreive them on next frame. Allow to avoid jump between frames. 53 | * `Tracking` : Draw lines between each previous positions of detected objects (stabilization is enabled when tracking is checked). 54 | * `Scale factor` : How much the image size is reduced at each image scale 55 | * `Min neighbors` : How many neighbors each candidate rectangle should have to retain it 56 | * `Auto neighbors` : Increase `Min neighbors` until the number of detected objects is lower or equal at the selected parameter 57 | * `Minimum Size` : Minimum possible object size. Objects smaller than that are ignored 58 | 59 | ### References 60 | 61 | * http://note.sonots.com/SciSoftware/haartraining.html 62 | * http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html 63 | * http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html 64 | * http://makematics.com/research/viola-jones/ 65 | * http://docs.opencv.org/trunk/doc/py_tutorials/py_objdetect/py_face_detection/py_face_detection.html 66 | 67 | 68 | ### More 69 | 70 | #### Méthode de Viola et Jones 71 | 72 | La méthode de Viola et Jones consiste à entrainer une fonction à reconnaitre si un objet est présent ou non dans une zone de l’image. 73 | 74 | **Entrainement** 75 | 76 | L’algorithme d’entrainement nécessite une importante quantité d’images positives (contenant l’objet) et négatives (ne contenant pas l’objet). Le but est d'extraire des caractéristiques à partir de ces images. 77 | Les caractéristiques, appelées caractéristiques pseudo-Haar, représentent la différence de sommes de pixels de plusieurs zones rectangulaires adjacentes. 78 | 79 | Voici les types de base de caractéristiques utilisés par OpenCV : 80 | 81 | ![haar](http://docs.opencv.org/_images/haarfeatures.png) 82 | 83 | Une caractéristique correspond donc à un nombre obtenu par la soustraction de la somme des pixels sous les rectangles blancs et de la somme des pixels sous les rectangles noirs. Cela permet de comparer l’intensité lumineuse moyenne des zones blanches et noires. 84 | 85 | ![haar](http://docs.opencv.org/trunk/_images/haar.png) 86 | 87 | Chaque type de base peut être décliné en combinant différentes largeurs / hauteurs / positions. Pour une image de 24x24 cela représente plus de 160000 caractéristiques possibles (cf. doc OpenCV). 88 | Certaines caractéristiques sont plus intéressantes que d’autres comme par exemple les deux ci-dessus. La première permet de comparer la région des yeux (sombre) avec la région des joues et du nez (plus claire). La seconde permet de comparer les yeux (sombre) avec l’arrête du nez (plus claire). 89 | 90 | Il s’agit, pour chaque caractéristique, de trouver le seuil qui classe le plus d’images correctement. Les caractéristiques avec le taux d’erreurs le plus bas sont alors sélectionnées et sont appelées classifieurs “faibles”. Un classifieur est considéré comme faible à partir du moment où il possède un taux d’erreur inférieur à un classifieur aléatoire. 91 | Un classifieur faible ne peut pas classifier tout seul une image, mais un ensemble de classifieurs faibles (pondérés) le peut et est alors appelé classifieur “fort”. 92 | 93 | Cependant, appliquer les classifieurs à chaque zone de l’image pour détecter la présence d’un objet n’est pas très efficace étant donné que la plupart des zones de l’image ne contiennent pas cet objet. 94 | C’est pour cela qu’a été introduit le concept de cascades. Les cascades permettent de détecter l’absence d’un objet et donc d’éliminer rapidement une zone inintéressante. 95 | En effet, les cascades groupent les classifieurs en différentes étapes ; à chaque étape, si la zone est classée negative, cette dernière est éliminée, sinon l’étape suivante est calculée. 96 | Cela permet d’écarter une image négative dès qu’une étape n’est pas validée et de garder une image positive seulement si toutes les étapes sont validées. 97 | 98 | *Exemple:* 99 | 100 | Etape 1 : 1 classifieur 101 | Etape 2 : 10 classifieurs 102 | Etape 3 : 25 classifieurs 103 | Etape 4 : 25 classifieurs 104 | Etape 5 : 50 classifieurs 105 | ... 106 | 107 | **Optimisations** 108 | 109 | Les sommes de pixels sont calculées très rapidement grâce aux images intégrales. 110 | 111 | Une image intégrale est une image dans laquelle chaque pixel contient la somme des pixels à gauche et au-dessus de lui. 112 | Ainsi pour une caractéristique à deux rectangles il suffit d’accéder à seulement six pixels de l’image intégrale pour calculer la différence des sommes des pixels. 113 | 114 | **Détection** 115 | 116 | Une fenêtre de détection de petite taille est définie (par exemple 20x20). La cascade de classifieurs détecte si un objet est présent dans cette zone. À chaque itération la fenêtre de détection est décalé d’un pixel (ou plus), afin de balayer toute l’image. Une fois balayée, la fenêtre de détection est agrandie (ou l’image réduite, suivant l’implémentation), et le processus est recommencé afin de tester des zones de toutes tailles. 117 | 118 | Le fait de tester des zones de toutes tailles et positions induit le fait que le même objet peut être détecté dans plusieurs zones. Les zones se chevauchant sont regroupées en une zone "moyenne". 119 | Il est possible de définir un nombre minimal de zones se chevauchant au-dessus duquel l'objet est considéré comme détecté, afin d'éliminer les faux positifs. 120 | 121 | http://vimeo.com/12774628 122 | 123 | #### Égalisation d’histogramme 124 | 125 | Un histogramme est la représentation graphique de la distribution des intensités d’une image. 126 | L’égalisation d’histogramme sert à augmenter le contraste en répartissant mieux les intensités. 127 | Graphiquement cela revient à "étaler" l’histogramme. 128 | 129 | ![histo](http://docs.opencv.org/_images/Histogram_Equalization_Theory_1.jpg) 130 | 131 | #### Stabilisation 132 | 133 | Le but étant de retrouver, dans l’image courante, les objets détectés dans l’image précédente. 134 | 135 | Si un objet de l’image précédente n’est pas associé à un objet de l’image courante, il est laissé à la même position. 136 | Pour chaque objet précédent il s’agit de trouver l’objet de l’image courante le plus près de lui qui ne soit pas plus près d’un autre objet de l’image précédente. 137 | 138 | *Algorithme simplifié :* 139 | 140 | for prev in previous: 141 | obj = retreiveObject(prev) 142 | 143 | def retreiveObject(prev): 144 | nearestCurrent = getNearest(from=prev, in=current) 145 | nearestPrev = None 146 | while previousObjects.notEmpty() and nearestCurrent: 147 | nearestPrev = getNearest(from=nearestCurrent, in=previousObjects) 148 | if nearestPrev != prev: 149 | previousObjects.remove(nearestPrev) 150 | currentObjects.remove(nearestCurrent) 151 | nearestCurrent = getNearest(from=prev, in=currentObjects) 152 | else: 153 | break 154 | 155 | return nearestCurrent 156 | 157 | 158 | #### Entrainement 159 | 160 | 1. Regrouper les chemins de fichiers des images positives et negatives 161 | 162 | `find ./positives -iname "*.jpg" > positives.txt` 163 | `find ./negatives -iname "*.jpg" > negatives.txt` 164 | 165 | 2. Créer des échantillons à partir des images positives 166 | 167 | `opencv_createsamples` permet de créer des échantillons en combinant une image positive déformée et des images negatives. 168 | Le script `createsamples.pl` permet de répéter l’operation pour chaque image positive afin d’atteindre le nombre d’échantillons passé en paramètre. 169 | 170 | `perl bin/createsamples.pl positives.txt negatives.txt samples 2000 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 25 -h 24"` 171 | 172 | Le format de sortie est un format de description qui contient le contenu des images suivi du nombre d’objets présents dedans, ainsi que leurs positions dans l’image. 173 | 174 | 3. Regrouper les échantillons dans un fichier 175 | 176 | `find ./samples -name '*.vec' > samples.txt` 177 | 178 | `./bin/mergevec samples.txt samples.vec` 179 | 180 | 4. Entrainer 181 | 182 | `opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt -numStages 12 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1800 -numNeg 1200 -w 25 -h 24 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024 -featureType LBP` 183 | 184 | * `numStages` : Nombre d’étape dans la cascade 185 | * `minHitRate` : Taux minimal de bonne classification 186 | * `minFalseAlarmRate` : Taux minimal de faux positif par étape 187 | * `featureType` : Pseudo-Haar ou Motif binaire local (LBP) 188 | 189 | #### Informations 190 | 191 | Pour compiler OpenCV avec le support "Threading Building Blocks" pour profiter pleinement de la puissance de tous les coeurs du processeur. 192 | 193 | $ cd opencv 194 | $ mkdir build 195 | $ cd build 196 | $ cmake -D WITH_TBB=ON 197 | $ make -j8 198 | $ sudo make install 199 | -------------------------------------------------------------------------------- /docs/epydoc/detection.common.EmittingStream-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | detection.common.EmittingStream 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 50 | 61 | 62 |
44 | 45 | Package detection :: 46 | Module common :: 47 | Class EmittingStream 48 | 49 | 51 | 52 | 53 | 55 | 59 |
[hide private]
[frames] | no frames]
60 |
63 | 64 |

pyqtWrapperType EmittingStream

source code

65 |
66 | 67 |
68 |
69 | 70 | 71 | 73 | 74 | 85 | 86 | 87 | 101 | 102 | 103 | 118 | 119 | 120 | 170 | 171 |
75 | 76 | 77 | 78 | 82 | 83 |
Instance Methods[hide private]
84 |
88 |   89 | 90 | 91 | 92 | 93 | 97 | 98 |
textWritten(...) 94 | source code 95 | 96 |
99 | 100 |
104 |   105 | 106 | 107 | 108 | 110 | 114 | 115 |
write(self, 109 | text) 111 | source code 112 | 113 |
116 | 117 |
121 |

Inherited from PyQt5.QtCore.QObject: 122 | __getattr__, 123 | blockSignals, 124 | childEvent, 125 | children, 126 | connectNotify, 127 | customEvent, 128 | deleteLater, 129 | destroyed, 130 | disconnect, 131 | disconnectNotify, 132 | dumpObjectInfo, 133 | dumpObjectTree, 134 | dynamicPropertyNames, 135 | event, 136 | eventFilter, 137 | findChild, 138 | findChildren, 139 | inherits, 140 | installEventFilter, 141 | isSignalConnected, 142 | isWidgetType, 143 | isWindowType, 144 | killTimer, 145 | metaObject, 146 | moveToThread, 147 | objectName, 148 | objectNameChanged, 149 | parent, 150 | property, 151 | pyqtConfigure, 152 | receivers, 153 | removeEventFilter, 154 | sender, 155 | senderSignalIndex, 156 | setObjectName, 157 | setParent, 158 | setProperty, 159 | signalsBlocked, 160 | startTimer, 161 | thread, 162 | timerEvent, 163 | tr 164 |

165 |

Inherited from sip.simplewrapper: 166 | __init__, 167 | __new__ 168 |

169 |
172 | 173 | 174 | 176 | 177 | 188 | 189 | 190 | 195 | 196 |
178 | 179 | 180 | 181 | 185 | 186 |
Class Variables[hide private]
187 |
191 |

Inherited from PyQt5.QtCore.QObject: 192 | staticMetaObject 193 |

194 |
197 | 198 | 200 | 201 | 202 | 204 | 205 | 206 | 208 | 209 | 210 | 212 | 213 | 214 | 216 | 217 | 218 | 223 | 224 | 225 | 226 | 227 | 231 | 235 | 236 |
237 | 238 | 247 | 248 | 249 | --------------------------------------------------------------------------------