summaryrefslogtreecommitdiff
path: root/src/opticaldesign.h
blob: 5a7ebacf3a1c11a6196227b701fab271562ddd7d (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once

// goodies
#include <g_object.h>
#include <g_property.h>

namespace orphex
{
Q_NAMESPACE
// multiplied by 10
enum class LenseAperture
{
    F0_5 = 05,
    F0_7 = 07,
    F1_0 = 10,
    F1_2 = 12,
    F1_4 = 14,
    F2_0 = 20,
    F2_8 = 28,
    F4_0 = 40,
    F5_6 = 56,
    F8_0 = 80,
    F11_0 = 110,
    F16_0 = 160,
    F22_0 = 220,
    F32_0 = 320,
    F45_0 = 450,
    F64_0 = 640,
    F90_0 = 900,
    F128_0 = 1280,
    F180_0 = 1800,
    F256_0 = 2560
};
Q_ENUM_NS(LenseAperture)
}  // namespace orphex

// Q_DECLARE_METATYPE(orphex::LenseAperture)

class OpticalDesign : public goodies::G_Object
{
    Q_OBJECT

    DEFAULT_CONSTRUCTOR(goodies::G_Object, OpticalDesign)
    DEFAULT_DESTRUCTOR(OpticalDesign);
    G_OBJECT(goodies::G_Object, OpticalDesign)

public:
    void calculate() const;

protected:
    INI_PROPERTY(double, opticalAxisAngleDegrees, 45.);
    // the Y axis is directed from the laser to the lens
    INI_PROPERTY(double, lenseYPosMm, 50.);
    // default values for CS2006ZM06 lense
    INI_PROPERTY(double, focalDistanceMm, 6.);
    INI_PROPERTY(double, backFocalDistanceMm, 7.3);
    // FIXME: loading doesn't work
    INI_PROPERTY_VAR(
        orphex::LenseAperture,
        lenseAperture,
        orphex::LenseAperture::F1_2
    );
    // default values for IMX287 sensor
    INI_PROPERTY(double, sensorWidthMm, 4.98);
    INI_PROPERTY(double, sensorHeightMm, 3.74);
    INI_PROPERTY(double, sensorCellWidthUm, 6.9);
    INI_PROPERTY(double, sensorCellHeightUm, 6.9);
    // sensor vertical offset along the image plane
    INI_PROPERTY(double, sensorVerticalOffsetMm, 0.);
    INI_PROPERTY(uint16_t, sensorPixelsHeight, 720);
    INI_PROPERTY(uint16_t, sensorPixelsWidth, 544);
    INI_PROPERTY(double, zBaseMm, 90);
    INI_PROPERTY(double, zRangeMm, 250);

    G_PROPERTY_DEFAULT(double, sensorLenseAngleDegrees, 0.);
    G_PROPERTY_DEFAULT(double, actualZBaseMm, 0.);
    G_PROPERTY_DEFAULT(double, actualZRangeMm, 0.);
    G_PROPERTY_DEFAULT(double, lenseSensorDistanceMm, 0.);
    G_PROPERTY_DEFAULT(double, frontSharpDistanceMm, 0.);
    G_PROPERTY_DEFAULT(double, backSharpDistanceMm, 0.);
    G_PROPERTY_DEFAULT(double, depthOfFieldMm, 0.);
};