How to apply fluorescent filtering on an already working edge detection code?
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
Accepted Answer
More Answers (1)
Ben Timm
on 16 Jul 2020
Edited: Image Analyst
on 16 Jul 2020
4 Comments
Image Analyst
on 16 Jul 2020
Looks weird to me. thisFrame if probable a 3-D RGB color image, so that's 3 channels. Then you're concatenating a gray image and an edge image onto it. That should make a 5 channel image, not a 3 channel RGB image. Even if thisFrame were gray scale (same as grayImage), it would be RGB but the edges would be only in the blue channel with the gray scale image in the red and green channel. This would appear as a yellow image with blue outlines on it, not a green image with magenta outlines like you wanted.
Ben Timm
on 16 Jul 2020
Ben Timm
on 18 Jul 2020
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.
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
