我正在建造一个智能镜子(双面镜子后面的监视器)。我有一个27英寸的红外触摸框架,我想使用一个22“的显示器。尺寸不匹配的一个原因是我在镜子后面放了一个照相机,而触摸框必须是镜子的大小,因为镜子位于显示器和触摸框之间。
我正在使用xinput_calibrator工具来校准触摸框架,但是X假设触摸框架和监视器是相同大小的,所以只有在屏幕中间(触摸帧的中间和监视器的中间重叠)校准才是正确的。除此之外,触摸输入向屏幕中部倾斜。
在下面的图像中,黑色矩形内的所有东西都在红外触摸区域内。监视器是绿色的矩形。

如何将X配置为使用比物理显示器更大的触摸表面?
我正在使用Raspbian 10 (buster)的覆盆子Pi 4。
发布于 2020-10-30 17:48:30
X输入可用于设置触控输入装置的坐标变换矩阵。这是基于Arch:https://wiki.archlinux.org/index.php/Calibrating_触摸屏上的步骤。
首先,获取由X11识别的输入设备列表:
$ xinput list结果之一应该是触控框架。接下来,获取其当前设置:
$ xinput list-props "Device Name"将有一个名为“坐标转换矩阵”的属性,这是我们需要更新的。
有两件事需要说明:
收集以下变量。我用磁带测量了这些数据,但是只要所有的数据都在相同的基础上(比如像素分辨率),最终数学就会得到解决。
Screen width 52cm
Screen height 32.5cm
Touch area width 60.5cm
Touch area height 34cm
Touch area x offset -4cm (note the negative because the touch area begins beyond the left edge of the display)
Touch area y offset 0 (in my case the top of the touch frame aligned with the top of the display)现在建立坐标变换矩阵。矩阵中有4个必须计算的值。
矩阵是
[ c0 0 c1 ]
[ 0 c2 c3 ]
[ 0 0 1 ]它表示为逐行数组:
c0 0 c1 0 c2 c3 0 0 1
c0 = touch_area_width / total_width
c1 = touch_area_x_offset / total_width
c2 = touch_area_height / total_height
c3 = touch_area_y_offset / total_height我的测量结果是
c0 1.163461538
c1 -0.076923077
c2 1.046153846
c3 0现在用xinput设置新值:
xinput set-prop "Device Name" --type=float "Coordinate Transformation Matrix" c0 0 c1 0 c2 c3 0 0 1插入计算值:
xinput set-prop "Device Name" --type=float "Coordinate Transformation Matrix" 1.16346 0 -0.0769 0 1.046150 0 0 1这只会将其设置为当前会话。若要在设备插入(或启动时)时进行更改,请创建udev规则。您需要找到供应商ID和设备型号ID。
/etc/udev/rules.d/99-touch-frame.rules
ENV{ID_VENDOR_ID}=="aaec",ENV{ID_MODEL_ID}=="c021",ENV{WL_OUTPUT}="DVI1",ENV{LIBINPUT_CALIBRATION_MATRIX}="1.16346 0 -0.0769 0 1.046150 0 0 1"现在,每当设备插入,校准矩阵将自动设置。
https://unix.stackexchange.com/questions/616456
复制相似问题