0%

查看两个目录的结构

1
$ tree test_a/ test_b/
1
2
3
4
5
test_a/
└── test.txt
test_b/
├── test_b.txt
└── test.txt

使用 diff 逐行比较

1
$ diff -aur test_a/ test_b/
1
2
3
4
5
6
7
Only in test_b/: test_b.txt
diff -aur test_a/test.txt test_b/test.txt
--- test_a/test.txt 2024-04-01 19:29:35.024777745 +0800
+++ test_b/test.txt 2024-04-01 19:36:22.759553212 +0800
@@ -1 +1 @@
-test_a
+test_b
阅读全文 »

使用 pcl-tools 1.12.1 显示点云后出现 segmentation fault

image-1

使用 libpcl-dev-1.12.1 显示点云后显示一大串关于 vtk 的警告且最后出现 sgmentation fault

1
2
3
2024-03-27 07:06:36.626 (   1.903s) [        1B11AC80]vtkOpenGLPolyDataMapper:328   WARN| vtkOpenGLPolyDataMapper::SetGeometryShaderCode was deprecated for VTK 9.0 and will be removed in a future version.  Use vtkOpenGLShaderProperty::SetGeometryShaderCode instead.
2024-03-27 07:06:36.626 ( 1.903s) [ 1B11AC80]vtkOpenGLPolyDataMapper:321 WARN| vtkOpenGLPolyDataMapper::GetFragmentShaderCode was deprecated for VTK 9.0 and will be removed in a future version. Use vtkOpenGLShaderProperty::GetFragmentShaderCode instead.
2024-03-27 07:06:36.626 ( 1.903s) [ 1B11AC80]vtkOpenGLPolyDataMapper:313 WARN| vtkOpenGLPolyDataMapper::SetFragmentShaderCode was deprecated for VTK 9.0 and will be removed in a future version. Use vtkOpenGLShaderProperty::SetFragmentShaderCode instead.
阅读全文 »

安装 Git

1
2
3
sudo apt install git
git config --global user.name "Your Name"
git config --global user.email "youremail@domain.com"

配置防火墙

1
2
3
4
5
sudo apt install ufw
sudo ufw allow "OpenSSH"
sudo ufw enable
sudo ufw allow http
sudo ufw allow https
阅读全文 »

点云的表示方式

pcl里的点云多种表示方式:

1
2
3
4
5
6
7
8
9
10
11
12
// const
ConstCloudIterator<PointT> cloud_iterator;

pcl::PointCloud<PointT> cloud;

// with indices
pcl::PointCloud<PointT> cloud;
std::vector<int> indices;

// with indices
pcl::PointCloud<PointT> cloud;
pcl::PointIndices indices;
阅读全文 »

高通滤波: 通常使用来检测边缘

常见算子

sobel算子

math-1

Scharr算子 (更敏感/细致)

math-2

Laplacian(拉普拉斯)算子 (对噪声较敏感,一般搭配其他操作)

math-3

具体代码例子

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

import cv2
import numpy as np

%matplotlib inline

# Read in the image
image = cv2.imread('images/curved_lane.jpg')
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)

f, (p1, p2) = plt.subplots(1, 2, figsize=(20,10))
p1.set_title('original img')
p1.imshow(image)

p2.set_title('gray img')
p2.imshow(gray, cmap='gray')
阅读全文 »

低通滤波: 通常使用来去噪

常见滤波类型

均值滤波

math-4

高斯滤波 (权重与距离相关)

math-5

中值滤波

顾名思义取中值

具体代码例子

高斯的模糊/去噪效果
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Read in the image
image = cv2.imread('images/brain_MR.jpg')

# Convert to grayscale for filtering
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

# Create a Gaussian blurred image
gray_blur = cv2.GaussianBlur(gray, (9, 9), 0)

# use custom kernal
# gaussian = (1/16)*np.array([[1, 2, 1],
# [2, 4, 2],
# [1, 2, 1]])
#
# gray_blur = cv2.filter2D(gray, -1, gaussian)

f, (ax1, ax2) = plt.subplots(1, 2, figsize=(20,10))
ax1.set_title('original gray'),ax1.imshow(gray, cmap='gray')
ax2.set_title('blurred image'),ax2.imshow(gray_blur, cmap='gray')
阅读全文 »

恢复git stash误删的内容

不小心使用 git drop stash 误删了暂存的内容 (或是 git stash pop 后丢失),怎么恢复?

其实drop后并没有真正删除暂存的内容,而是移除了对它的引用,所以通过一些操作是可以找回的。

模拟误删场景

  • git st 查看当前修改

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    On branch master
    Your branch is up-to-date with 'origin/master'.
    Changes not staged for commit:
    (use "git add/rm <file>..." to update what will be committed)
    (use "git checkout -- <file>..." to discard changes in working directory)

    deleted: calibration/adjust_result.json
    modified: calibration/config.json
    modified: calibration/src/rd_test.cc
    modified: pose_estimation/CMakeLists.txt
    modified: test/CMakeLists.txt
    modified: test/multiple_sensors.json
    modified: test/src/test_multiple_sensors.cc
  • git stash 暂存修改

    1
    2
    Saved working directory and index state WIP on master: 4d74f8a fix spell
    HEAD is now at 4d74f8a fix spell
  • git stash list 查看暂存内容列表

    1
    stash@{0}: WIP on master: 4d74f8a fix spell
  • git stash drop stash@{0} 移除暂存内容

    1
    Dropped refs/stash@{0} (0b45536f1ce7e859a85f1459d6ae34fc6cdc4039)
阅读全文 »