It computes profile of the image or matrix, including, possibly, averaging over a moving window around a point, and the standard deviation withing the window.
int MakeLineProfile( vector<int> & vnRows, vector<int> & vnCols, OImageMakeLineProfileParams * pstParams, matrix & matOut, matrix & matOutAux = NULL )
struct OImageMakeLineProfileParams { //They are used only if the line of points is horizontal or vertical. //They are the number of points BEFORE(Behind) or AFTER(Ahead) the current point in the same direction //as other points, which should be averaged over to produce the final result. //For example, if vnRows and vnCols produce a vertical line(which means all the values in vnCols are the same) //then this variable determines how many rows before and after the current point's row are averaged over. int nPtsBehind; int nPtsAhead; //They are used only if the line of points is horizontal or vertical. //They are the number of points BEFORE or AFTER the current point //n the perpendicular direction of all other points which should be //averaged over to produce the final result. For example, if vnRows //and vnCols produce a vertical line(which means all the values in vnCols are the same) //then this variable determines how many columns before and after //the all point's column are averaged over. //These are used ONLY for lines of points that are vetical (all the //values in vnCols are the same) or horizontal (all the values in vnRows are the same), //otherwise they are not used, i.e. there is no averaging and the //value of the profile at the current point equals the value of the pixel at that position. int nPtsSideBefore; int nPtsSideAfter; //Used if the line of points is neither horizontal nor vertical - //it represents the radius around the current point to determine //which neighboring points ought to be included in averaging. //If 0, only the input point is put into the output. double radius; }
0 if success, otherwise FALSE.
EX1
void test_arbitrary_line_profile(int nFixedPos = 10, int nWidth=3, int bVertical = 1) { ImageLayer imglayer = Project.ActiveLayer(); if (!imglayer.IsValid()) { out_str("Inavlid Active Window!"); return; } int nW = imglayer.GetProp("Width"); int nH = imglayer.GetProp("Height"); int nCount = nH; if(bVertical==0) nCount = nW; vector<int> vnRows; vector<int> vnCols; vnRows.Data(0, nCount - 1); vnCols.Data(0, nCount - 1); OImageMakeLineProfileParams params; params.nPtsBehind = 2; params.nPtsAhead = 3; params.nPtsSideBefore = 0; params.nPtsSideAfter = nWidth; params.radius = 4; matrix matOut, matOutAux; int nRet = imglayer.MakeLineProfile(vnRows, vnCols, ¶ms, matOut, matOutAux); MatrixPage mp; mp.Create("Origin"); Matrix matA; matA.Attach(mp.GetName()); matA = matOut; MatrixPage mp2; mp2.Create("Origin"); Matrix matB; matB.Attach(mp2.GetName()); matB = matOutAux; return; }
origin.h