Loading...
Searching...
No Matches
HighBoostOp.h
1/*
2
3MIT License
4
5Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26/*
27Part of Rack development has been done in the BALTRAD projects part-financed
28by the European Union (European Regional Development Fund and European
29Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30*/
31#ifndef HIGHBOOSTOP_H_
32#define HIGHBOOSTOP_H_
33
34//#include "SlidingWindowAverage.h"
35#include "ImageOp.h"
36
37#include "FastAverageOp.h"
38#include "drain/util/FunctorPack.h"
39
40
41namespace drain
42{
43
44namespace image
45{
46
47
48// Returns src - scale*src2
49//template <class T=unsigned char,class T2=unsigned char>
50/*
51class ScaledSubtractionOp: public MathOp
52{
53public:
54
55 ScaledSubtractionOp() : MathOp(__FUNCTION__, "An arithmetic operator.") {
56 //setParameters(p);
57 };
58
59 // dst = MathOp<T,T2>::limit(static_cast<double>(src) - this->scale*src2 + this->bias);
60
61
62 inline
63 double filterValueD(double src, double src2) const {
64 return (src - scaleD*src2 + offsetD);
65 };
66
67};
68*/
69
71
73class HighBoostOp : public ImageOp
74{
75public:
76
77 HighBoostOp(int width=3, int height=3, double coeff=0.5) : ImageOp(__FUNCTION__, "Mixture of original and high-pass filtered image") {
78 parameters.link("width", this->width = width);
79 parameters.link("height", this->height = height);
80 parameters.link("coeff", this->coeff = coeff);
81 };
82
83 virtual
84 void process(const ImageFrame &src, Image &dst) const {
85
86 makeCompatible(src.getConf(), dst);
87
88 FastAverageOp(width,height).process(src,dst);
89
91 sub.LIMIT = true;
92 sub.functor.setScale(coeff);
93 sub.process(src, dst);
94 //sub.traverseFrame(src,dst,dst);
95
96 //ScaledSubtractionOp(coeff).process(src,dst,dst);
97 };
98
99 int width;
100 int height;
101 double coeff;
102
103};
104
105
106}
107
108}
109
110#endif /*HIGHPASSOP_H_*/
111
112// Drain
Class for using two-parameter function objects (like std::functor) for sequential and spatial pixel i...
Definition FunctorOp.h:306
Sliding window averaging operator with optional weighting support.
Definition FastAverageOp.h:301
Enhances details by mixing original image and result of HighPassOp op.
Definition HighBoostOp.h:74
virtual void process(const ImageFrame &src, Image &dst) const
Main interface. Typically splits processing to each channel.
Definition HighBoostOp.h:84
Image with static geometry.
Definition ImageFrame.h:67
Base class for image processing functions.
Definition ImageOp.h:49
virtual void makeCompatible(const ImageConf &src, Image &dst) const
Depending on the operator, modifies the geometry and type of dst.
Definition ImageOp.cpp:54
virtual void process(const ImageFrame &src, Image &dst) const
Main interface. Typically splits processing to each channel.
Definition ImageOp.cpp:126
Class for multi-channel digital images. Supports dynamic typing with base types (char,...
Definition Image.h:184
Definition DataSelector.cpp:1277