blob: 56fc5dbaa29e0f44e9938a07803531dc9c3021ff [file] [log] [blame]
Alex Vakulenkoe4eec202017-01-27 14:41:04 -08001#ifndef ANDROID_DVR_LOOKUP_RADIAL_DISTORTION_H_
2#define ANDROID_DVR_LOOKUP_RADIAL_DISTORTION_H_
3
4#include <vector>
5
6#include <private/dvr/color_channel_distortion.h>
7
8namespace android {
9namespace dvr {
10
11// LookupRadialDistortion implements a radial distortion based using using a
12// vector of tan(angle) -> multipliers. This can use measured data directly.
13class LookupRadialDistortion : public ColorChannelDistortion {
14 public:
15 // lookup.x = tan(angle), lookup.y = distance from center multiplier.
16 explicit LookupRadialDistortion(const vec2* lookup, size_t count);
17
18 vec2 Distort(vec2 p) const override;
19 vec2 DistortInverse(vec2 p) const override;
20
21 private:
22 float DistortionFactor(float r) const;
23 float DistortRadius(float r) const;
24
25 std::vector<vec2> lookup_;
26};
27
28} // namespace dvr
29} // namespace android
30
31#endif // ANDROID_DVR_LOOKUP_RADIAL_DISTORTION_H_