Bckground subraction using k means

1 回表示 (過去 30 日間)
vetri L
vetri L 2019 年 2 月 18 日
コメント済み: vetri L 2019 年 2 月 22 日
I have tried background subtraction algorithm using k means with matlab. Step 4 and 5 are difficult to understand. kinldly check and do the needful
1: Idown ←Down-sample the image to 25% of its original size using
simple linear interpolation.
clc;
clear;
close all;
I = imread ('45.jpg');
Idown=imresize(I,[256,256]);
2: Get the S channel of Idown and consider it as an 1-d vector V of
pixel intensities.
I_hsv = rgb2hsv(Idown);
HSV_s = I_hsv(:,:,2);
HSV_s_1 = HSV_s(:);
3: Perform Dbin ←K-Means(V, k = 2).
Dbin = kmeans(HSV_s_1,2);
4: MapM ← Dbin back to image space. For that just do a linear scan
of Dbin.
please help this step ( how to do linear scan?)
5: Mup ←Up-sample the generated binary mapMback to the input
image size.
please help this step
6: Close small holes on Mup using the Closing morphological operator
with a disk structuring element of radius 7 pixels.
se = strel('disk', 7)
closeBW = imclose(Mup,se);
**********************************************************
Please check the above steps and do the needful

採用された回答

Image Analyst
Image Analyst 2019 年 2 月 18 日
Since the color of the objects is nearly the same color as the background, I would probably not use color segmentation or kmeans. I'd probably use stdfilt() to identify "rough" things. The background will be smooth so you can then threshold it away.
  3 件のコメント
Image Analyst
Image Analyst 2019 年 2 月 22 日
Attached is a start. try playing with the parameters to see if you can optimize it.
vetri L
vetri L 2019 年 2 月 22 日
Thank you sir. I will try with your code

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by