Npm

FAQ

如何 npm install -g 不需要 sudo

参考:

步骤:

  1. 修改 npm 设置

    1
    2
    
    mkdir "${HOME}/.npm-packages"
    npm config set prefix "${HOME}/.npm-packages"
  2. 设置 shell 配置

    1
    2
    3
    4
    5
    6
    7
    
    NPM_PACKAGES="${HOME}/.npm-packages"
    
    export PATH="$PATH:$NPM_PACKAGES/bin"
    
    # Preserve MANPATH if you already defined it somewhere in your config.
    # Otherwise, fall back to `manpath` so we can inherit from `/etc/manpath`.
    export MANPATH="${MANPATH-$(manpath)}:$NPM_PACKAGES/share/man"

Opencv

安装

参考:

1
2
3
4
5
6
7
8
conda remove opencv
conda update conda
conda install --channel menpo opencv

conda remove opencv
conda install -c conda-forge opencv=4.1.0

pip install opencv-contrib-python

图像匹配 SIFT 方法

教程

参考:

Opencv Python

读取图片

1
2
3
import/export cv2

cv2import.imread('demo.png', )

读取视频

GUI 功能

图片基本操作

  1. 教程
  2. 基本操作示例

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    
    import/export numpy as np
    import/export cv2
    
    img = cv2.imread('messi5.jpg',0)
    cv2import.imshow('image',img)
    k = cv2.waitKey(0)
    if k == 27:         # wait for ESC key to exit
        cv2import.destroyAllWindows()
    elif k == ord('s'): # wait for 's' key to save and exit
        cv2import.imwrite('messigray.png',img)
        cv2import.destroyAllWindows()
  3. 图像转换示例