Locating (x,y) position of an object
15 ビュー (過去 30 日間)
古いコメントを表示
Hi guys
Been scratching my head over this one.
The premise is, I have series of images generated from a video file. The video in question is a video observing spark discharges.
Currently I build up an intensity style image, in grayscale, highlighting where the discharge has been.
1) Get the video frame as RGB uint8 image 2) Convert to grayscale 3) Make all values <254 0, leaving just 254,255 I.E. Pure white. 4) some other code that cumulatively adds the images to build up a map of where the spark has been*
What I want to do now is,locate the discharge in terms of pixel position. Now to avoid picking up random splodges of white left over from stage 3), MatLab is going to have to find a roughly verticle line of white. The discharge shows up as a bold column of white. Ill then need to find the central co-ords of that column then compare those coordinates to a set of pre-defined coordinate boundaries. (ie the image is divided into rectangular regions) so I can determine which region it was in and then count it.
Can I use the find command to do this? I think I have the image processing tool box on this machine as well. Any special commands in there?
Here is an example of the type of thing I am trying to find
1 件のコメント
Sean de Wolski
2011 年 8 月 16 日
So the discharge is that series of blobs in the center left?
I think imclearborder and bwareaopen should take care of most of it.
回答 (3 件)
Image Analyst
2011 年 8 月 16 日
Do a dilation followed by bwconncomp and regionprops to get the largest blob. (By the way, I just shared with the imaging team at the Mathworks the need to have a function to keep the n largest blobs, as well as the need to rename bwareaopen which has nothing at all to do with morphology or opening.) Anyway, then use that dilated image as a mask on your original image. Then you will have only the spark blobs (though broken up). If you want to join it together after that masking, then use a vertical structuring element because the lines cutting it are horizontal and a vertical structuring element will get rid of those only and not widen the blob. Let me know if you need code. It shouldn't be very hard at all. See my BlobsDemo if you need a tutorial http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. If you need explanation of what a structuring element is, let me know (basically it says what elements to include or exclude in the operation).
Walter Roberson
2011 年 8 月 16 日
imdilate(), then bwlabel(), then regionprops(), and discard the areas whose height is below some threshold (not tall enough to be a streak.) regionprops() will have returned the centroid as well.
7 件のコメント
Sean de Wolski
2011 年 8 月 16 日
structuring elements are just kernels for a (special) convolution. (at least that's my understanding of them). You can always use a binary matrix instead of a strel
imdilate(bw,[0 1 0; 1 1 1; 0 1 0]); % etc.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!