Thread Subject: Simple symmetry in image

Subject: Simple symmetry in image

From: Sven

Date: 29 Jan, 2008 05:56:02

Message: 1 of 3

Hi there,

I'm trying to guess a plane of symmetry in a grayscale image.
The plane is expected to be vertical (ie, left/right
symmetry that you would find in, say, an image of a
spray-painted letter 'V').

What technique should I use to determine this plane?
For example, I have tried moving a window of pixels from the
left to right end of the picture, and at each step:
- mirroring the right half of the window
- subtracting this mirrored right half from the window left half
- summing the resulting pixels
The result of this sum gives a measure of symmetry as a
function of horizontal location, however I'm sure there are
more precise and robust ways to get this measure.

Can anyone please enlighten me?
I have the image processing toolbox.

Thanks for any help,
Sven.

Subject: Simple symmetry in image

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

Date: 29 Jan, 2008 06:19:22

Message: 2 of 3

In article <fnmf5h$e1k$1@fred.mathworks.com>,
Sven <sven.holcombe@removethis.gmail.com> wrote:

>I'm trying to guess a plane of symmetry in a grayscale image.

>For example, I have tried moving a window of pixels from the
>left to right end of the picture, and at each step:
>- mirroring the right half of the window
>- subtracting this mirrored right half from the window left half
>- summing the resulting pixels
>The result of this sum gives a measure of symmetry as a
>function of horizontal location, however I'm sure there are
>more precise and robust ways to get this measure.

I do not have a better method to suggest at the moment, but
I note that your technique could possibly be optimized a bit
by using cumsum(). If you had C = cumsum() along rows,
and W the window size, and L the location being probed, then
the measure would be

sum( (C(:,L-W+1) - C(:,L-W)) - (C(:,L+W+1) - C(:,L+W)) )

or something close to that.
--
  "There are some ideas so wrong that only a very intelligent person
  could believe in them." -- George Orwell

Subject: Simple symmetry in image

From: Sven

Date: 29 Jan, 2008 07:20:25

Message: 3 of 3

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fnmgha$jn8$1@canopus.cc.umanitoba.ca>...
> In article <fnmf5h$e1k$1@fred.mathworks.com>,
> Sven <sven.holcombe@removethis.gmail.com> wrote:
>
> >I'm trying to guess a plane of symmetry in a grayscale image.
>
> >For example, I have tried moving a window of pixels from the
> >left to right end of the picture, and at each step:
> >- mirroring the right half of the window
> >- subtracting this mirrored right half from the window
left half
> >- summing the resulting pixels
> >The result of this sum gives a measure of symmetry as a
> >function of horizontal location, however I'm sure there are
> >more precise and robust ways to get this measure.
>
> I do not have a better method to suggest at the moment, but
> I note that your technique could possibly be optimized a bit
> by using cumsum(). If you had C = cumsum() along rows,
> and W the window size, and L the location being probed, then
> the measure would be
>
> sum( (C(:,L-W+1) - C(:,L-W)) - (C(:,L+W+1) - C(:,L+W)) )
>
> or something close to that.

Thanks Walter, the cumsum() method works very well. I have
found that for my images, the symmetry plane becomes more
apparent if I view the columnwise cumsum result, rather than
the original image. So, I am using your method on this
cumsum(originalI) image, and I can then find local absolute
mins in the result. I have to admit that I can't quite
conceptualise how your sum( ... ) line above actually works.
 Why do you only consider adjacent pairs of columns here?

Regardless, thank you very much.
Sven.

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
image Sven 29 Jan, 2008 01:00:14
symmetry Sven 29 Jan, 2008 01:00:14
rssFeed for this Thread

Public Submission Policy

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 Disclaimer prior to use.

Contact us at files@mathworks.com