how to create a video after an edge detection for loop
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ben Timm
el 4 de Jul. de 2020
Comentada: Ben Timm
el 9 de Jul. de 2020
Hi all!
Hopefully you can help, I'm having trouble getting this code to work. My aim is to apply edge detection to a video of cells (this part works and I am happy with it) and then have the frames of the resulting edge detection become a new .avi video in itself (that I can play just like the previous .avi file). I have tried a number of methods outside the for loop I created for the edge detection but none of it seems to work. The code is below:
function Vid_Edge_Detection_flourescent
v = VideoReader('VID00126.AVI');
n = v.NumFrames;
for i = 1:n
I0 = read(v,i);
I1 = im2bw(I0,graythresh(I0)-0.03);
I2 = bwareaopen(I1,50);
I3 = edge(I2);
II = imfuse(I0,I3);
imshow(II,'initialmagnification','fit')
pause(0.1)
end
open(v);
w = VideoWriter('Flourescent00126.AVI');
for k = 1:20
surf(sin(2*pi*k/20)*Z,Z)
frame = getframe(gcf);
writeVideo(v,frame);
end
close(v);
If anyone can help that would be amazing! I cant share the .avi as it is above 5mb but the general principle goes. Id like to have a new resulting avi file that the edge detection function has changed. Thanks in advance!
0 comentarios
Respuesta aceptada
Image Analyst
el 4 de Jul. de 2020
You're not writing the edge image out, either to a saved image file or the video. See my attached demos -- they show you how to do it. In particular the movie_Canny makes a movie of the edges.
4 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!