win10 opencv 项目程序移植到 ubuntu16.04: 3.项目自启动和修改分辨率

来源:互联网 发布:国泰君安快期交易软件 编辑:程序博客网 时间:2024/05/01 05:47

先取消登陆界面(如果ubuntu安装时选择了登陆界面)

打开 系统设置 中的 用户帐户。点击右上角的"解锁"按钮。目前 自动登录 状态是"关闭"状态。改成ON


1、网上说可以修改/etc/rc.local里添加命令来自启动,试验后发现不行。

可用下面方式查看:


systemctl status rc-local.service可查看rc.local会不会自动执行。

如果不会,设置vi /etc/rc.local进行自动执行是没有用的。

当然可以用下面文章的方法解决:

https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd


2、采用systemd的方式自启动,感觉是可行的,程序已经运行,但会出现错误提示,好像是因为有些程序未运行。比如gtk和log等。

参考:


https://linuxconfig.org/how-to-automatically-execute-shell-script-at-startup-boot-on-systemd-linux

https://www.digitalocean.com/community/questions/convert-run-at-startup-script-from-upstart-to-systemd-for-ubuntu-16

https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up

Systemd 入门教程:实战篇


http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-part-two.html


3、运行:From terminal or Alt+F2 dialog run: gnome-session-properties.或者"Startup Applications"

但均不能存储:

可用下面方式的解决

down voteaccepted

It sounds like a permission problem, you can try this (from a terminal):

sudo chown [username]:[username] -R ~/.config

If it doesn't help, try to start the "Startup Application Preferences" from a terminal using this command:

gnome-session-properties

You might see relevant error messages there. If the output looks useless to you, you might post it here.




down voteaccepted5、

It sounds like a permission problem, you can try this (from a terminal):

sudo chown [username]:[username] -R ~/.config

If it doesn't help, try to start the "Startup Application Preferences" from a terminal using this command:

gnome-session-properties

You might see relevant error messages there. If the output looks useless to you, you might post it here.


4、分辨率修改:

1,首先输入 cvt 1440 900

显示  # 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz; pclk: 106.50 MHz
Modeline "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync

2,接着输入  xrandr --newmode "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync

 --newmode后面的内容几即1中的红色部分。


3,最后输入 xrandr --addmode VGA-0 "1440x900_60.00"

 注意这里的VGA-0为 步骤0中输入指令显示的名字,也可能是VGA1,具体是视机器而定


4,步骤 3完成后可以插上外接显示器,去设置里调整分辨率为 1440*900即可。如果屏幕想做偏移,可调节显示器解决。至此外接显示器的分辨率就正常了,不过为了重启系统后仍能执行我们的设置我们还需要将刚刚的三条指令写进自动执行的脚本中,终端输入 sudo gedit  ~/.profile

在文件末尾追加

xrandr --newmode "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync
xrandr --addmode VGA-0 "1440x900_60.00"


重启后提示错误信息:

xrandr:output DP1 is not disconnected but has no modes

xrandr:output DP1 is not disconnected but has no modes

怎么修改都搞不定,感觉是开机时未检测到显卡就进行配置,所以把配置命令加到自动运行脚本中就OK。最后要加一行:sudo xrandr --output  VGA-1 --mode "1920x1080_60.00"
0 0
原创粉丝点击