How to apply fluorescent filtering on an already working edge detection code?
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Image Analyst
on 11 Jul 2020
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?
6 Comments
More Answers (1)
Ben Timm
on 16 Jul 2020
Edited: Image Analyst
on 16 Jul 2020
4 Comments
Image Analyst
on 18 Jul 2020
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.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!