Thread Subject: How to show figure without black portion?

Subject: How to show figure without black portion?

From: Nan W.

Date: 19 Jul, 2008 02:53:02

Message: 1 of 3

Dear all,

I would like to know whether there is any techniques to show
to image in MATLAB without black portion border? My case is
I tried to superimpose two images with one is the rotate
version of another. So it would be great if the final image
has no black area causing by 'imrotate'.

Thanks in advance.

Subject: How to show figure without black portion?

From: Bruno Luong

Date: 19 Jul, 2008 06:09:01

Message: 2 of 3

"Nan W." <iiuu_chan@yahoo.co.jp> wrote in message
<g5rkue$4bg$1@fred.mathworks.com>...
> Dear all,
>
> I would like to know whether there is any techniques to show
> to image in MATLAB without black portion border? My case is
> I tried to superimpose two images with one is the rotate
> version of another. So it would be great if the final image
> has no black area causing by 'imrotate'.
>
> Thanks in advance.

Have you tried 'crop' option in the 4th argument of imrotate?

If it's not enough you might calculate the thickness of the
border from image size and rotation angle and throw manually
the borders.

I believe cropping will keep the same image size/image
magnification, but with a small border. Remove completely
the borders would change the original magnification, aspect
ratio, and image size.

Bruno

Subject: How to show figure without black portion?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 21 Jul, 2008 21:10:56

Message: 3 of 3

In article <g5rkue$4bg$1@fred.mathworks.com>,
Nan W. <iiuu_chan@yahoo.co.jp> wrote:

>I would like to know whether there is any techniques to show
>to image in MATLAB without black portion border?

texture-map the image onto a patch object whose coordinates
are the rotated rectangular pixel coordinates.

>My case is
>I tried to superimpose two images with one is the rotate
>version of another. So it would be great if the final image
>has no black area causing by 'imrotate'.

You could convert your image to truecolor and use tformarray()
but that might be overkill.

You might be able to get somewhere by converting your image to
truecolor, padding it with NaN all around, rotating it, and then
setting any 0 that is before the first NaN or after the last NaN to
be whatever value you wanted (and the NaN too of course.)

The work becomes a -lot- easier if you know that the original
image has no 0's: then you just set all of the 0's of the
rotated image to be the value you want.

But if you are superimposing two images, then that suggests to me
that you might be interested in transparency; you can either do
the alpha calculations yourself or you can use patches anyhow.
--
  "Pray do not take the pains / To set me right. /
   In vain my faults ye quote; / I wrote as others wrote /
   On Sunium's hight." -- Walter Savage Landor

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com