Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with writing a simple Matlab program

Status
Not open for further replies.

BrCo

Marine/Ocean
Nov 16, 2006
11
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!
 
Replies continue below

Recommended for you

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor