how to label a matrix and show it like an image/grid?

조회 수: 2 (최근 30일)
ramin bba
ramin bba 2014년 10월 14일
댓글: ramin bba 2014년 10월 15일
Is there such a way to create an image like the one below in MATLAB? I am interested in numbering some of the pixels in the manner like below. I have to change the parameters often and as such would like to automate the process (the general orange shape would be the same though).
Even a hint would be appreciated.
  댓글 수: 1
dpb
dpb 2014년 10월 15일
My first thought is to have a go at w/ text in an axes object. The grid is easy enough just with '[x|y]grid','on' and set a solid linestyle. The background would have to be patch I think...there I have little hands on experience, sorry...
The basics of the above would be an array of nan(10,11) with the values stored in the proper x,y coordinates.

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

채택된 답변

Image Analyst
Image Analyst 2014년 10월 15일
Perhaps you could make that an image with those values. Then use im2html: http://www.mathworks.com/matlabcentral/fileexchange/32273-im2html-m written by Steve Eddins of the Mathworks Image Processing team. I haven't tried it with a gray level image but I'd guess it would create a grid with the gray levels in the boxes instead of RGB values if you passed it a gray level image. It would be easy to modify if it didn't. However the shading of the box is the same as the gray level so you'd have to make a slight adaptation to make the box a constant orange color. And make another adaptation that if the value is zero to not display any text in the box.
  댓글 수: 1
ramin bba
ramin bba 2014년 10월 15일
thanks. I ended up writing my own code for a simpler version of the problem. The comments were indeed helpful and inspired the method.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by