Help needed in image segmentation

2 views (last 30 days)
Srinivasan
Srinivasan on 6 Mar 2015
Answered: Image Analyst on 7 Mar 2015
Hi,i am mechanical engineering student working on a project to automatically detect the weld seam (The seam is a edge that is to be welded) present in a workshop. This is a basic terminology involved in welding.
To separate the weldment from the other objects, i have taken the background image and subtracted the foreground image having the weldment to obtain only the weldment
Background reference image
Image containing the weldment
Weldment obtained separately after image subtraction.
After image subtraction,there are the shadow ,glare and remnant noises of subtracted background are still present.As i want to automatically identify only the weld seam without the outer boundary of weldment, i have tried to detect the edges in the weldment image using canny algorithm and tried to eliminate the isolated noises using the function bwareopen.I have somehow obtained the approximate boundary of weldment and weld seam.The threshold i have used are purely on trial and error approach as dont know a way to automatically set a threshold to detect them.
After application of canny algorithm with a threshold of 0.05(Trial and error)
After using bwareaopen with threshold of 100 (Also on trial and error basis)
The problem now i am facing is that i cant specify an definite threshold as this algorithm should be able to identify the seam of any material regardless of surface texture,glare and shadow present. can anybody suggest me a way to remove the glare,shadow and isolated points from the background subtracted image.
Also i need help to get rid of the outer boundary and obtain only smooth weld seam from starting point to end point.
i have tried to use the following code:
a=imread('imageofworkpiece.jpg');
b=imread('background.jpg');
Ip = imsubtract(b,a);
imshow(Ip) % weldment separated
BW = rgb2gray(Ip);
c=edge(BW,'canny',0.05); % by trial and error
figure;imshow(c)
bw = bwareaopen(c, 100); % by trial and error
figure;imshow(bw)
Please suggest me a adaptive way to set a threhold and remove the outer boundary to detect only the seam. Any help with codes are sincerely appreciated.Thank you.

Answers (1)

Image Analyst
Image Analyst on 7 Mar 2015
First of all, put the part on a uniform background that will have no shadows, like black velvet. Then it looks like you can simply threshold to find the white part. Take the convex hull with bwconvhull() and the weld will be the black stuff inside the convex hull. I don't see why edge detection is needed.

Community Treasure Hunt

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

Start Hunting!