Creating 2D geometric shapes?

6 ビュー (過去 30 日間)
Jason
Jason 2011 年 6 月 22 日
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
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
Jason
Jason 2011 年 6 月 22 日
Hi Sean, thank you for you post. This is the results that I got when I run the code. Note: First image of each row is the original image, followed by the translated, rotated and scaled ones respectively.
http://www.flickr.com/photos/jokerzy89/5859633359/in/photostream

サインインしてコメントする。

採用された回答

Sean de Wolski
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
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)
Jason
Jason 2011 年 6 月 22 日
Awesome, thank you once again!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by