-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathregionOfIntrest.go
More file actions
35 lines (30 loc) · 869 Bytes
/
regionOfIntrest.go
File metadata and controls
35 lines (30 loc) · 869 Bytes
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
//Copyright (c) 2017, Technomancers. All rights reserved.
//Use of this source code is governed by a BSD-style
//license that can be found in the LICENSE file.
package piCamera
import (
"fmt"
)
//RegionOfIntrest is used to set the cameras area to be used as the source.
type RegionOfIntrest struct {
tlX float32
tlY float32
w float32
h float32
}
//NewROI creates a new Region of Interest.
//tlx and tly are the top left x and y of ROI.
//w and h are the width and height of the ROI.
//All points should be normalized from 0.0 - 1.0.
func NewROI(tlx, tly, w, h float32) *RegionOfIntrest {
return &RegionOfIntrest{
tlX: tlx,
tlY: tly,
w: w,
h: h,
}
}
//Convert takes the type and returns the string representation of that value.
func (t *RegionOfIntrest) Convert() string {
return fmt.Sprintf("%.2f,%.2f,%.2f,%.2f", t.tlX, t.tlY, t.w, t.h)
}