Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Edges between pixels
Replies: 5   Last Post: Mar 14, 2013 3:38 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Lee ZY

Posts: 23
Registered: 9/1/10
Edges between pixels
Posted: Mar 13, 2013 7:53 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi,
I would like to generate the edges between all the pixels in an image. For instance, a 3*3 image (pixel 1 to 9), the edges = [1 2;1 3; 1 4; 1 5; 1 6; 1 7; 1 8; 1 9; 2 3; 2 4; 2 5;..;2 9;..;9 7; 9 8].

One way i could think of is by replicating the values as follows,
n=3 ;
x=(1:3)';
r=repmat(x,1,n)';
r=r(:)

x2=[1:3];
r2=repmat(x2,1,n)'
edges=[r,r2]

and the output:
edges =

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
2 1
2 2
2 3
2 4
2 5
.
.
8 9
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
9 9

However when i tried on a relatively big image, i got this error,
??? Maximum variable size allowed by the program is exceeded.

Wondering if there is a more effective way of generating the edges. Thanks in advance!



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.