How to make???? (im using dilate and erode in matlab, and then i want to separate the background and the object.... )

im using dilate and erode in matlab, and then i want to separate the background and people in the poin of object, without the bring result background, and then the result of dilate and erode just people without the background, sorry, maybe my english not good, so, i hope u know what i mean and can help ... thx be 4 ... im using strel ....

5 个评论

Upload your image somewhere so we can talk.
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
http://www.mediafire.com/?fuw2gb4ur61i1gb .... maybe you can download this image image analyst, and please help mw, how to separated objek and background... i want to make the background white and the object is black.. this is my code : maybe something missing and must be added ... :
BWs=edge(image1,'canny');
se90=strel('line',3,90);
se0=strel('line',3,0);
BWsdil=imdilate(BWs,[se90 se0]);
BWdfill=imfill(BWsdil,'holes');
BWnobord=imclearborder(BWdfill,1);
seD=strel('disk',3);
BWfinal=imerode(BWnobord, seD);
BWfinal=imerode(BWfinal, seD);
BWfinal=invertimage(BWfinal);
axes(handles.axes1);
imshow(BWfinal);
imagemorfologi1=BWfinal;
gambar=(imagemorfologi1);
nama = strcat('image/dilasierosi/dilasi_',as,'.jpg');
imwrite(gambar,nama);
end
Those images (well the three I opened) were already black and white. What does your original image look like?
sean de ..... still a lot of noise, and the chance was taken with a smooth background , maybe you can see this link, http://www.mediafire.com/?ppjcofozta5ol5r this is another image that I use the same code

请先登录,再进行评论。

回答(1 个)

I think you wanted to implement something like background subtraction to do that. I dont think just doing dilation and erosion will get your answer. So let me start with background subtraction, Here you need a camera which is not moving.(steady camera, better use a tripod or keep it over a table). Now take a frame where the object is not present, we can call it as background image. Now take an image with object.Then Subtract background image and new image pixel wise. Keep some threshold and if the value goes above that threshold in a pixel that means object is available in that pixel. Actually this wont give great results ,you have to use gaussian mixture models for that. Read my paper to get a better idea.
It helps to remove shadow also!!

Community Treasure Hunt

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

Start Hunting!

Translated by