kopftracer2011.cpp revision 3b711c89939d4f10cb1b81da2726a49aa45a2ab7
369N/A/* This file is part of the libdepixelize project 4659N/A Copyright (C) 2013 VinÃcius dos Santos Oliveira <vini.ipsmaker@gmail.com> 369N/A GNU Lesser General Public License Usage 369N/A This library is free software; you can redistribute it and/or modify it 369N/A under the terms of the GNU Lesser General Public License as published by the 369N/A Free Software Foundation; either version 2.1 of the License, or (at your 369N/A option) any later version. 369N/A You should have received a copy of the GNU Lesser General Public License 369N/A GNU General Public License Usage 369N/A Alternatively, this library may be used under the terms of the GNU General 369N/A Public License as published by the Free Software Foundation, either version 369N/A 2 of the License, or (at your option) any later version. 369N/A You should have received a copy of the GNU General Public License along with 369N/A This library is distributed in the hope that it will be useful, 369N/A but WITHOUT ANY WARRANTY; without even the implied warranty of 369N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 369N/A Lesser General Public License for more details. 369N/A// Build fix under Inkscape build tree 369N/A * From (first) the top left corner to (second) the bottom right. 369N/A * From (first) the top right to (second) the bottom left. 369N/A * Precondition: Must be filled according to Diagonal enum. 736N/A}
// namespace Heuristics 369N/A // This step could be part of the initialization of PixelGraph 736N/A // and decrease the necessary number of passes 736N/A // This step can't be part of PixelGraph initilization without adding some 369N/A // cache misses due to random access patterns that might be injected 369N/A // This and below steps must be executed in separate. 369N/A // Otherwise, there will be colateral effects due to misassumption about the 736N/A// TODO: move this function (plus connectAllNeighbors) to PixelGraph constructor * This method removes crossing edges if the 2x2 block is fully connected. * In this case the two diagonal connections can be safely removed without * affecting the final result. * \TODO: It should remember/cache who are the unsafe crossing edges? * This method removes crossing edges using the heuristics. // Iterate over the graph, 2x2 blocks at time // Check if there are crossing edges for (
int i = 0 ; i !=
2 ; ++i ) {
// Curves and islands heuristics // Sparse pixels heuristic for (
int i = 0 ; i !=
2 ; ++i )
for (
int i = 0 ; i !=
2 ; ++i ) {
// Remove edges with lower weight for (
int i = 0 ; i !=
2 ; ++i ) {
// Used to avoid inifinite loops in circular-like edges // There are only two values that won't be zero'ed // and one of them has the same value of prev for (
int i = 0 ; i !=
2 ; ++i )
// Iterate over nodes and count them for (
unsigned i =
radius -
1 ; i ; --i )
for (
unsigned i = 0 ; i !=
2 *
radius ; ++i ) {
for (
unsigned j = 0 ; j !=
2 *
radius ; ++j ) {
for (
int k = 0 ; k !=
2 ; ++k ) {
for (
int i = 0 ; i !=
2 ; ++i )
c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :