How do I select a region of interest across many frames?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to select a same region interest across many frames, I also want this region to be fixed for all the frames because I want to detect the movement of a particle across these frames. I would really appreciate any assistance. Thank you
0 comentarios
Respuestas (2)
Image Analyst
el 1 de Abr. de 2013
You can specify a region of interest in many ways.
You can interactively draw it using tools like roipoly(), roipolyold(), rbbox(), imrect(), or imfreehand(). You could specify a box by hard coding in the rows and columns. You could do segmentation, for example by intensity thresholding or color segmentation.
However you do it, you have a binary image that is the mask. You can get a frame of your video and then mask it with the ROI mask like this:
% Mask the image.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask,class(rgbImage)));
Here's a snippet you might find useful:
% Display image
subplot(2,2,1);
imshow(rgbImage);
% Have user freehand draw a mask in the image.
uiwait(msgbox('Draw a region with left button down. Double click inside to finish it'));
h = imfreehand();
vertices = wait(h);
% Create a binary mask
mask = createMask(h);
subplot(2,2,2);
imshow(mask, []);
% Mask the image.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask,class(rgbImage)));
subplot(2,2,3);
imshow(maskedRgbImage);
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!