필터 지우기
필터 지우기

Create BW image of a Function

조회 수: 1 (최근 30일)
John
John 2013년 6월 18일
Hi,
I am wondering how one would go about creating a BW image of a function? So, say I have a function y = x^2. I can plot that pretty easily with "plot", however I'd like to create a BW image where a parabola ~2 pixels thick is white and the rest are black, for template matching purposes. Thoughts?
-Jen

답변 (1개)

Image Analyst
Image Analyst 2013년 6월 19일
Try using getframe() after you do the plot. You can also set the 'Color' and 'LineWidth' properties when you plot to specify the line color and width. There is a similar property for the background color though I don't know what it's called.
Or you can use export_fig() to save the whole figure or axes into an image file on disk. Or use saveas().
  댓글 수: 2
John
John 2013년 6월 20일
If possible, I'd like to not actually make a plot, just generate the appropriate binary matrix to use later in the program. This would be called hundreds of times.
Image Analyst
Image Analyst 2013년 6월 20일
This is possible. Just follow the example in the FAQ where they drew a circle and ellipse into an image: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by