Image Segmentation using Color Tresholder App ?
Show older comments
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 Comment
PaunBGD
on 15 Sep 2021
Answers (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])
Categories
Find more on Image Segmentation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!