credo-detector 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exe/credo +40 -0
- data/lib/credo/calibration.rb +3 -0
- data/lib/credo/detector/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 905e46749f9bd9954908098155eae5ec9af84178589e1421a5d5bbd7848d31cb
|
4
|
+
data.tar.gz: da1d43425df1458dc5c8734d56917c28ac29908b74ceaff04113d55e229e1971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a51bfba3f70da442f2a299c86e5ea37538f79608b8c3697c65c20d9a15c9a3a0df6e56106810741af293e956539474e1e969dcb1168fc01d6b6b9006149eeaa
|
7
|
+
data.tar.gz: 28bb26cf7fdcf0bb739e44d51242a318a9cbe302a3159f25cfdbd1b143d3c17d847727730e8998db23547c4a2a631e327dd876bb981310eb698121a822b86ba4
|
data/exe/credo
CHANGED
@@ -1,3 +1,43 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
4
|
+
require "bundler/setup"
|
3
5
|
require "credo/detector"
|
6
|
+
require "optparse"
|
7
|
+
|
8
|
+
@tests = 300
|
9
|
+
@camera = 0
|
10
|
+
|
11
|
+
help = "usage: credo [options]
|
12
|
+
These are common Credo commands used in various situations:
|
13
|
+
|
14
|
+
calibrate [--tests=300] [--camera=0] Calibrates the camera
|
15
|
+
detect [--camera=0] [--config] Starts detection, sends the results back to server
|
16
|
+
version Prints version, same as credo -v or credo --version
|
17
|
+
"
|
18
|
+
|
19
|
+
OptionParser.new do |opt|
|
20
|
+
opt.on("-h", "--help", "Prints help") do
|
21
|
+
puts help
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
|
25
|
+
opt.on("-v", "version") do
|
26
|
+
puts Credo::Detector::VERSION
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
|
30
|
+
opt.on("-t", "--tests=300", Integer, "Sets the number of tests for calibration") do |tests_number|
|
31
|
+
@tests = [tests_number.to_i, 1].max
|
32
|
+
end
|
33
|
+
|
34
|
+
opt.on("-c", "--camera=0", Integer, "Sets the camera number") do |camera_number|
|
35
|
+
@camera = [camera_number.to_i, 0].max
|
36
|
+
end
|
37
|
+
|
38
|
+
opt.on("calibrate") do
|
39
|
+
Credo::Calibration.calibrate(tests: @tests.to_i, device_id: @camera.to_i)
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
end.parse!
|
43
|
+
|
data/lib/credo/calibration.rb
CHANGED
@@ -16,6 +16,9 @@ module Credo
|
|
16
16
|
puts "Calibration completed"
|
17
17
|
puts "Maximum value: #{max_values.max}"
|
18
18
|
puts "Average of maximum values: #{max_values.sum.to_f / max_values.size}"
|
19
|
+
rescue Interrupt, RuntimeError
|
20
|
+
puts
|
21
|
+
puts "Calibration interrupted"
|
19
22
|
ensure
|
20
23
|
Framegrabber.release
|
21
24
|
end
|