Prev: Solving a transcendental equation
Next: SVM For OCR, is it possible to use input methods similar to neural net ?
From: Kenneth Galea on 31 Dec 2009 12:38 Hi everyone. I have a problem. I'm currently doing some image processing of different objects. I have already thresholded, made edge detection and labelled the different objects using bwlabel. Now since my final aim is to grasp different objects by a robotic arm, my task is to search around the borders/contours of different objects in order to find regions of minimum curvature in the image in order to be able to have a stable grasp/contact. My problem is that to achieve this, I need to go pixel by pixel around the object border/contour in order to be able to evaluate it. Pls check this image link which explains what I need: http://drop.io/curvature_computation As can be seen from this link, P(x[i] , y[i]) is the current pixel on the border to be evaluated while P(x[i+k], y[i+k]) is another pixel on the border (5 pixels after the current pixel where k=5). When using regionprops 'PixelList' I noticed that the pixels (x,y) coordinates are not listed according to the next pixel on the contour but are listed column by column which is not what I need since I cannot evaluate them in the manner explained above. Please any suggestions would be appreciated? Thanks Kenneth
From: ImageAnalyst on 31 Dec 2009 12:43 Kenneth You need to check out bwboundaries(), which WILL give you the chain code for your border/perimeter. Regards, ImageAnalyst
From: Kenneth Galea on 31 Dec 2009 13:00 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <a4066a04-75cf-4685-a957-2b759ab91d8e(a)m16g2000yqc.googlegroups.com>... > Kenneth > You need to check out bwboundaries(), which WILL give you the chain > code for your border/perimeter. > Regards, > ImageAnalyst Hi. Thanks for your reply. Ok so if I have two objects labelled objects (1) and (2) and use bwboundaries in this manner: B = bwboundaries(BW,conn) ...... where conn must be taken as 8 ....... how can I put these 2 objects in two different arrays with theri x,y coordinates?? Thanks Kenneth
From: ImageAnalyst on 31 Dec 2009 13:57 Kenneth: You should be able to figure it out from this snippet of code pulled from my demo at http://www.mathworks.com/matlabcentral/fileexchange/25157 % bwboundaries returns a cell array, where each cell % contains the row/column coordinates for an object in the image. % Plot the borders of all the coins on the original % grayscale image using the coordinates returned by bwboundaries. subplot(3, 3, 6); imagesc(originalImage); title('Outlines, from bwboundaries()'); axis square; hold on; boundaries = bwboundaries(binaryImage); for k = 1 : numberOfBlobs thisBoundary = boundaries{k}; % Stuff into a double array. plot(thisBoundary(:,2), thisBoundary(:,1), 'g', 'LineWidth', 2); end hold off;
From: Kenneth Galea on 2 Jan 2010 04:57 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <61ea651b-6322-46a6-9889-cc22e81be27a(a)u41g2000yqe.googlegroups.com>... > Kenneth: > You should be able to figure it out from this snippet of code pulled > from my demo at > http://www.mathworks.com/matlabcentral/fileexchange/25157 > > % bwboundaries returns a cell array, where each cell > % contains the row/column coordinates for an object in the image. > % Plot the borders of all the coins on the original > % grayscale image using the coordinates returned by bwboundaries. > subplot(3, 3, 6); imagesc(originalImage); title('Outlines, from > bwboundaries()'); axis square; > hold on; > boundaries = bwboundaries(binaryImage); > for k = 1 : numberOfBlobs > thisBoundary = boundaries{k}; % Stuff into a double array. > plot(thisBoundary(:,2), thisBoundary(:,1), 'g', 'LineWidth', 2); > end > hold off; Hi, thanks for your reply I think I didn't explain myself clearly. I'm not using a binary image in bwboundaries but a matrix L where 0 = background, 1 = 1st object, 2 = 2nd object.....this still worked well with the following code: B = bwboundaries(L,8, 'noholes') for counter = 1:num tB = B{counter} end Now what I'll need is that tB (i.e. the array name) changes with every object i.e. tB1 represents object 1 and tB2 represents object 2. When trying this: tB{counter}= B{counter} matlab gives me an error. Sorry for such a basic question but I cannot implement it...what I'll need is just a change in string name. Thnaks Kenneth
|
Next
|
Last
Pages: 1 2 3 Prev: Solving a transcendental equation Next: SVM For OCR, is it possible to use input methods similar to neural net ? |