How can I segment depth images

1 回表示 (過去 30 日間)
Zara Khan
Zara Khan 2021 年 10 月 12 日
コメント済み: Zara Khan 2021 年 10 月 14 日
I have read depth imges and converted them into grayscale. Now how to segment the hand region properly.

回答 (1 件)

yanqi liu
yanqi liu 2021 年 10 月 12 日
sir,please check the follow code to get some information
clc; clear all; close all;
img = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/764791/img27.png');
bw = imbinarize(img,'adaptive','ForegroundPolarity','dark','Sensitivity',0.8);
bw = imclose(bw, strel('line', 5, 0));
bw = imclearborder(bw);
bw = bwareafilt(bw, 1);
bw = imclose(bw, strel('line', 25, 0));
bw = imfill(bw, 'holes');
bw = imopen(bw, strel('line', 15, 0));
bw = bwareafilt(bw, 1);
[r,c] = find(bw);
rect = [min(c) min(r) max(c)-min(c) max(r)-min(r)];
figure; imshow(img);
hold on; rectangle('position', rect, 'EdgeColor', 'g', 'LineWidth', 2)
  8 件のコメント
yanqi liu
yanqi liu 2021 年 10 月 14 日
clc; clear all; close all;
img = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/764791/img27.png');
bw = imbinarize(img,'adaptive','ForegroundPolarity','dark','Sensitivity',0.8);
bw = imclose(bw, strel('line', 5, 0));
bw = imclearborder(bw);
bw = bwareafilt(bw, 1);
bw = imclose(bw, strel('line', 25, 0));
bw = imfill(bw, 'holes');
bw = imopen(bw, strel('line', 15, 0));
bw = bwareafilt(bw, 1);
[r,c] = find(bw);
rect = [min(c) min(r) max(c)-min(c) max(r)-min(r)];
figure; imshow(img);
hold on; rectangle('position', rect, 'EdgeColor', 'g', 'LineWidth', 2)
% make mask
figure; imshow(bw)
img1 = img; img2 = img; img3 = img;
img1(~bw) = 0; img2(~bw) = 0; img3(~bw) = 0;
imgr = cat(3, img1, img2, img3);
figure; imshow(imgr);
Zara Khan
Zara Khan 2021 年 10 月 14 日
Mask is not working well. Still have some background portion. Any other idea?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by