How to apply fluorescent filtering on an already working edge detection code?
3 次查看(过去 30 天)
显示 更早的评论
Hi all, back again!
I have a really great piece of code for edge detection (see attached) however prior to getting it working, my previous code created fluorescent style images such as attached. The code for it is seen here:
"
Function Vid_Edge_Detection_flourescent
v = VideoReader('VID00125.AVI');
n = v.NumFrames;
for i = 1:n
I0 = read(v,i);
I1 = im2bw(I0,graythresh(I0)-0.03); % binarize image with treshold
I2 = bwareaopen(I1,50); % remove small regions (50 pixels)
I3 = edge(I2);
II = imfuse(I0,I3);
imshow(II,'initialmagnification','fit')
pause(0.1)
end
end
"
From what I understand, the old code produced a double layer, the background one being altered to a green background and the forground being the edge detection. Essentially, I'm trying to get the same thing for the new attached code but because of all the for loops, I really have no idea where/what to change. Can anyone assist?
Thanks in advance,
Ben
0 个评论
采纳的回答
Image Analyst
2020-7-11
Not sure what you want. Do you just want the edges overlaid on the original image frames, perhaps in some specified color, like magenta? Do you want the main image converted to grayscale and then put into the green channel while the edges to into the blue and red channel? Like this:
rgbImage = cat(3, edgeImage, rgb2gray(thisFrame), edgeImage);
where thisFrame is the original RGB image, and edgeImage is a grayscale image with values of 0 and 255 only?
更多回答(1 个)
Ben Timm
2020-7-16
编辑:Image Analyst
2020-7-16
4 个评论
Image Analyst
2020-7-18
It's probably recalling a still image that's not the same size as the others that it has been using to build the movie with so far. Check the size of thisFrame and see what it is for each frame, like
fprintf('For %s\n Frame #%d, rows = %d, columns = %d\n', ...', ...
outputFullFileName, frame, size(thisFrame, 1), size(thisFrame, 2));
When if throws the error, look in the command window for what it said for all the frames up to that point.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!