230 likes | 330 Views
Counting windows. 1. 2. 3. 4. 5. 6. 7. 8. Project participants (in alphabetical order): Akif Durdu Middle East Technical University, Turkiye Viktor Jónás Budapest Polytechnic, Hungary Csaba Pintér University of Szeged, Hungary
E N D
Counting windows 1 2 3 4 5 6 7 8 • Project participants • (in alphabetical order): • Akif Durdu Middle East Technical University, Turkiye • Viktor Jónás Budapest Polytechnic, Hungary • Csaba PintérUniversity of Szeged, Hungary • Péter Rieger Budapest Polytechnic, Hungary • Umut Tilki Middle East Technical University, Turkiye
Project Overview Main task was to count windows on the photo of a building Input: - Image that the user wants to count windows in - A length of the diagonal of an average sized window (user selects it on the input picture) Output: - Number of found windows- Output picture containing the original picture and the contours of the found windows
Overview: • Preprocessing • Detecting lines with Hough transformation It will define boxes (creates separate quads) unifying “similar” boxes • Classify remaining boxes (windows <-> non-windows)
Preprocessing: • Converting image to grayscale • Normalizing • Median filter (blurring) • Sobel operator (finding edges) • Opening
Preprocessing 1 – Converting to grayscale: • Color information is not so important during preprocessing • Faster • Easier to handle
Preprocessing 2 – Normalizing • Greater contrast • More determining edges
Preprocessing 3 – Median filter • Blurs the unimportant edges (e.g. gutters, window frames (inner+outer=2)) • Still preserves the other edges • Disadvantage: rounds corners (Hough can compensate) • Parameters: • repetitions: 3 • window size: square root of the user input window diagonal
Preprocessing 4 – Sobel operator • Finds the edges • Prepares the picture for Hough transform
Preprocessing 5 – Opening • Dilation + erosion • Reduces remaining noise (unifies broken edges) • Makes possible double frame edges disappear
Detecting lines with Hough transformation: • Applying Hough transformation • Finding local maxima (finding the important lines) • Applying inverse Hough transformation(projecting found lines back)
Hough 1 – Applying • Image space -> Hough space transformation • Strong lines with higher intensity
Hough 2 – Finding local maxima • Separating dominant lines • Window size: 3*sqrt(UI diagonal)
Hough 3 – Inverse Hough transformation • Hough space -> image space[inverse Hough formulas] • Projecting dominant lines back • It defines boxes (general quads) actual ideal
Unifying “similar” boxes • Classify image to boxes (floodfill) • computing statistics • unifying “similar” boxes(similar <-> their statistics have little difference)
Unifying 1 – Flood fill • It classifies image to boxes • Each class is a general quad • it is done with a simple floodfill until there are any black spots remaining • the color values of the areas represent the classes
Unifying 2 – Statistics • They are used to represent a kind of similarity measure • Statistics: mean and variance of each color channelssome more statistics: center coordinates, area (for an easier determination of neighbourhood) The sample variance Eqn. The sample meanEqn.
Unifying 3 – The unifying itself • we must decrease the number of classes radically • the reamaining classes may be • whole windows (we hope ) • larger homogeneous areas (roof, grass, sky …)
Unifying 3 – The unifying itself • The unifying algorithm put each class into a queue while (there is a class in the queue) { while (there is a similar neighbor) { unify them compute new statistics } remove from queue }
Classifying remaining boxes • we must decide if an area represents a window or not • we do this according to the user input “ideal” window • the idea:if the ratio of edges or area is reasonable, let’s consider it to be a window, else it possibly belong to the class of non-windows
THE END Thank YOU Have a nice day