Skip to content

Commit 9879bab

Browse files
committed
qtvcp -cam_align panel: add ability to set X and Y camera scaling
To help fix aspect ratio problems
1 parent 3f4db9a commit 9879bab

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

share/qtvcp/panels/cam_align/cam_align_handler.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ def __init__(self, halcomp,widgets,paths):
3939
# the widgets are instantiated.
4040
# the HAL pins are built but HAL is not set ready
4141
def initialized__(self):
42-
if self.w.PREFS_:
43-
LOG.debug('Using preference file:',self.w.PREFS_.fn)
42+
try:
43+
if self.w.PREFS_:
44+
LOG.debug('Using preference file:',self.w.PREFS_.fn)
45+
except:
46+
pass
4447
number = 0
4548
if self.w.USEROPTIONS_ is not None:
46-
LOG.debug('cam_align user options: {}'.format(self.w.USEROPTIONS_))
49+
LOG.info('cam_align user options: {}'.format(self.w.USEROPTIONS_))
4750
for num, i in enumerate(self.w.USEROPTIONS_):
4851

4952
# override the default width and height of the window
@@ -62,14 +65,27 @@ def initialized__(self):
6265
except Exception as e:
6366
print('Error with cam_align rotation increment setting:',self.w.USEROPTIONS_[num])
6467

68+
# X axis scale number to use
69+
elif 'xscale=' in self.w.USEROPTIONS_[num]:
70+
try:
71+
self.scaleX = float(self.w.USEROPTIONS_[num].strip('xscale='))
72+
except Exception as e:
73+
print('Error with cam_align X axis scale - not a number - using 1.0')
74+
75+
# camera Y axis scale number to use
76+
elif 'yscale=' in self.w.USEROPTIONS_[num]:
77+
try:
78+
self.scaleY = float(self.w.USEROPTIONS_[num].strip('yscale='))
79+
except Exception as e:
80+
print('Error with cam_align camera Y axis scale- not a number - using 1.0')
81+
6582
# camera number to use
6683
elif 'camnumber=' in self.w.USEROPTIONS_[num]:
6784
try:
6885
number = int(self.w.USEROPTIONS_[num].strip('camnumber='))
6986
except Exception as e:
7087
print('Error with cam_align camera selection - not a number - using 0')
7188

72-
7389
# camera number to use (legacy)
7490
elif len(self.w.USEROPTIONS_[num]) == 1 and self.w.USEROPTIONS_[num].isdigit():
7591
try:

0 commit comments

Comments
 (0)