ImageProForClr.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include "BSEImgClr.h"
  3. #include "OTSImgProcPrmClr.h"
  4. #include "OTSImageProcess.h"
  5. #include <OTSFieldDataClr.h>
  6. #include "../OTSLog/COTSUtilityDllFunExport.h"
  7. namespace OTSIMGPROC
  8. {
  9. using namespace OTSCOMMONCLR;
  10. public ref class ImageProForClr
  11. {
  12. public:
  13. bool GetFieldDataFromImage(CBSEImgClr^ bseImg, COTSImgProcPrmClr^ perameter, COTSFieldDataClr^ fieldData)
  14. {
  15. bool ret = COTSImageProcess::RemoveBGByFindContour(bseImg->GetBSEImgPtr(), perameter->GetImgPrcPrmPtr(), fieldData->GetOTSFieldDataPtr());
  16. return ret;
  17. }
  18. bool CalcuParticleImagePropertes(COTSParticleClr^ particle, double a_PixelSize)
  19. {
  20. bool ret = COTSImageProcess::CalcuParticleImagePropertes(particle->GetOTSParticlePtr(), a_PixelSize);
  21. return ret;
  22. }
  23. BOOL MergeBigBoundaryParticles(System::Collections::Generic::List<COTSFieldDataClr^>^ allFields, double pixelSize, int scanFieldSize, Size ResolutionSize, System::Collections::Generic::List<COTSParticleClr^>^ mergedParts)
  24. {
  25. std::vector<COTSFieldDataPtr> allFlds;
  26. COTSParticleList mergedParticles;
  27. for each (auto f in allFields)
  28. {
  29. allFlds.push_back(f->GetOTSFieldDataPtr());
  30. }
  31. CSize CResolutionSize;
  32. CResolutionSize.cx = ResolutionSize.Width;
  33. CResolutionSize.cy = ResolutionSize.Height;
  34. bool ret = COTSImageProcess::MergeBigBoundaryParticles(allFlds, pixelSize, scanFieldSize, CResolutionSize, mergedParticles);
  35. for each (auto p in mergedParticles)
  36. {
  37. mergedParts->Add(gcnew COTSParticleClr(p));
  38. }
  39. return ret;
  40. }
  41. void RemoveBackGround(CBSEImgClr^ a_pImgIn, COTSImgProcPrmClr^ a_pImageProcessParam, CBSEImgClr^ a_pImgOut, long% foundedPixelNum)
  42. {
  43. // the background pixel will be 0,and the other part will be 255.
  44. long num = 0;
  45. COTSImageProcess::RemoveBackGround(a_pImgIn->GetBSEImgPtr(), a_pImageProcessParam->GetImgPrcPrmPtr(), a_pImgOut->GetBSEImgPtr(), num);
  46. foundedPixelNum = num;
  47. return ;
  48. }
  49. };
  50. }