Codebook for background-foreground segmentation
2 次查看(过去 30 天)
显示 更早的评论
Can someone please explain me how to write a code for codebook model for background-foreground segmentation on image sequence? I've read the paper about in Real-time Foreground-Background segmentation using codebook model by Kyungnam KIm. But because I am a beginner in image processing and also using MATLAB therefore I have no idea how to write the code for my research.
I am trying to write based on my understanding following the guideline on that paper:
close all; clear all; clc;
%Set the number of training frames
background = imread('C:\Users\View_001\frame_1.jpg');
numofframes= 100; threshold = numofframes/2;
bg_bw = double(rgb2gray(background));
fr_size = size(background); width = fr_size(2); height = fr_size(1); fg = zeros(height, width);
for j = 1:numofframes jpgFilename = strcat('C:\Users\View_001\frame_', int2str(j), '.jpg'); fr_img = imread(jpgFilename); fr_img = double (fr_img);
%foreground_img = (abs(double(fr_img) - double(bg_bw)));
%decompose the RGB components within the image
Img_R = fr_img(:,:,1)>threshold;
Img_G = fr_img(:,:,2)>threshold;
Img_B = fr_img(:,:,3)>threshold;
xt= R.^2 + G.^2 + B.^2;
xt= (xt).^0.5;
%Normalized the RGB image color
[row, col] size (fr_img(:,:,1));
for y= 1:row %number of rows in image
for x = 1:col %number of columns in the image
Red = Img_R (x,y);
Green= Img_G (x,y);
Blue = Img_B (x,y);
Normalized_R = Red/xt;
Normalized_G = Green/xt;
Normalized_B = Blue/xt;
end
end
and I am stucking on the normalized image and after that I have no idea to do.
Here the instruction from the paper:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153583/image.png)
I wish someone can teach me how to write the code.. Thank you
1 个评论
sanaa
2015-4-20
Sir/ Madame
Did you get any luck with this Code ??? Actually i'm working on the same program and i'm stuck , i need code for codebook model for background-foreground segmentation on image sequence? I've read the paper about in Real-time Foreground-Background segmentation using codebook model by Kyungnam KIm.
Thank you
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!