Posts

Es werden Posts vom Dezember, 2016 angezeigt.

Matlab: Segmentation Growing

Bild
Segmentation Growing ( German ) This post is about a methode of segmentation where a region is defined (seed) . In this seed the standard deviation and the mean is calculated and with a factor f it is weigthed. Pixel which are in the neighborhood of the seed are added to the seed if their value is in the boundary defined by the standard deviation, mean value and weighting factor f. This is done iterative as long as no more pixel is added to the seed. Then the object is segmented. function [region, area, seed, sx1, sx2, sy1, sy2] = Segmentation_Growing(img,sx1,sx2,sy1,sy2,f): This function needs an image as an imput. If there is no other input value one can choose with to cursors the starting point sx1, sy1, the left upper corner, and the end point sx2, sy2, the right lower corner. Otherwise one can define the s-value as one wants. If one uses cursors, one can use the second input argument for defining the factor f. This factor describes the weigthing and is in an area bigger equa

Matlab: Dijkstra Methode - large neighborhood

Bild
The Dijkstra Methode - large neighborhood ( German )This is an update for the Dijkstra methode from the post before, where it uses now a larger neighborhood. It needs a bit longer but the probability to find the shortest path of many possible paths in the neighborhood is much higher. Here the comparing picture to Dijkstra Methode . Here one can download the following code on MathWorks: Source Code Dijkstra: function [path, prev, unvis, distance, start, target] = Dijkstra_Methode(Matrix, start, target) %Matrix is the incoming image %start is the start point in a vector [a,b] where a is the column and b the %row %target is the end point similare to start %path is the matrix with ones excepted at the position of the path where it is 0 %prev are also the previous visited pixels where the algorithm took the %wrong way %unvis are all unvisited pixels %distance is the distance or weight of the pixels %open the image and you can choose with the cursor the start %and end point if you d

Matlab: Dijkstra methode - shortest way on gradient (small neighborhood)

Bild
The Dijkstra Methode ( German ) In this post i show you with Matlab how to calculate the shortest path on a gradient images with d´the dijkstra methode i wrote. I take an image as an input and convert it to an double and calculate the gradient [G,Gdir] = imgradient(img,'sobel'); and I use my function Dijkstra(G,p,q) : THis function needs a image as double G , a start value p and the target q , where the first entry of the oints is the column and the second the row. This methode sets all distances to infinity except the at the start value is zero obviously. All unvisited pixels have the value 1. The algortihm continous as long as the target is an unvisible pixel. For all neighborhood pixels the weights are calculated with the function [weight] = localedgewidth(G,p,q) ,where the value of the neightbor pixel is substract by the maximum of the matrix and devided by the difference of maximal and minimal value of the matrix G and multiplied with the distance to the neighbor pi