| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 | #pragma once#include "OTSParticle.h"#include "OTSImageProcessParam.h"#include <OTSFieldData.h>namespace OTSIMGPROC {	using namespace OTSDATA;		// Re-magnification	const int nImage_Size = 3;	//make matrix filled with 255 	const int nBlackColor = 255;	//make binary processing parameter 128 	const int nProcessParam = 100;	//picture size	const int nPictureSize = 128;		// added to filtered pixels	const double delta = 0;	using namespace std;	class __declspec(dllexport) COTSImageProcess	{	public:		COTSImageProcess();		~COTSImageProcess();		// image process		// morphology		// LPBYTE source£º binary image pointer input£¬0, and 255		// LPBYTE target:  image pointer output		// WORD rows: image height		// WORD clumns: image width		// WORD wDegree: 1~8, eight direction selction.		// erode image with a structure of verticle 3 element		static void BErodeVertical3(LPBYTE source, LPBYTE target, WORD rows, WORD columns);		// erode image with a left 45 degree structure of 3 element		static void BErodeLeft45Degree3(LPBYTE source, LPBYTE target, WORD rows, WORD columns);		// erode image with a structure of horizontal 3 element		static void BErodeHorizontal3(LPBYTE source, LPBYTE target, WORD rows, WORD columns);		// erode image with a right 45 degree structure of 3 element		static void BErodeRight45Degree3(LPBYTE source, LPBYTE target, WORD rows, WORD columns);		// dilate image with a structure of verticle 3 element		static void BDilateVertical3(LPBYTE source, LPBYTE target, WORD rows, WORD columns);		// dilate image with a left 45 degree structure of 3 element		static void BDilateLeft45Degree3(LPBYTE source, LPBYTE target, WORD rows, WORD columns);		// dilate image with a structure of horizontal 3 element		static void BDilateHorizontal3(LPBYTE source, LPBYTE target, WORD rows, WORD columns);		// dilate image with a right 45 degree structure of 3 element		static void BDilateRight45Degree3(LPBYTE source, LPBYTE target, WORD rows, WORD columns);		// erode image with a structure of verticle 8 element		static void BErode3(LPBYTE source, LPBYTE target, WORD wDegree, WORD rows, WORD columns);		// dilate image with a structure of verticle 8 element		static void BDilate3(LPBYTE source, LPBYTE target, WORD wDegree, WORD rows, WORD columns);		// ReZoom the picture with re-magnification		static BOOL ReZoom(CString InPutPath, CString OutPutPath);		static BOOL RemoveBSEImageBG(CBSEImgPtr m_pBSEImg, COTSImageProcessParamPtr a_pImageProcessParam, COTSFieldDataPtr m_pFieldData);		static BOOL RemoveBGByFindContour(CBSEImgPtr m_pBSEImg, COTSImageProcessParamPtr a_pImageProcessParam, COTSFieldDataPtr m_pFieldData);		static BOOL RemoveBGByCVconnectivities(CBSEImgPtr m_pBSEImg, COTSImageProcessParamPtr a_pImageProcessParam, double a_pixelSize, COTSFieldDataPtr m_pFieldData);		static BOOL GetParticlesBySpecialGrayRange(CBSEImgPtr m_pBSEImg, CIntRangePtr a_grayRange, CDoubleRangePtr a_diameterRange, double a_pixelSize, COTSFieldDataPtr m_pFieldData);		static CIntRangePtr CalBackground(CBSEImgPtr m_pBSEImg);		static void GetSpecialGrayRangeImage(CBSEImgPtr a_pImgIn, CIntRangePtr a_SpecialGrayRange, CBSEImgPtr a_pBinImgOut, long& foundedPixelNum);		static void RemoveBackGround(CBSEImgPtr a_pImgIn, COTSImageProcessParamPtr a_pImageProcessParam, CBSEImgPtr a_pImgOut,long& foundedPixelNum);		static BOOL CalcuParticleImagePropertes(COTSParticlePtr part, double a_PixelSize);		static int SplitCString(const CString& str, const char* separator, int sep_number, vector<CString>& strArray);		static BOOL FindPeaks(DWORD* nChannelData, vector<CString>& eleList);		static void sortMapByValue(map<int, int>& tMap, vector<pair<int, int>>& tVector);		static BOOL MergeBigBoundaryParticles(COTSFieldDataList allFields, int overlap, double pixelSize, int scanFieldSize, CSize ResolutionSize, COTSParticleList& mergedParts);	protected:		static BOOL GetParticles(long left, long top, long a_nWidth, long a_nHeight, const BYTE* a_pPixel, COTSParticleList& a_listParticles);		static BOOL GetOneParticleFromROI(long left, long top, long a_nWidth, long a_nHeight, const BYTE* a_pPixel, COTSParticleList& a_listParticles);		static BOOL GetSegmentList(long left, long top, long a_nWidth, long a_nHeight, const BYTE* a_pPixel, COTSSegmentsList& a_listSegments);		static BOOL GetFeatureList(COTSSegmentsList& a_listSegments, COTSFeatureList& a_listFeatures);		static BOOL ChangeFeaturelist(COTSFeatureList& a_listFeatures, COTSParticleList& a_listParticle);					};}
 |