Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
Jeff
Posts:
107
Registered:
2/27/10
|
|
Re: Tracking Overlapping Objects
Posted:
Aug 12, 2011 12:04 PM
|
|
"Keegan" wrote in message <j22ev2$obm$1@newscl01ah.mathworks.com>... > Thanks for all the replies everyone have given so far. I'm currently nearing completion of the project and I have but one problem: > > I need to uniquely differentiate the bounding boxes of the raptors as a means of identifying which raptor is which. It could be either by randomly picking a color for each bounding box or putting a label on top of each bounding box (i.e: bird 1). The bounding box drawing is based on MATLAB's own optical flow for tracking vehicles: http://www.mathworks.com/products/computer-vision/demos.html?file=/products/demos/shipping/vision/videotrafficof.html > > What I have tried so far is to attempt a while loop on the bounding box color to increase the RGB value of the bounding box, but what has happened so far is that the colors of the bounding box all changed together for the entire video. My question is, using the existing code, is there anyway to randomly assign a color for each raptor's bounding box individually? > > If it cannot be done, is it possible to put some sort of label on those bounding box with different tags? > > I know the while loop solution sounds silly but that's all I can think of right now. Hope to hear what others have for a solution.
This is what I use to plot region numbers assigned by regionprops on individual images, and is modified from on of Steve Eddins' blog posts on visualizing regionprops. You'll want to change the label assignment variable (C_NUM) to one that is static for each object.
function implot_roi_nums(imgin, maskin) %IMPLOT_ROI_NUMS will plot the label matrix values obtained from REGIONPROPS, given a %suitable input image IMGIN, and matched binary mask MASKIN for the regions %to be calculated
s = regionprops(maskin, 'Centroid');
imshow(imgin) %note this can be the original image, or the binary hold on
for k = 1:length(s) %loop through each region x = s(k).Centroid(1); %assign centroid x coord y = s(k).Centroid(2); %assign centroid y coord c_num = mat2str(k); %assign region number for each %plot text on image shown text (x, y, c_num, 'BackgroundColor', [.5 .5 .5], 'FontSize', 10); end
|
|
|
|