Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_edge_detection_kernel.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KIS_EDGE_DETECTION_KERNEL_H
8#define KIS_EDGE_DETECTION_KERNEL_H
9
10#include "kritaimage_export.h"
11#include "kis_types.h"
12
13#include <Eigen/Core>
14#include <boost/optional.hpp>
15
16class QRect;
17
18class KRITAIMAGE_EXPORT KisEdgeDetectionKernel
19{
20public:
22
24 Simple, //A weird simple method used in our old sobel filter
25 Prewitt, //The simpler prewitt detection, which doesn't smooth.
26 SobelVector //Sobel does smooth. The creation of bigger kernels is based on an approach regarding vectors.
27 };
28
37
48 static Eigen::Matrix<qreal, Eigen::Dynamic, Eigen::Dynamic>
49 createHorizontalMatrix(qreal radius, FilterType type, bool reverse = false);
59 static Eigen::Matrix<qreal, Eigen::Dynamic, Eigen::Dynamic>
60 createVerticalMatrix(qreal radius, FilterType type, bool reverse = false);
61
63 createHorizontalKernel(qreal radius, FilterType type, bool denormalize = true, bool reverse = false);
64
66 createVerticalKernel(qreal radius, FilterType type, bool denormalize = true, bool reverse = false);
67
68 static int kernelSizeFromRadius(qreal radius);
69 static qreal sigmaFromRadius(qreal radius);
70
86 static void applyEdgeDetection(KisPaintDeviceSP device,
87 const QRect& rect,
88 qreal xRadius, qreal yRadius,
89 FilterType type,
90 const QBitArray &channelFlags,
91 KoUpdater *progressUpdater,
92 FilterOutput output = pythagorean,
93 bool writeToAlpha = false);
108 static void convertToNormalMap(KisPaintDeviceSP device,
109 const QRect & rect,
110 qreal xRadius,
111 qreal yRadius,
112 FilterType type,
113 int channelToConvert,
114 QVector<int> channelOrder,
115 QVector<bool> channelFlip,
116 const QBitArray &channelFlags,
117 KoUpdater *progressUpdater,
118 boost::optional<bool> useFftw = boost::none);
119};
120
121#endif // KIS_EDGE_DETECTION_KERNEL_H