-
Notifications
You must be signed in to change notification settings - Fork 0
/
hslimage.h
42 lines (33 loc) · 1.16 KB
/
hslimage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef _BPJ_BYTEIMAGE_HSLIMAGE_H
#define _BPJ_BYTEIMAGE_HSLIMAGE_H
#include "byteimage.h"
namespace byteimage {
class HSLImage {
public:
float* hsl;//Stored H, S, L interlaced
int nr, nc;
public:
HSLImage();
HSLImage(int nr, int nc);
HSLImage(const ByteImage& img);
HSLImage(const HSLImage& img);
HSLImage(HSLImage&& img);
virtual ~HSLImage();
HSLImage& operator=(const HSLImage& img);
HSLImage& operator=(HSLImage&& img);
inline float& H(int r, int c) {return hsl[3 * (r * nc + c)];}
inline float H(int r, int c) const {return hsl[3 * (r * nc + c)];}
inline float& S(int r, int c) {return hsl[3 * (r * nc + c) + 1];}
inline float S(int r, int c) const {return hsl[3 * (r * nc + c) + 1];}
inline float& L(int r, int c) {return hsl[3 * (r * nc + c) + 2];}
inline float L(int r, int c) const {return hsl[3 * (r * nc + c) + 2];}
ByteImage toHue();
ByteImage toSaturation() const;
ByteImage toLightness() const;
ByteImage toByteImage() const;
void panSharpen(const ByteImage& gray);
HSLImage panSharpened(const ByteImage& gray) const;
};
float hueDistance(float h0, float h1);
}
#endif