2020年4月30日 星期四

[Ubuntu] 安裝 labelImg

sudo pip3 install labelImg
labelImg
```
    from lxml import etree
ImportError: cannot import name 'etree'
```

解決方法
```
curl https://bootstrap.pypa.io/get-pip.py | sudo -H python3.6

sudo pip3 uninstall lxml==4.3.0
sudo pip3 install lxml==4.3.0
```

* https://blog.gtwang.org/useful-tools/labelimg-graphical-image-annotation-tool-tutorial/
* https://www.twblogs.net/a/5c6d666bbd9eee5bea9dfa09

2020年4月24日 星期五

[RPi] 安裝 OpenCV 3 在 Pi 上(Raspbian Buster)

# 安裝必要套件
```
sudo apt-get update
sudo apt-get install -y build-essential cmake pkg-config
sudo apt-get install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install -y libxvidcore-dev libx264-dev
sudo apt-get install -y libgtk2.0-dev libgtk-3-dev
sudo apt-get install -y libatlas-base-dev gfortran
sudo apt-get install -y python3-dev python3-pip
sudo apt-get install -y python3-numpy python3-scipy python3-matplotlib
```


# 下載 OpenCV 3.4.10
```
wget https://github.com/opencv/opencv_contrib/archive/3.4.10.tar.gz -O opencv_contrib-3.4.10.tar.gz
tar zxvf opencv_contrib-3.4.10.tar.gz

wget https://github.com/opencv/opencv/archive/3.4.10.tar.gz
tar zxvf 3.4.10.tar.gz

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=/home/pi/opencv_contrib-3.4.10/modules \
    -D BUILD_EXAMPLES=ON \
    -D ENABLE_NEON=ON \
    -D ENABLE_VFP3=ON ..

time make -j4 VERBOSE=1
```

2020年4月23日 星期四

[RPi] Pi 4 Raspbian Buster 安裝 ROS Kinetic

树莓派4B日志(一) Raspbian Buster源码安装ROS Kinetic
http://111.67.195.23/post/26239_1_1.html

[RF] RF 推薦書單

1. RF Microelectronics, Behzad Razavi
2. The Design of CMOS Radio-Frequency Integrated Circuits (裡頭會參雜一些小故事), Thomas H. Lee
3. Microwave Engineering, David M. Pozar (有中文版)
4. Microwave and Rf Design of Wireless Systems, David M. Pozar

以上幾本應該都是經典,可以讀上一整年沒問題喔!如果是想看中文書的話,可以參考中正大學張盛富教授的著作:
5. 無線通訊射頻晶片模組設計-射頻系統篇, 張盛富、張嘉展
6. 無線通信之射頻被動電路設計, 張盛富, 戴明鳳

reference: https://www.eebreakdown.com/2019/09/rf-books.html

2020年4月21日 星期二

2020年4月7日 星期二

[Ubuntu] Install Cura 14

主要參考這篇

1. 先下載 cura_14.07-debian_amd64.deb,或是 cura_14.09-1.18.8-608ef_amd64.deb/

2. 直接安裝 sudo dpkg -i cura_14.07-debian_amd64.deb 會出現錯誤訊息
```
Package python-wxgtk2.8 is not installed.
```

3.安裝  python-wxgtk2.8 和修復相依性
```
sudo add-apt-repository ppa:codeblocks-devs/release
sudo apt-get update
sudo apt-get install -f
```

4. 再安裝一次就可以啦
```
sudo dpkg -i cura_14.07-debian_amd64.deb
```

5. 打開 cur
```
cura
```

6. 如果遇到轉成 GCode 失敗,錯誤訊息
```
Traceback (most recent call last):
  File "/usr/share/cura/Cura/gui/sceneView.py", line 553, in _onRunEngine
    self._engine.runEngine(self._scene)
  File "/usr/share/cura/Cura/util/sliceEngine.py", line 320, in runEngine
    pos += (objMin + objMax) / 2.0 * 1000
TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('int64') with casting rule 'same_kind'
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/share/cura/Cura/gui/sceneView.py", line 318, in _saveGCode
    data = self._engine.getResult().getGCode()
AttributeError: 'NoneType' object has no attribute 'getGCode'
```

就修改 /usr/share/cura/Cura/util/sliceEngine.py (參考)
```
320             #pos += (objMin + objMax) / 2.0 * 1000
321             pos = numpy.add(pos,(objMin + objMax) / 2.0 * 1000, out=pos, casting="unsafe")           
```

=> 更新一下,後來使用的是 Cura-13.12-debian