|
From: Roger Stafford on 22 Apr 2008 03:48 "Archana Ananthanarayan" <archana1985_ms(a)hotmail.com> wrote in message <fujhp2$hh7$1(a)fred.mathworks.com>... > http://www.iis.sinica.edu.tw/papers/fchang/2018-F.pdf > Am trying to implement this paper as a part of my project! > Can you infer anything? ---------- From the indicated paper I have abstracted what I think you are trying to do, Archana. Starting at a certain spatial position (x1,y1) (where x1 and y1 are integers,) you wish to draw a line at some specified angle t degrees with respect to the x-axis running through (x1,y1) over to the right as far as x-coordinate x2. You would like a list of all integer y-coordinates that best match points on the line y = y1 + (x-x1)*tan(t). When stated this way the problem almost solves itself. x = (x1:x2); y = round(y1+(x-x1)*tand(t)); To take a very small example, let x1 = 45, x2 = 56, y1 = 25, and t = 15 degrees. Then we have x = (x1:x2) = 45 46 47 48 49 50 51 52 53 54 55 56 y = round(25+(x-45)*tand(15)) = 25 25 26 26 26 26 27 27 27 27 28 28 These constitute the 12 pairs of x,y coordinates you would want to access on the image array along this 15-degree "line". Of course you need to convert these spatial coordinates to corresponding pixel coordinates, and you will probably want to use the matlab function 'sub2ind' or its equivalent for access of this type. I wouldn't be surprised if there were already such a function as this in the image processing toolbox. Roger Stafford
From: Archana Ananthanarayan on 22 Apr 2008 05:47 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <fuk57h$e3o$1(a)fred.mathworks.com>... > "Archana Ananthanarayan" <archana1985_ms(a)hotmail.com> wrote in > message <fujhp2$hh7$1(a)fred.mathworks.com>... > > http://www.iis.sinica.edu.tw/papers/fchang/2018-F.pdf > > Am trying to implement this paper as a part of my project! > > Can you infer anything? > ---------- > From the indicated paper I have abstracted what I think you are trying to do, > Archana. > > Starting at a certain spatial position (x1,y1) (where x1 and y1 are integers,) > you wish to draw a line at some specified angle t degrees with respect to the > x-axis running through (x1,y1) over to the right as far as x-coordinate x2. > You would like a list of all integer y-coordinates that best match points on > the line y = y1 + (x-x1)*tan(t). When stated this way the problem almost > solves itself. > > x = (x1:x2); > y = round(y1+(x-x1)*tand(t)); > > To take a very small example, let x1 = 45, x2 = 56, y1 = 25, and t = 15 > degrees. Then we have > > x = (x1:x2) > = 45 46 47 48 49 50 51 52 53 54 55 56 > > y = round(25+(x-45)*tand(15)) > = 25 25 26 26 26 26 27 27 27 27 28 28 > > These constitute the 12 pairs of x,y coordinates you would want to access on > the image array along this 15-degree "line". > > Of course you need to convert these spatial coordinates to corresponding > pixel coordinates, and you will probably want to use the matlab function > 'sub2ind' or its equivalent for access of this type. > > I wouldn't be surprised if there were already such a function as this in the > image processing toolbox. > > Roger Stafford > > ---------------------------------------------------------- Hey, I think i've got it cleared!! i wil ltry this and will post results with regards to this! THANKS!!
From: Walter Roberson on 22 Apr 2008 08:35 In article <fuk57h$e3o$1(a)fred.mathworks.com>, Roger Stafford <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote: > From the indicated paper I have abstracted what I think you are trying to do, >Archana. > Starting at a certain spatial position (x1,y1) (where x1 and y1 are integers,) >you wish to draw a line at some specified angle t degrees with respect to the >x-axis running through (x1,y1) over to the right as far as x-coordinate x2. >You would like a list of all integer y-coordinates that best match points on >the line y = y1 + (x-x1)*tan(t). When stated this way the problem almost >solves itself. > x = (x1:x2); > y = round(y1+(x-x1)*tand(t)); >These constitute the 12 pairs of x,y coordinates you would want to access on >the image array along this 15-degree "line". If the goal is to find the x,y coordinates that you would want to access on the image array along the line, then you may have duplicate x coordinates. Consider for example any line whose slope is 2 or more (or -2 or less). When I did this some months ago, I realized the key was to step along the coordinate that varied more, calculating the other coordinate for each step. Thus for angles between -45 and 45, or between 135 and 225, use the formula above, but with angles outside that range, increment along y instead, calculating x for each y. -- "No one has the right to destroy another person's belief by demanding empirical evidence." -- Ann Landers
From: Archana Ananthanarayan on 7 May 2008 14:57 As proposed, i've implemented this piece of code and ts working. i've some small problems and i hope someone will help me out. I've taken an image and taken its binary equivalent. after this, i draw the lines from x to y at various angles. The new y values are of fractional values. hence i take the int32(y) for the co-ordinates. I've to see whether the binary_image(x,y) has a white pixel. i've taken the condition for this to be equal to a zero, but this is not working. is something wrong with my condition?
From: Walter Roberson on 7 May 2008 15:09 In article <fvsu20$39c$1(a)fred.mathworks.com>, Archana Ananthanarayan <archana1985_ms(a)hotmail.com> wrote: >I've to see whether the binary_image(x,y) has a white pixel. >i've taken the condition for this to be equal to a zero, but >this is not working. is something wrong with my condition? Depends upon your convention. In colour and greyscale images, higher value is higher intensity, so white is associated with maximum intensity for them, not with minimum intensity. For binary images, you can use either way around as long as you use it consistenty and remember that the image display operators expect 0 to mean black. -- "Prevention is the daughter of intelligence." -- Sir Walter Raleigh
First
|
Prev
|
Pages: 1 2 Prev: Error using ==> subsindex Next: read *.mat from all the folders and subfolders |