Image Segmentation using Color Tresholder App ?
显示 更早的评论
Does anyone have idea how to create mask for this frame? I have a initital frame from video, and I want to create a mask so that later I can extract the region with the traffic policeman's gloves and track them in order to recognize a traffic gestures. I have tried with Color Tresholder App, but I fail to get the proper thresholds.
回答(1 个)
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/740009/untitled.jpg');
J = rgb2hsv(img);
s = mat2gray(J(:,:,2));
bw = im2bw(s, graythresh(s));
bw = imclose(bw, strel('line', 19, 90));
bw = bwareafilt(bw, 1);
bw = imdilate(bw, strel('disk',5));
J1 = img(:,:,1); J2 = img(:,:,2); J3 = img(:,:,3);
J1(bw) = 255; J2(bw) = 0; J3(bw) = 0;
Jt = cat(3,J1,J2,J3);
montage({img, bw, Jt}, 'Size', [1 3], 'BackgroundColor', 'w', 'BorderSize', [3 3])
类别
在 帮助中心 和 File Exchange 中查找有关 Image Segmentation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
