Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxRegionalMaxima.h File Reference

More...

#include "HxSF.h"

Go to the source code of this file.

Functions

HxImageRep L_HXIMAGEREP HxRegionalMaxima (HxImageRep im, int conn)
 -function y=mmregmax_equ( f, bc) if (isa(f,'uint8')) k = 255; else k = 65535; fplus = mmaddm(f,1); g = mmsubm(fplus,mminfrec(f,fplus,bc)); y = mmunion(mmthreshad(g,1),mmthreshad(f,k));. More...


Detailed Description


Function Documentation

HxImageRep L_HXIMAGEREP HxRegionalMaxima HxImageRep    im,
int    conn
 

-function y=mmregmax_equ( f, bc) if (isa(f,'uint8')) k = 255; else k = 65535; fplus = mmaddm(f,1); g = mmsubm(fplus,mminfrec(f,fplus,bc)); y = mmunion(mmthreshad(g,1),mmthreshad(f,k));.

00037 {
00038     HxImageRep res;
00039 
00040 
00041     //in this list I put the labels representing regional maxima
00042     //this list will be used in a LUT
00043     //here the lut
00044     vector<int> regMaxList;
00045 //  regMaxList.clear();
00046 
00047     BasicFeaturesList bfl=HxGetBlobFeatures(im, res, conn, 0);
00048     HX_COUT << "bfl size=" << bfl.size() << STD_ENDL;
00049     for(int ix=0;ix<bfl.size();ix++)
00050     {   
00051         //this function works for gray images, not for color
00052         int cval = bfl[ix]->val.x();
00053         //now check if the the current value is the minimum among the neighbours
00054             //now find the gray value of that neighbor
00055         int nval;
00056         int maxnval=-1;
00057         for(int i=0;i<bfl[ix]->neighbors.size();i++)
00058         {
00059             nval=bfl[ix]->neighbors[i]->val.x();
00060             if(nval>maxnval)
00061                 maxnval=nval;
00062         }
00063         if(maxnval<cval && maxnval>=0)
00064         {
00065             regMaxList.push_back(bfl[ix]->label);
00066 //          printf("cval=%3d, maxN=%3d\n",cval,maxnval);
00067         }   
00068     }
00069 
00070 //now make the LUT from the list of regional maxima
00071 
00072 
00073     std::map<int,int> lut;
00074     int i;
00075     //lut is zero everywhere except the regional maxima position
00076     //here should be from minVal to MaxVal, not from 0 to 255
00077     for(i=0;i<256;i++)
00078         lut[i]=0;
00079 
00080     for(i=0;i<regMaxList.size();i++)
00081         lut[regMaxList[i]] = 255;
00082 
00083 
00084     res = HxLUT(res, &lut);
00086     HX_COUT << "nr of regional Maxima blobs=" << regMaxList.size() << STD_ENDL;
00087     return res;
00088 }


Generated on Tue Feb 3 14:18:50 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001