MATLAB: How to apply fluorescent filtering on an already working edge detection code

edge detectionfluorescent imagingimageimage analysisimage processingImage Processing Toolboxvideo processing

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

Best Answer

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?