×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Help with writing a simple Matlab program

Help with writing a simple Matlab program

Help with writing a simple Matlab program

(OP)
Hello all,
I am just beginning with Matlab programming, and I would really appreciate your help in creating the following program:

1. first I need to import a text file with 1024x1024 integer numbers (representing pixel intensities in an image), and put this in a matrix.
2. for each number (=pixel) in the matrix, I need to compare that number to its 8 nighbours (the number above it, below it, to its left etc.) and determine which of the 8 neighbors has the highest value.
3. compute the angle from each number to its highest-value neighbor (for example, if the highest-value neighbor is the one above the number, then the angle is 0 degrees. The number below is 180 degrees, the number to the left is 270 degrees, etc.)

Thanks a lot in advance!

RE: Help with writing a simple Matlab program

Make sure you text file is white space delimited and a single column or a regular 1024 X 1024 structure.  In MATLAB you run a nonlinear 3X3 around using a double loop.  use "find" with a max( center - all else ) for the relative index.  Store the value  and the coordinate in individual matices.  Use a map to convert the coordinate to the angle, don't bother to do a calculation.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources