问题
I have a video of a welding procedure, and for every frame I need to take all the contours of the welded area, and detect all the edges. Unfortunately, the images I got aren't the best quality, I tried to put several filters and make image enhacement and it didn't work to take the sharp edges.
Image Below:

I managed to make the following code, but the results were terrible.
clc
clear all
vid = VideoReader('home/simulation/V6_008.avi');
h=ones(3,3)/9;
for i=1 : mov.NumberOfFrames
thisframe = read(vid,i);
g = image(thisframe);
lsave = sprintf('image.jpg');
saveas(g, lsave, 'jpg')
a = imread(lsave);
a1 = imcrop(a,[150 450 650 300]);
a2= imsharpen(a1,'Radius',50,'Amount',500);
b = rgb2gray(a2);
c=imadjust(b,[0.6 0.8],[]);
c1= imfilter(c,h);
c2=adapthisteq(c1,'cliplimit',0.01,'Distribution','exponential');
d = edge(c1,'canny',0.1);
e=bwareaopen(d,50);
imshow(e) end
these Filters and image enhacements helped a little bit, but it is still not enought for my measurements.
So I have 2 questions:
1) Do you know any other tool I can use to make my edge detection cleaner? I just want to outline the specified region as you can see.
2) I need to make the edge detection for every frame, and then save all the frames, and also save the video after edge detection. I don't really know how to do it. Do you?
Thanks very much guys, I apology if it was confusing. I'm afraid if I don't finish this properly I gonna get very troubled.. :(. Thanks again, I apreciate any help!
This is the edges I would Ideally have after edge detection:
来源:https://stackoverflow.com/questions/31565860/imageprocessing-matlab