Creating 2D geometric shapes?
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi, I need help here.
Basically, I am experimenting with this function called Hu Invariant Moment, starting off with a few geometric shapes (square, circle, triangle) created using (Windows) Paint. Those images were rotated, translated and scaled accordingly but for some strange reasons, when I saved those pictures, they didn't come out perfectly for me. What I meant by perfect was that I was expecting very thin contour lines (single pixel) for all the images, but that was not the case. By the way, the shapes are on white backgrounds.
So, is it possible to use MATLAB to create/draw out those shapes with the outlines as thin as possible?
댓글 수: 2
Sean de Wolski
2011년 6월 22일
Can you post the images somewhere so we can see them?
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
채택된 답변
Sean de Wolski
2011년 6월 22일
I would guess the image actually isn't losing information, you're just zoomed out enough that it's not displaying everything (computer pixel resolution). Zoom in on one of the subplots and see if it looks better close up.
edit from comments
I = imread('ans622.jpg'); %your image
imshow(I(:,:,1),[0 1]); That's your original image - and hence why you're seeing the skeleton the way it is.
so what you want is
Ibw =(I(:,:,1)>200); %red channel greater than 200;
imtool(Ibw); %already 1px thick but you could run bwmorph for good measure or fun.
댓글 수: 15
Sean de Wolski
2011년 6월 22일
because the other values are not visible due to the range that imshow is displaying. That's why I try to avoid it and use imtool. imtool offers you the adjust contrast tool on a visible histogram so you can see where/what values are and adjust the settings to make them visible.
(the little half white half black circle in imtool)
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!