Intel Realsense D435 Post-processing filters 后处理过滤器(用于消除图像的黑洞)
官方鏈接:Post-processing filters
文章目錄
- 后處理過濾器
- 篩選器說明
- 抽取濾波器(抽取過濾器)Decimation Filter
- 空間邊緣保留濾鏡 Spatial Filter
- 時間過濾器
- 孔填充過濾器
- 設計與實施
- 在應用程序代碼中使用過濾器
- C:
- C++:
- python
- 抽取過濾器 Decimation Filter
- 空間過濾器 Spatial Filter
- 時間過濾器 Temporal Filter
- 孔填充過濾器 Hole Filling filter
- 將所有過濾器一起運用 Putting Everything Together
后處理過濾器
篩選器說明
Librealsense實施包括后處理過濾器,以提高深度數據的質量并降低噪聲水平。所有過濾器都在庫核心中實現為要在客戶代碼中使用的獨立塊
抽取濾波器(抽取過濾器)Decimation Filter
有效降低景深場景的復雜度。
濾鏡在[2x2]到[8x8]像素大小的內核上運行。對于大小為2和3的面片,選擇深度中值。對于較大的內核(4-8像素),出于性能方面的考慮,使用了平均深度。
圖像尺寸在兩個維度上均按比例縮小,以保持寬高比。
在內部,過濾器對輸出幀大小的寬度和高度強加4像素塊對齊。例如,對于輸入大小(1280X720)和比例因子3,輸出大小計算為:
[1280,720] / 3 - > [ 426.6666667,240] - > [ 428,240]
*將被軋染的行/列是零填充。
生成結果幀后,將重新計算幀固有參數以補償分辨率的變化。
該濾鏡還提供了一些填充孔的能力,因為該濾鏡僅使用有效(非零)像素。
| 過濾幅度 | 抽取線性比例因子 | 離散步長在[2-8]范圍內 | 2 |
空間邊緣保留濾鏡 Spatial Filter
*實現基于紙張由愛德華SL Gastal和Manuel M.奧利維拉。
主要特點:
- 使用高階域變換的一維保留邊緣空間濾波器。
- 線性時間計算,不受參數選擇的影響。
濾波器執行一系列一維水平和垂直遍歷或迭代,以增強重建數據的平滑度。
| 過濾幅度 | 過濾器迭代次數 | [1-5] | 2 |
| 平滑阿爾法 | 具有Alpha = 1-無濾波器的指數移動平均數中的Alpha因子。Alpha = 0-無限過濾器 | [0.25-1] | 0.5 |
| 平滑三角洲 | 步長邊界。確定用于保留“邊緣”的閾值 | 離散[1-50] | 20 |
| 孔填充 | 在過濾器通過期間水平應用就地啟發式對稱孔填充模式。旨在糾正對最小偽影的影響最小 | [0-5]范圍映射到[none,2,4,8,16,unlimited]像素。 | 0(無) |
時間過濾器
時間濾波器旨在通過基于先前幀操縱每個像素值來改善深度數據的持久性。
過濾器對數據執行一次通過,調整深度值,同時更新跟蹤歷史記錄。如果像素數據丟失或無效,則過濾器使用用戶定義的持久性模式來決定是否應使用存儲的數據糾正丟失的值。
請注意,由于過濾器依賴于歷史數據,因此可能會引入可見的模糊/拖影偽像,因此最適合靜態場景。
| 平滑阿爾法 | 具有Alpha = 1-無濾波器的指數移動平均數中的Alpha因子。Alpha = 0-無限過濾器 | [0-1] | 0.4 |
| 平滑三角洲 | 步長邊界。建立用于保留表面(邊緣)的閾值 | 離散[1-100] | 20 |
| 持久指數 | 一組用于控制何時丟失像素的預定義規則(掩碼)將被最后一個有效值替換,以使數據隨著時間的流逝而保持不變:禁用 -持久性過濾器未激活且未發生孔填充。在8/8中有效 -如果像素在最后8幀中的8個有效,則激活持久性;在2 /最近3時有效-如果像素在最近3幀中的2個有效,則激活。在2 /最后4有效 -激活如果像素在最近4幀中的兩個像素中有效,則在2/8中有效 -如果像素在最近8幀中的兩個像素中有效,則在1 / last 2中有效-如果像素在其中一個有效,則激活最后兩幀在1 /最后5有效-如果像素在最近5幀中的一個有效,則激活- 在1 /最近8幀中有效 -如果像素在最后8幀的其中一個有效,則激活-無限期持久-無論存儲的歷史記錄如何,都將施加持久性(大多數主動過濾) | [0-8]枚舉 | 3(在2 /后4有效) |
孔填充過濾器
該過濾器實現了幾種方法來糾正結果圖像中的缺失數據。
過濾器獲取四個立即像素“鄰居”(上,下,左,右),并根據用戶定義的規則選擇其中之一。
| 孔填充 | 控制將用于填充無效像素的數據 | [0-2]枚舉:fill_from_left-使用左側相鄰像素的值填充孔 farest_from_around-使用距傳感器最遠的鄰近像素的值 near_from_around–使用距像素最近的鄰近像素的值傳感器 | 1(最遠的地方) |
設計與實施
后處理模塊被封裝到獨立的處理模塊中,這些模塊滿足以下關鍵要求:
1、同步/異步調用
2、內部框架內存/生命周期管理
過濾器能夠接收和處理來自不同來源的幀,盡管在一般情況下由于以下原因它不實用:
- 每次識別到幀的新類型/來源時,都會產生性能開銷,某些過濾器需要重新初始化。
- 時間過濾器的有效性取決于要保留的幀歷史。切換幀源會使保留的歷史記錄無效并使過濾器無法工作。
因此,強烈建議為每個攝像機源建立和維護過濾管。
過濾器保留原始數據,并始終生成新的(過濾的)幀以繼續傳遞。新幀的重新生成允許在不同使用者(線程)之間共享幀,而不會存在數據被另一個用戶覆蓋的風險。
所有過濾器都支持謹慎的以及浮點輸入數據格式。
浮點輸入由支持Disparity數據表示的基于D400立體聲的Depth攝像機使用。
謹慎版本的濾鏡主要用于SR300相機,但也
可以應用于D400設備(盡管不推薦)
在應用程序代碼中使用過濾器
設計并構建了后處理塊,以將其串聯到處理管道中。
沒有施加軟件的約束來強制應用過濾器的順序。
同時,下面詳細介紹了在librealsense工具和演示中使用的推薦方案:
深度幀 >> 抽取濾波器 >> Depth2Disparity變換** -> 空間濾波器 >> 時間濾波器 >> Disparity2Depth 變換** >> 孔填充濾波器 >> 過濾深度。
**適用于基于立體聲的深度相機(D4XX)。
請注意,即使演示中的過濾器順序是預定義的,每個過濾器也可以單獨控制,并且可以在運行時打開/關閉。
嵌入了后處理代碼塊的演示和工具:
1、實感查看器
2、深度質量工具
3、后處理演示
過濾初始化和激活流程:
使用CAPI調用:
C:
// Establishing a frame_queue object for each processing block that will receive the processed frames rs2_frame_queue* decimated_queue = rs2_create_frame_queue(1, NULL); rs2_frame_queue* spatial_queue = rs2_create_frame_queue(1, NULL); ... // Creating processing blocks/ filters rs2_processing_block* decimation_filter = rs2_create_decimation_filter_block(NULL); rs2_processing_block* spatial_filter = rs2_create_spatial_filter_block(NULL); ...// Direct the output of the filters to a dedicated queue rs2_start_processing_queue(decimation_filter, decimated_queue, NULL); rs2_start_processing_queue(spatial_filter, spatial_queue, NULL); ... // Get depth frame from the device rs2_frame* depth_frame = ...// Apply decimation filter rs2_process_frame(decimation_filter, depth_frame, NULL); rs2_frame* decimated_frame = rs2_wait_for_frame(decimated_queue, 5000, NULL); // Inject the decimated frame to spatial filter rs2_process_frame(spatial_filter, decimated_frame, NULL); // Get the filtered frame rs2_frame* spatial_filter_frame = rs2_wait_for_frame(spatial_queue, 5000, NULL); // Use the filtered data ...// Control filter options rs2_set_option((rs2_options*)decimation_filter, RS2_OPTION_FILTER_MAGNITUDE, 3, NULL); rs2_set_option((rs2_options*)spatial_filter, RS2_OPTION_FILTER_SMOOTH_ALPHA, 0.5f, NULL);C++:
// Streaming initializationrs2::pipeline pipe;...// Declare filtersrs2::decimation_filter dec_filter;rs2::spatial_filter spat_filter;// Configure filter parametersdecimation_filter.set_option(RS2_OPTION_FILTER_MAGNITUDE, 3);...spatial_filter.set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, 0.55f);...// Main Loopwhile (true) {rs2::frameset data = pipe.wait_for_frames();rs2::frame depth_frame = data.get_depth_frame();...rs2::frame filtered = depth_frame;// Note the concatenation of output/input frame to build up a chainfiltered = dec_filter.process(filtered);filtered = spatial_filter.process(filtered);}python
參考連接:librealsense/notebooks/depth_filters.ipynb
原圖:
抽取過濾器 Decimation Filter
# -*- coding: utf-8 -*- """ @File : test_測試深度過濾器_depth_filters.py @Time : 2019/12/17 11:29 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """import numpy as np # fundamental package for scientific computing 科學計算的基本軟件包 import matplotlib.pyplot as plt # 2D plotting library producing publication quality figures 2D繪圖庫產生出版物質量數據 import pyrealsense2 as rs # Intel RealSense cross-platform open-source API 英特爾實感跨平臺開源APIprint("Environment Ready")# 【Setup: 配置】 pipe = rs.pipeline() cfg = rs.config() # cfg.enable_device_from_file("stairs.bag") cfg.enable_device('838212073161') cfg.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30) cfg.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30) profile = pipe.start(cfg)# 【Skip 5 first frames to give the Auto-Exposure time to adjust 跳過前5幀以設置自動曝光時間】 for x in range(5):pipe.wait_for_frames()# 【Store next frameset for later processing: 存儲下一個框架集以供以后處理:】 frameset = pipe.wait_for_frames() depth_frame = frameset.get_depth_frame()# 【Cleanup: 清理:】 pipe.stop() print("Frames Captured")# 【計算深度圖數據中的0值】 num = 0 all = 0 for i in np.asanyarray(depth_frame.get_data()).ravel():all += 1if i == 0:num += 1 print('depth_frame分辨率:{}'.format(np.asanyarray(depth_frame.get_data()).shape)) print('depth_frame:{}'.format(num)) print('depth_frame:{}'.format(num / all)) # depth_frame分辨率:(480, 640) # depth_frame:49892 # depth_frame:0.16240885416666667# 【Visualising the Data 可視化數據】 # 創建著色器(其實這個可以替代opencv的convertScaleAbs()和applyColorMap()函數了,但是是在多少米范圍內map呢?) colorizer = rs.colorizer()# 繪圖不顯示網格 plt.rcParams["axes.grid"] = False # 圖形尺寸,單位英尺 plt.rcParams['figure.figsize'] = [8, 4]# 【Applying Filters 應用過濾器】 # [1、抽取過濾器] # 抽取 # 使用立體深度解決方案時,z精度與原始空間分辨率有關。 # 如果您對較低的空間分辨率感到滿意,則“抽取濾波器”將降低空間分辨率,以保持z精度并執行一些基本的孔填充。# 創建抽取過濾器 decimation = rs.decimation_filter() # decimated_depth = decimation.process(depth_frame) # print(type(decimation)) # <class 'pyrealsense2.pyrealsense2.decimation_filter'> # print(type(decimated_depth)) # <class 'pyrealsense2.pyrealsense2.frame'># # 您可以通過濾波器幅度選項來控制抽取量(線性比例因子)。 # # 注意不斷變化的圖像分辨率 decimation.set_option(rs.option.filter_magnitude, 4) decimated_depth = decimation.process(depth_frame) colorized_depth = np.asanyarray(colorizer.colorize(decimated_depth).get_data()) plt.imshow(colorized_depth)# 【計算深度圖數據中的0值】 num = 0 all = 0 for i in np.asanyarray(decimated_depth.get_data()).ravel():all += 1if i == 0:num += 1 print('decimated_depth分辨率:{}'.format(np.asanyarray(decimated_depth.get_data()).shape)) print('decimated_depth:{}'.format(num)) print('decimated_depth:{}'.format(num / all)) # decimated_depth分辨率:(240, 320) # decimated_depth:10507 # decimated_depth:0.13680989583333333plt.show()空間過濾器 Spatial Filter
# -*- coding: utf-8 -*- """ @File : test_測試深度過濾器_depth_filters.py @Time : 2019/12/17 11:29 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """import numpy as np # fundamental package for scientific computing 科學計算的基本軟件包 import matplotlib.pyplot as plt # 2D plotting library producing publication quality figures 2D繪圖庫產生出版物質量數據 import pyrealsense2 as rs # Intel RealSense cross-platform open-source API 英特爾實感跨平臺開源APIprint("Environment Ready")# 【Setup: 配置】 pipe = rs.pipeline() cfg = rs.config() # cfg.enable_device_from_file("stairs.bag") cfg.enable_device('838212073161') cfg.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30) cfg.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30) profile = pipe.start(cfg)# 【Skip 5 first frames to give the Auto-Exposure time to adjust 跳過前5幀以設置自動曝光時間】 for x in range(5):pipe.wait_for_frames()# 【Store next frameset for later processing: 存儲下一個框架集以供以后處理:】 frameset = pipe.wait_for_frames() depth_frame = frameset.get_depth_frame()# 【Cleanup: 清理:】 pipe.stop() print("Frames Captured")# 【計算深度圖數據中的0值】 num = 0 all = 0 for i in np.asanyarray(depth_frame.get_data()).ravel():all += 1if i == 0:num += 1 print('depth_frame分辨率:{}'.format(np.asanyarray(depth_frame.get_data()).shape)) print('depth_frame:{}'.format(num)) print('depth_frame:{}'.format(num / all)) # depth_frame分辨率:(480, 640) # depth_frame:127369 # depth_frame:0.41461263020833333# 【Visualising the Data 可視化數據】 # 創建著色器(其實這個可以替代opencv的convertScaleAbs()和applyColorMap()函數了,但是是在多少米范圍內map呢?) colorizer = rs.colorizer() # colorized_depth = np.asanyarray(colorizer.colorize(depth_frame).get_data()) # print(colorized_depth.shape) # (480, 640, 3) # cv2.imshow('win', colorized_depth) # cv2.waitKey(0)# 繪圖不顯示網格 plt.rcParams["axes.grid"] = False # 圖形尺寸,單位英尺 plt.rcParams['figure.figsize'] = [8, 4] # plt.imshow(colorized_depth)# 【Applying Filters 應用過濾器】 # [2、空間過濾器] # Spatial Filter # Spatial Filter is a fast implementation of Domain-Transform Edge Preserving Smoothing # 空間濾波器是域轉換邊緣保留平滑的快速實現 spatial = rs.spatial_filter() # filtered_depth = spatial.process(depth_frame)# We can emphesize the effect of the filter by cranking-up smooth_alpha and smooth_delta options: # 我們可以通過增加smooth_alpha和smooth_delta選項來強調濾鏡的效果: spatial.set_option(rs.option.filter_magnitude, 5) spatial.set_option(rs.option.filter_smooth_alpha, 1) spatial.set_option(rs.option.filter_smooth_delta, 50)# The filter also offers some basic spatial hole filling capabilities: # 該過濾器還提供一些基本的空間孔填充功能: spatial.set_option(rs.option.holes_fill, 3)filtered_depth = spatial.process(depth_frame) colorized_depth = np.asanyarray(colorizer.colorize(filtered_depth).get_data()) plt.imshow(colorized_depth) plt.show()# 【計算深度圖數據中的0值】 num = 0 all = 0 for i in np.asanyarray(filtered_depth.get_data()).ravel():all += 1if i == 0:num += 1 print('filtered_depth分辨率:{}'.format(np.asanyarray(filtered_depth.get_data()).shape)) print('filtered_depth:{}'.format(num)) print('filtered_depth:{}'.format(num / all)) # filtered_depth分辨率:(480, 640) # filtered_depth:29913 # filtered_depth:0.097373046875時間過濾器 Temporal Filter
# -*- coding: utf-8 -*- """ @File : test_191218_測試時間過濾器_Temporal_Filter.py @Time : 2019/12/18 10:59 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """ import numpy as np # fundamental package for scientific computing 科學計算的基本軟件包 import matplotlib.pyplot as plt # 2D plotting library producing publication quality figures 2D繪圖庫產生出版物質量數據 import pyrealsense2 as rs # Intel RealSense cross-platform open-source API 英特爾實感跨平臺開源APIprint("Environment Ready")# 【Setup: 配置】 pipe = rs.pipeline() cfg = rs.config() # cfg.enable_device_from_file("stairs.bag") cfg.enable_device('838212073161') cfg.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30) cfg.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30) profile = pipe.start(cfg)# 【Skip 5 first frames to give the Auto-Exposure time to adjust 跳過前5幀以設置自動曝光時間】 for x in range(5):pipe.wait_for_frames()# Our implementation of Temporal Filter does basic temporal smoothing and hole-filling. # It is meaningless when applied to a single frame, so let's capture several consecutive frames: # 我們的“時間過濾器”實現執行基本的時間平滑和孔填充。 當應用于單個幀時它是沒有意義的,因此讓我們捕獲幾個連續的幀: frames = [] for x in range(10):frameset = pipe.wait_for_frames()frames.append(frameset.get_depth_frame())pipe.stop() print("Frames Captured")# 【Visualising the Data 可視化數據】 # 創建著色器(其實這個可以替代opencv的convertScaleAbs()和applyColorMap()函數了,但是是在多少米范圍內map呢?) colorizer = rs.colorizer() # colorized_depth = np.asanyarray(colorizer.colorize(depth_frame).get_data()) # print(colorized_depth.shape) # (480, 640, 3) # cv2.imshow('win', colorized_depth) # cv2.waitKey(0)# 繪圖不顯示網格 plt.rcParams["axes.grid"] = False # 圖形尺寸,單位英尺 plt.rcParams['figure.figsize'] = [8, 4] # plt.imshow(colorized_depth)# Next, we need to "feed" the frames to the filter one by one: # 接下來,我們需要將幀逐一“饋入”到過濾器: temporal = rs.temporal_filter() for x in range(10):temp_filtered = temporal.process(frames[x])colorized_depth = np.asanyarray(colorizer.colorize(temp_filtered).get_data())plt.imshow(colorized_depth)plt.show() # 您可以修改過濾器選項以微調結果(任何時間過濾都需要在平滑和運動之間進行權衡)孔填充過濾器 Hole Filling filter
# -*- coding: utf-8 -*- """ @File : test_191218_測試孔填充過濾器.py @Time : 2019/12/18 13:32 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """ import numpy as np # fundamental package for scientific computing 科學計算的基本軟件包 import matplotlib.pyplot as plt # 2D plotting library producing publication quality figures 2D繪圖庫產生出版物質量數據 import pyrealsense2 as rs # Intel RealSense cross-platform open-source API 英特爾實感跨平臺開源APIprint("Environment Ready")# 【Setup: 配置】 pipe = rs.pipeline() cfg = rs.config() # cfg.enable_device_from_file("stairs.bag") cfg.enable_device('838212073161') cfg.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30) cfg.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30) profile = pipe.start(cfg)# 【Skip 5 first frames to give the Auto-Exposure time to adjust 跳過前5幀以設置自動曝光時間】 for x in range(5):pipe.wait_for_frames()# 【Store next frameset for later processing: 存儲下一個框架集以供以后處理:】 frameset = pipe.wait_for_frames() depth_frame = frameset.get_depth_frame()# 【Cleanup: 清理:】 pipe.stop() print("Frames Captured")# 【Visualising the Data 可視化數據】 # 創建著色器(其實這個可以替代opencv的convertScaleAbs()和applyColorMap()函數了,但是是在多少米范圍內map呢?) colorizer = rs.colorizer() # colorized_depth = np.asanyarray(colorizer.colorize(depth_frame).get_data()) # print(colorized_depth.shape) # (480, 640, 3) # cv2.imshow('win', colorized_depth) # cv2.waitKey(0) # 繪圖不顯示網格 plt.rcParams["axes.grid"] = False # 圖形尺寸,單位英尺 plt.rcParams['figure.figsize'] = [8, 4] # plt.imshow(colorized_depth)# 孔填充過濾器提供了附加的深度外推層: hole_filling = rs.hole_filling_filter() filled_depth = hole_filling.process(depth_frame) colorized_depth = np.asanyarray(colorizer.colorize(filled_depth).get_data()) plt.imshow(colorized_depth) plt.show()
將所有過濾器一起運用 Putting Everything Together
# -*- coding: utf-8 -*- """ @File : test_191219_測試合并所有過濾器_PuttingEverythingTogether.py @Time : 2019/12/19 11:34 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """ # 依次順序應用這些過濾器時效果最佳。 # 在更長的范圍內,它還有助于使用disparity_transform從深度表示轉換為視差形式:import numpy as np # fundamental package for scientific computing 科學計算的基本軟件包 import matplotlib.pyplot as plt # 2D plotting library producing publication quality figures 2D繪圖庫產生出版物質量數據 import pyrealsense2 as rs # Intel RealSense cross-platform open-source API 英特爾實感跨平臺開源APIprint("Environment Ready")# 【Setup: 配置】 pipe = rs.pipeline() cfg = rs.config() # cfg.enable_device_from_file("stairs.bag") cfg.enable_device('838212073161') cfg.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30) cfg.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30) profile = pipe.start(cfg)# 【Skip 5 first frames to give the Auto-Exposure time to adjust 跳過前5幀以設置自動曝光時間】 for x in range(5):pipe.wait_for_frames()frames = [] for x in range(10):frameset = pipe.wait_for_frames()frames.append(frameset.get_depth_frame())# 【Cleanup: 清理:】 pipe.stop() print("Frames Captured")# 【Visualising the Data 可視化數據】 # 創建著色器(其實這個可以替代opencv的convertScaleAbs()和applyColorMap()函數了,但是是在多少米范圍內map呢?) colorizer = rs.colorizer() # colorized_depth = np.asanyarray(colorizer.colorize(depth_frame).get_data()) # print(colorized_depth.shape) # (480, 640, 3) # cv2.imshow('win', colorized_depth) # cv2.waitKey(0)# 繪圖不顯示網格 plt.rcParams["axes.grid"] = False # 圖形尺寸,單位英尺 plt.rcParams['figure.figsize'] = [8, 4] # plt.imshow(colorized_depth)depth_to_disparity = rs.disparity_transform(True) disparity_to_depth = rs.disparity_transform(False)# 創建抽取過濾器 decimation = rs.decimation_filter() # decimated_depth = decimation.process(depth_frame) # print(type(decimation)) # <class 'pyrealsense2.pyrealsense2.decimation_filter'> # print(type(decimated_depth)) # <class 'pyrealsense2.pyrealsense2.frame'> # # 您可以通過濾波器幅度選項來控制抽取量(線性比例因子)。 # # 注意不斷變化的圖像分辨率 decimation.set_option(rs.option.filter_magnitude, 4)# [2、空間過濾器] # Spatial Filter # Spatial Filter is a fast implementation of Domain-Transform Edge Preserving Smoothing # 空間濾波器是域轉換邊緣保留平滑的快速實現 spatial = rs.spatial_filter() # filtered_depth = spatial.process(depth_frame) # We can emphesize the effect of the filter by cranking-up smooth_alpha and smooth_delta options: # 我們可以通過增加smooth_alpha和smooth_delta選項來強調濾鏡的效果: spatial.set_option(rs.option.filter_magnitude, 5) spatial.set_option(rs.option.filter_smooth_alpha, 1) spatial.set_option(rs.option.filter_smooth_delta, 50) # The filter also offers some basic spatial hole filling capabilities: # 該過濾器還提供一些基本的空間孔填充功能: spatial.set_option(rs.option.holes_fill, 3)# Next, we need to "feed" the frames to the filter one by one: # 接下來,我們需要將幀逐一“饋入”到過濾器: temporal = rs.temporal_filter()# 孔填充過濾器提供了附加的深度外推層: hole_filling = rs.hole_filling_filter()for x in range(10):frame = frames[x]frame = decimation.process(frame)frame = depth_to_disparity.process(frame)frame = spatial.process(frame)frame = temporal.process(frame)frame = disparity_to_depth.process(frame)frame = hole_filling.process(frame)colorized_depth = np.asanyarray(colorizer.colorize(frame).get_data())plt.imshow(colorized_depth)plt.show()結果:
總結
以上是生活随笔為你收集整理的Intel Realsense D435 Post-processing filters 后处理过滤器(用于消除图像的黑洞)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Intel Realsense D435
- 下一篇: Nginx 正向代理与反向代理区别