How to detect orientation of an object

14 Ansichten (letzte 30 Tage)
Teg
Teg am 30 Aug. 2018
Kommentiert: Teg am 31 Aug. 2018
Hello!
I've been stuck on this particular task for a while, so I thought I would ask the Computer Vision gurus on here. So far I've tried regionprops (specifically - orientation property of regionprops), which has been fairly poor for in terms of results. I was wondering if anyone has any tips or method for which I could calculate the orientation of a letter in the attached image. I've also attached an example image of what I would like to achieve.
Thank you.
Edit: Attached an input example image
Edit2: Attached imgmat.mat file containing the original image and a binary image.
Edit3: Attached shapeLetters.mat binary and an RGB image containing both letters and shapes for possible advice on clean segmentation of shapes and letters.
  6 Kommentare
Matt J
Matt J am 30 Aug. 2018
Centroids? What happened to orientation?
Teg
Teg am 30 Aug. 2018
Hi Matt! I am working on finding both the centroids and orientation. I was having terrible luck with calculation of the orientation, whereas with centroids I was having slightly better luck (but not perfect), hence why I included centroids later on. I will try your methods when I get home and let you know of my results :).

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 30 Aug. 2018
First find the letters. Pretty easy. Just threshold and call imclearborder() to get rid of the background, then do a little cleanup with bwareafilt() or bwareaopen().
Then detect which letter is which with Hu's moments http://www.youtube.com/watch?v=Nc06tlZAv_Q or Deep Learning. Or else just get the orientation from regionprops() and look at the angle delta from a correctly oriented letter.

Weitere Antworten (1)

Matt J
Matt J am 30 Aug. 2018
Bearbeitet: Matt J am 30 Aug. 2018
If possible, would you also be able to advice me how to best extract the letters in the image so I can find their centroids.
This seems to do a decent job,
tmp=medfilt2(~binaryImg,[1,7]);
tmp=medfilt2(tmp,[7,1]);
BWsymbols=logical(imfill(tmp,'holes')-tmp);
props=regionprops(BWsymbols,'Centroid','Orientation');
imagesc(BWsymbols);axis image; shg
  11 Kommentare
Image Analyst
Image Analyst am 31 Aug. 2018
You're welcome, but again, why do you NEED the orientation? Saying you need it "to know by how much the blob is rotated by for computer vision." is like saying you need it because you need it, basically a non-answer. Just curious.
Teg
Teg am 31 Aug. 2018
My current project will be used in another project as base code where I will be controlling a robot. For some part of the other project, it is required that I be able to detect the orientation of the objects within view of the camera on the robot. The actual specs haven't been laid out yet, only that I should be able to detect orientation of objects in vision.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by