dfj328
dfj328

Reputation: 367

Approach for detecting centroids and orientation of objects in image

I am trying to detect the objects in the following image and calculate the centroids and orientation of each object in the image.

My approach so far has been to remove the background from the image and isolate the objects. However, the segmentation is not precise.

What other approaches can I take? Will SURF detection, using reference images, be a more accurate approach?

My attempt:

I = imread('image.jpg');
figure, imshow(I)

background = imopen(I,strel('disk',15));

I2 = I - background;
figure, imshow(I2);

I3 = imadjust(rgb2gray(I2));
figure, imshow(I3);

level = graythresh(I3);
bw = im2bw(I3,level);
bw = bwareaopen(bw, 50);
figure, imshow(bw)

enter image description here enter image description here

Upvotes: 1

Views: 368

Answers (1)

16per9
16per9

Reputation: 502

Nice start.

I would do the following:

1- pre process your image apply some filters and some convolutions to remove noise; dilation and erosion for instance.

2- after calculating the thresholds, try to fill in the masks so that you closed "objects". I think imfill - http://www.mathworks.com/help/images/ref/imfill.html - will help you doing this.

Also take a look at - http://www.mathworks.com/help/images/image-enhancement-and-analysis.html -

Upvotes: 1

Related Questions