Drawing a line down the middle of an object?
조회 수: 3 (최근 30일)
이전 댓글 표시
I have this image:
ignore the little specks, I have already got a method of removing them and leaving just the big block of white.
Is it possible to then trace a rough line down the middle of that object? and then replace that object with the line? It doesnt have to follow any kind of curvature, just a THIN straight line roughly following the angle and length. Also it could be helpful if the line was assigned a random colour.
I know regionprops will get me the centroid and there is an orientation property which seems to be the angle, but I cant be sure. Region props gave about 77 for orientation which looks about right. Is extent going to be the right thing to use with regionprops?
댓글 수: 0
답변 (1개)
BF83
2011년 8월 18일
Hi,
you could first calculate the centroid of your white object and then use princomp to get the object's eigenvector related to the greatest eigenvalue. This vector along with the centroid should allow you to plot your line.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!