- Noise Removal: For every captured depth image, perform noise removal.
- Calibration Step (One-Time): Capture a depth image of your table without any objects on it. Calculate the mean of the smallest 40,000 pixels, which represents about 20% of the 424x512 resolution. This mean value will serve as your "baseEstimate," providing a good approximation of the table's surface. You can tinker with this percentage if it does not work too well for your task.
- Object Segmentation Step: With an object on the table, capture a depth image. Calculate an estimate with a similar approach above for the top of the object, referred to as "topEstimate." Use these estimates to determine a threshold for the "imbinarize" function. A threshold like "baseEstimate + 0.1*(topEstimate-baseEstimate)" should effectively separate the object from the table in the binarized image.
Image segmentation using bwareafilt
4 ビュー (過去 30 日間)
古いコメントを表示
I have set of depth images in which I want to segement an object from it. I was able to get binary image of the object but I also have some unwanted data/noise along with it. Can someone suggest how to remove them?
Thanks in advance.
clc;
clear all;
close all;
workspace;
s = load(strcat('test_data/data3/d2/images_depth.mat')); %source of data
for i=1:7
img = (s.images_depth{1,i});
[filledDepth, zeroPixels] = Kinect_DepthNormalization(img);
a = mat2gray(filledDepth);
b = imbinarize(a);
b = bwareafilt(b, 1);
c = ~(b);
figure, imshow(c)
% figure,imshow(filledDepth, [])
figure,imshow(img, [])
% figure, imagesc(filledDepth)
end
0 件のコメント
回答 (1 件)
colordepth
2025 年 4 月 15 日
To clean up noise in your depth images, consider using a median filter, which is a straightforward method for noise removal. Check out this guide here: https://www.mathworks.com/discovery/denoising.html. Applying this before binarization will help reduce unwanted noise.
For binarizing your depth images, you can manually set a threshold in "imbinarize" by passing a second numerical argument. Experiment with thresholds to find one that best segments your object. More details on "imbinarize" can be found here: https://www.mathworks.com/help/images/ref/imbinarize.html. Rest assured that this will work consistently if your camera and table setup remain unchanged.
If you want an automated approach to automatically adjust to your setup, I suggest programming the following framework:
I enjoyed tinkering with depth cameras during my undergraduate, I'd be happy to help in answering any questions you have about the above approach :)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!