You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int **Label = imatrix(nH, nW);
int SmallThre = 20; // the minimum area threshold for eliminating small connected components// Image: foregrounds ImageGray[y][x] > 128, // backgrounds otherwiseint LabelCnt = Labeling(Image, Label, nW, nH, SmallThre); // returns the number of labels// Labels are started from 0// Background regions are labeled as -1if(LabelCnt > 0)
{
CIpRect *pBoundBox = new CIpRect[LabelCnt]; // Bounding box (AABB: axis aligned bounding box)SetLabelBoundBox(Label, nW, nH, pBoundBox, LabelCnt); // extracts bounding boxes// Bounding box processingdelete [] pBoundBox;
}
free_imatrix(Label, nH, nW);
Example code for displaying images
unsignedchar **ImageGray; // 2D image array (grayscale)unsignedchar *Image1D; // 24bit color, BGR, 4byte allignedunsignedchar **ImageRed, **ImageGreen, **ImageBlue; // 2D image array (red, green and blue components)int **IIimage2D; // 2D image array (int)double **DImage2D; // 2D image array (double)int nW, nH; // Image sizeint nPosX, nPosY; // Display positionint Scale = 100; // Display scale// bool DisplayCimage2D(unsigned char **ImageGray, int nW, int nH, int nPosX, int nPosY, // bool bErase = true, bool bDelete = false, int Rate = 100);// if bErase is ture, the images which are not listed are erased// if bDelete is ture, the previously displayed image having the same size and the same position // with the current image is deleted from the dispaly listDisplayCimage2D(ImageGray, nW, nH, nPosX, nPosY, false, true, Scale);
DisplayIimage2D(IIimage2D, nW, nH, nPosX, nPosY, false, true); // IIimage2D data are normalized to [0, 255]DisplayDimage2D(DImage2D, nW, nH, nPosX, nPosY, false, true); // DImage2D data are normalized to [0, 255]DisplayCimage1D(Image1D, nW, nH, nPosX, nPosY, false, true, Scale);
DisplayCimage2DColor(ImageRed, ImageGreen, ImageBlue, nW, nH, nPosX, nPosY, false, true, Scale);
Visual Studio
Visual Studio 2019, 2017, 2015, 2013 and lower
MFC libraries are required
Project setting
Visual Studio 2013 and lower
Replace JpegLib.lib, JpegLibD.lib, JpegLib_64.lib and JpegLibD_64.lib with those in Libs(2013)
If the MFC libraries were not installed
Run 'Visual Studio Installer' by selecting the menu: [Tools]-[Get Tools and Features...]
Check [Desktop development with C++] in Workloads tab
Check [MFC and ATL support(x86 and x64)] in Summary