首页 > 技术文章 > halcon的 同类 仿照 替代 代替品 ,机器视觉 软件 Malcon算子展示,后续陆续添加中......

Malcon 2020-11-28 14:37 原文

VISION_API void DrawRectangle2Mod(const MTuple& WindowHandle, const MTuple& RowIn, const MTuple& ColumnIn, const MTuple& PhiIn, const MTuple& Length1In, const MTuple& Length2In, MTuple* Row, MTuple* Column, MTuple* Phi, MTuple* Length1, MTuple* Length2);
VISION_API void DrawRectangle2(const MTuple& WindowHandle, MTuple* Row, MTuple* Column, MTuple* Phi, MTuple* Length1, MTuple* Length2);
VISION_API void DrawRectangle1Mod(const MTuple& WindowHandle, const MTuple& Row1In, const MTuple& Column1In, const MTuple& Row2In, const MTuple& Column2In, MTuple* Row1, MTuple* Column1, MTuple* Row2, MTuple* Column2);
VISION_API void HomMat2dIdentity(MTuple* HomMat2DIdentity);
VISION_API void HomMat2dTranslate(const MTuple& HomMat2D, const MTuple& Tx, const MTuple& Ty, MTuple* HomMat2DTranslate);
VISION_API void HomMat2dTranslateLocal(const MTuple& HomMat2D, const MTuple& Tx, const MTuple& Ty, MTuple* HomMat2DTranslate);
VISION_API void HomMat2dSlant(const MTuple& HomMat2D, const MTuple& Theta, const MTuple& Axis, const MTuple& Px, const MTuple& Py, MTuple* HomMat2DSlant);
VISION_API void HomMat2dSlantLocal(const MTuple& HomMat2D, const MTuple& Theta, const MTuple& Axis, MTuple* HomMat2DSlant);
VISION_API void HomMat2dScale(const MTuple& HomMat2D, const MTuple& Sx, const MTuple& Sy, const MTuple& Px, const MTuple& Py, MTuple* HomMat2DScale);
VISION_API void HomMat2dScaleLocal(const MTuple& HomMat2D, const MTuple& Sx, const MTuple& Sy, MTuple* HomMat2DScale);
VISION_API void HomMat2dRotate(const MTuple& HomMat2D, const MTuple& Phi, const MTuple& Px, const MTuple& Py, MTuple* HomMat2DRotate);
VISION_API void HomMat2dRotateLocal(const MTuple& HomMat2D, const MTuple& Phi, MTuple* HomMat2DRotate);
void MTupleToHomMat(const MTuple & HomMat2D, MObject*rotMat2);
void MTupleToHomMat23(const MTuple & HomMat2D, MObject*rotMat2);
void HomMatToMTuple(MObject moNew, MTuple *mtOut, int nMode=0);
VISION_API void HomMat2dInvert(const MTuple& HomMat2D, MTuple* HomMat2DInvert);
VISION_API void HomMat2dToAffinePar(const MTuple& HomMat2D, MTuple* Sx, MTuple* Sy, MTuple* Phi, MTuple* Theta, MTuple* Tx, MTuple* Ty);
VISION_API void AffineTransPoint2d(const MTuple& HomMat2D, const MTuple& Px, const MTuple& Py, MTuple* Qx, MTuple* Qy);
VISION_API void VectorToHomMat2d(const MTuple& Px, const MTuple& Py, const MTuple& Qx, const MTuple& Qy, MTuple* HomMat2D);
VISION_API void SmallestCircle(const MObject& Regions, MTuple* Row, MTuple* Column, MTuple* Radius);
VISION_API void Complement(const MObject& Region, MObject* RegionComplement);
VISION_API void ShapeTrans(const MObject& Region, MObject* RegionTrans, const MTuple& Type);
VISION_API void InvertImage(const MObject& Image, MObject* ImageInvert);
VISION_API void ZoomRegion(const MObject& Region, MObject* RegionZoom, const MTuple& ScaleWidth, const MTuple& ScaleHeight);
VISION_API void ZoomImageFactor(const MObject& Image, MObject* ImageZoomed, const MTuple& ScaleWidth, const MTuple& ScaleHeight, const MTuple& Interpolation);
VISION_API void PolarTransImage(const MObject& ImageXY, MObject* ImagePolar, const MTuple& Row, const MTuple& Column, const MTuple& Width, const MTuple& Height);
//VISION_API void PolarTransImage(const MObject& Image);
VISION_API void PolarTransRegion(const MObject& Region, MObject* PolarTransRegion, const MTuple& Row, const MTuple& Column, const MTuple& AngleStart, const MTuple& AngleEnd, const MTuple& RadiusStart, const MTuple& RadiusEnd, const MTuple& Width, const MTuple& Height, const MTuple& Interpolation);
VISION_API void PolarTransRegionInv(const MObject& PolarRegion, MObject* XYTransRegion, const MTuple& Row, const MTuple& Column, const MTuple& AngleStart, const MTuple& AngleEnd, const MTuple& RadiusStart, const MTuple& RadiusEnd, const MTuple& WidthIn, const MTuple& HeightIn, const MTuple& Width, const MTuple& Height, const MTuple& Interpolation);
VISION_API void PolarTransImageInv(const MObject& PolarImage, MObject* XYTransImage, const MTuple& Row, const MTuple& Column, const MTuple& AngleStart, const MTuple& AngleEnd, const MTuple& RadiusStart, const MTuple& RadiusEnd, const MTuple& Width, const MTuple& Height, const MTuple& Interpolation);
VISION_API void PolarTransImageExt(const MObject& Image, MObject* PolarTransImage, const MTuple& Row, const MTuple& Column, const MTuple& AngleStart, const MTuple& AngleEnd, const MTuple& RadiusStart, const MTuple& RadiusEnd, const MTuple& Width, const MTuple& Height, const MTuple& Interpolation);
VISION_API void CalcHistColor(MObject& Image, MTuple* mtHistR, MTuple* mtHistG, MTuple* mtHistB, MTuple* mtMax);
VISION_API void CalcHistGray(MObject& Image, MTuple* mtHist, MTuple* mtMax);
VISION_API int TestRegionPoint(const MObject& Regions, const MTuple& Row, const MTuple& Column, MTuple* IsInside);

//以上是新增的


//测量//////////////////////////////////////////////////////////////////////////
VISION_API void GenMeasureRectangle2(const MTuple & Row, const MTuple & Column, const MTuple & Phi, const MTuple & Length1, const MTuple & Length2, const MTuple & Width, const MTuple & Height, const MTuple & Interpolation, MTuple * MeasureHandle);
VISION_API void GenRectangle2(MObject * Rectangle, const MTuple & Row, const MTuple & Column, const MTuple & Phi, const MTuple & Length1, const MTuple & Length2);
VISION_API void MeasurePos(MObject& Image, MTuple& MeasureHandle, const MTuple& Sigma, const MTuple& Threshold, const MTuple& Transition, const MTuple& Select, MTuple* RowEdge, MTuple* ColumnEdge, MTuple* Amplitude, MTuple* Distance);
VISION_API void CloseMeasure(const MTuple& MeasureHandle);

//边缘//////////////////////////////////////////////////////////////////////////
VISION_API void EdgesImage(MObject& Image, MObject* ImaAmp, MObject* ImaDir, const MTuple& Filter, const MTuple& Alpha, const MTuple& NMS, const MTuple& Low, const MTuple& High);
VISION_API void FitCircleContourXld(const MObject& Contours, const MTuple& Algorithm, const MTuple& MaxNumPoints, const MTuple& MaxClosureDist, const MTuple& ClippingEndPoints, const MTuple& Iterations, const MTuple& ClippingFactor, MTuple* Row, MTuple* Column, MTuple* Radius, MTuple* StartPhi, MTuple* EndPhi, MTuple* PointOrder);
VISION_API void GenContourRegionXld(const MObject& Regions, MObject* Contours, const MTuple& Mode);
VISION_API void EdgesSubPix(MObject& Image, MObject* Edges, const MTuple& Filter, const MTuple& Alpha, const MTuple& Low, const MTuple& High);

//变形匹配
VISION_API void CreateVariationModel(const MTuple& Width, const MTuple& Height, const MTuple& Type, const MTuple& Mode, MTuple* ModelID);
VISION_API void PrepareDirectVariationModel(MObject& RefImage, MObject& VarImage, const MTuple& ModelID, const MTuple& AbsThreshold, const MTuple& VarThreshold);
VISION_API void CompareVariationModel(MObject& Image, MObject* Region, const MTuple& ModelID);
VISION_API void ClearVariationModel(const MTuple& ModelID);
VISION_API void PrepareVariationModel(const MTuple& ModelID, const MTuple& AbsThreshold, const MTuple& VarThreshold);
VISION_API void GetThreshImagesVariationModel(MObject* MinImage, MObject* MaxImage, const MTuple& ModelID);
VISION_API void WriteVariationModel(const MTuple& ModelID, const MTuple& FileName);
VISION_API void ReadVariationModel(const MTuple& FileName, MTuple* ModelID);
//条码识别
VISION_API void CreateDataCode2dModel(const MTuple& SymbolType, const MTuple& GenParamNames, const MTuple& GenParamValues, MTuple* DataCodeHandle);
VISION_API void FindDataCode2d(MObject& Image, MObject* SymbolXLDs, const MTuple& DataCodeHandle, const MTuple& GenParamNames, const MTuple& GenParamValues, MTuple* ResultHandles, MTuple* DecodedDataStrings);
VISION_API void ClearDataCode2dModel(const MTuple& DataCodeHandle);
VISION_API void SetDataCode2dParam(const MTuple& DataCodeHandle, const MTuple& GenParamNames, const MTuple& GenParamValues);
VISION_API void SetBarCodeParam(const MTuple& BarCodeHandle, const MTuple& GenParamNames, const MTuple& GenParamValues);
VISION_API void CreateBarCodeModel(const MTuple& GenParamNames, const MTuple& GenParamValues, MTuple* BarCodeHandle);
VISION_API void ClearBarCodeModel(const MTuple& BarCodeHandle);
VISION_API void FindBarCode(MObject& Image, MObject* SymbolRegions, const MTuple& BarCodeHandle, const MTuple& CodeType, MTuple* DecodedDataStrings);
//////////////////////////////////////////////////////////////////////////
//字符识别
VISION_API void WriteOcrTrainf(MObject& Character, MObject& Image, const MTuple& Class, const MTuple& TrainingFile);
VISION_API void ReadOcrTrainfNames(const MTuple& TrainingFile, MTuple* CharacterNames, MTuple* CharacterCount);
VISION_API void CreateOcrClassKnn(const MTuple& WidthCharacter, const MTuple& HeightCharacter, const MTuple& Interpolation,const MTuple& Features, const MTuple& Characters, const MTuple& GenParamNames, const MTuple& GenParamValues, MTuple* OCRHandle);
VISION_API void TrainfOcrClassKnn(const MTuple& OCRHandle, const MTuple& TrainingFile, const MTuple& GenParamNames, const MTuple& GenParamValues);
VISION_API void DoOcrMultiClassKnn(MObject& Character, MObject& Image, const MTuple& OCRHandle, MTuple* Class, MTuple* Confidence);
VISION_API void DoOcrSingleClassKnn(MObject& Character, MObject& Image, const MTuple& OCRHandle, const MTuple& NumClasses, const MTuple& NumNeighbors, MTuple* Class, MTuple* Confidence);
VISION_API void ClearOcrClassKnn(const MTuple& OCRHandle);


//////////////////////////////////////////////////////////////////////////
void Region2Image(int nFeatureNum, Size size, rlFeature *rlFete, MObject*moOut);
void rlFeature2MObject_Three(int nR, int nG, int nB, MObject&HOSrcImage, rlFeature* rlF, int nFeatureNum, Malcon::Size size);
void rlFeature2MObject_One(rlFeature *rlF, Malcon::Size size, MObject& res, int nValue);
VISION_API void DispImage(MObject& Image, MTuple &WindowHandle);
VISION_API void DispImageMargin(MObject& Image, MTuple &WindowHandle);
VISION_API void DispImageFull(MObject& Image, MTuple &WindowHandle);
VISION_API void GetPart(const MTuple& WindowHandle, MTuple* Row1, MTuple* Column1, MTuple* Row2, MTuple* Column2);
VISION_API void GetMposition(const MTuple& WindowHandle, MTuple* Row, MTuple* Column, MTuple* Button);

//显示窗口
VISION_API void SetDraw(const MTuple& WindowHandle, const MTuple& Mode);
VISION_API void SetColor(const MTuple& WindowHandle, const MTuple& Color);
VISION_API void SetLineWidth(const MTuple& WindowHandle, const MTuple& Width);
VISION_API void DispCircle(const MTuple& WindowHandle, const MTuple& Row, const MTuple& Column, const MTuple& Radius);
VISION_API void DispLine(const MTuple& WindowHandle, const MTuple& Row1, const MTuple& Column1, const MTuple& Row2, const MTuple& Column2);
VISION_API void DispRectangle1(const MTuple& WindowHandle, const MTuple& Row1, const MTuple& Column1, const MTuple& Row2, const MTuple& Column2);
VISION_API void SetDisplayFont(const MTuple&WindowHandle, const MTuple& Size, const MTuple& Font, const MTuple& Bold, const MTuple& Slant);
VISION_API void DispMessage(const MTuple& WindowHandle, const MTuple& String, const MTuple& CoordSystem, const MTuple& Row, const MTuple& Column, const MTuple&Color, const MTuple& Box );
VISION_API void SetTposition(const MTuple& WindowHandle, const MTuple& Row, const MTuple& Column);
VISION_API void WriteString(const MTuple& WindowHandle, const MTuple& String);
VISION_API void ClearWindow(MTuple &WindowHandle);
VISION_API void CloseWindow(MTuple &WindowHandle);
VISION_API void OpenWindow(long Column, long Row, long Width, long Height, long FatherWindow, long Mode, char* Machine, MTuple* WindowHandle);

VISION_API void GetWindowExtents(const MTuple& WindowHandle, MTuple* Row, MTuple* Column, MTuple* Width, MTuple* Height);
VISION_API void SetWindowExtents(MTuple &WindowHandle, long Column, long Row, long Width, long Height);
VISION_API void SetPart(const MTuple& WindowHandle, const MTuple& Row1, const MTuple& Column1, const MTuple& Row2, const MTuple& Column2);

//读写图片//////////////////////////////////////////////////////////////////////////
VISION_API void GenImage1(MObject* Image, const MTuple& Type, const MTuple& Width, const MTuple& Height, const MTuple& PixelPointer);
VISION_API void GetImageSize(const MObject& Image, MTuple* Width, MTuple* Height);
VISION_API void GetRegionFromWin(MTuple &WindowHandle, MObject *hoImage);
VISION_API void GetImageFromWin(MTuple &WindowHandle, MObject *hoImage);
VISION_API void GetWinFromHandle(MTuple &WindowHandle,MalconWin *pTrackView);
VISION_API void ReadImage(MObject *Dst, char*pFileName);
VISION_API void Rgb1ToGray(const MObject& RGBImage, MObject* GrayImage);
VISION_API void Rgb3ToGray(const MObject& ImageRed, const MObject& ImageGreen, const MObject& ImageBlue, MObject* ImageGray);
VISION_API void Decompose3(const MObject& MultiChannelImage, MObject* Image1, MObject* Image2, MObject* Image3);
VISION_API void Compose3(const MObject& Image1, const MObject& Image2, const MObject& Image3, MObject* MultiChannelImage);

VISION_API void WriteImage(const MObject& Image, const MTuple& Format, const MTuple& FillColor, const MTuple& FileName);
VISION_API void GetGrayval(MObject& Image,MTuple& Row, MTuple& Column, MTuple* Grayval);
//区域region//////////////////////////////////////////////////////////////////////////
VISION_API void ConcatObj(const MObject& Objects1, const MObject& Objects2, MObject* ObjectsConcat);
VISION_API void Union1(MObject& Region, MObject *RegionUnion);
VISION_API void FillUp(const MObject & Region, MObject * FillUpRegion);
VISION_API void CropDomain(MObject& Image, MObject * ImageCrop);
VISION_API void ReduceDomain(MObject& Image, MObject& Region, MObject* ImageReduced);
VISION_API void DrawRectangle1(MTuple &WindowHandle, MTuple* Row1, MTuple* Column1, MTuple* Row2, MTuple* Column2);
VISION_API void GenRectangle1(MObject*HoRegion,const MTuple& Row1, const MTuple& Column1, const MTuple& Row2, const MTuple& Column2);
VISION_API void SmallestRectangle1(MObject& Regions, MTuple* Row1, MTuple* Column1, MTuple* Row2, MTuple* Column2);
VISION_API void SortRegion(MObject& Regions, MObject* SortedRegions, const MTuple& SortMode, const MTuple& Order, const MTuple& RowOrCol);
VISION_API void Connection(MObject& hoRegion, MObject *hoConnection);
VISION_API void SelectObj( MObject& Objects, MObject* ObjectSelected, const MTuple& MtIndex);
VISION_API void AreaCenter(MObject& Objects, MTuple* Area, MTuple* RowCenter, MTuple* ColumnCenter);
VISION_API void SelectShape(MObject &Regions, MObject *SelectedRegions,const MTuple& Features,const MTuple& Operation, const MTuple& Min, const MTuple& Max);
VISION_API void PaintRegion(MObject& Region, MObject& Image, MObject* ImageResult, const MTuple& Grayval, const MTuple& Type);
VISION_API void OverpaintRegion(MObject& Image, MObject& Region, const MTuple& Grayval, const MTuple& Type);
VISION_API void CalcBlob(MObject &Regions);
//Threshold//////////////////////////////////////////////////////////////////////////
VISION_API void DynThreshold(MObject& OrigImage, MObject& ThresholdImage, MObject *RegionDynThresh, const MTuple& Offset, const MTuple& LightDark);
VISION_API void Threshold(MObject& Image, MObject *hoRegion, const MTuple & MinGray, const MTuple & MaxGray);
//平移和旋转
VISION_API void VectorToRigid2(const MTuple& Px, const MTuple& Py, const MTuple& Px2, const MTuple& Py2, const MTuple& Qx, const MTuple& Qy, const MTuple& Qx2, const MTuple& Qy2, MTuple* HomMat2D);
VISION_API void VectorAngleToRigid(const MTuple & Row1, const MTuple & Column1, const MTuple & Angle1, const MTuple & Row2, const MTuple & Column2, const MTuple & Angle2, MTuple * HomMat2D);
VISION_API void AffineTransImage(MObject& Image, MObject *hoTrans, MTuple& HomMat2D, const MTuple& Interpolation, const MTuple& AdaptImageSize);
VISION_API void AffineTransRegion(MObject& hoRegion, MObject *hoTrans, const MTuple& HomMat2D, const MTuple& Interpolation);
VISION_API void MirrorImage(const MObject& Image, MObject* ImageMirror, const MTuple& Mode);
VISION_API void RotateImage(const MObject& Image, MObject* ImageRotate, const MTuple& Phi, const MTuple& Interpolation);
VISION_API void MeanImage(const MObject& Image, MObject* ImageMean, const MTuple& MaskWidth, const MTuple& MaskHeight);

//形态学Morphology

VISION_API void ErosionCircle(MObject& Region, MObject *RegionErosion, const MTuple&Radius);
VISION_API void DilationCircle(MObject& Region, MObject* RegionDilation, const MTuple& Radius);
VISION_API void Difference(MObject& Region, MObject&Sub, MObject*RegionSub);
VISION_API void ErosionRectangle1(MObject& Region, MObject* RegionErosion, const MTuple& Width, const MTuple& Height);
VISION_API void DilationRectangle1(MObject& Region, MObject* RegionDilation, const MTuple& Width, const MTuple& Height);
VISION_API void OpeningCircle(MObject& Region, MObject* RegionOpening, const MTuple& Radius);
VISION_API void OpeningRectangle1(MObject& Region, MObject* RegionOpening, const MTuple& Width, const MTuple& Height);
VISION_API void ClosingCircle(MObject& Region, MObject* RegionClosing, const MTuple& Radius);
VISION_API void ClosingRectangle1(MObject& Region, MObject* RegionClosing, const MTuple& Width, const MTuple& Height);
VISION_API void GrayDilationRect(MObject& Image, MObject* ImageMax, const MTuple& MaskHeight, const MTuple& MaskWidth);
VISION_API void GrayErosionRect(MObject& Image, MObject* ImageMin, const MTuple& MaskHeight, const MTuple& MaskWidth);

//NCC模板匹配
VISION_API void CreateNccModel(MObject& Template, const MTuple& NumLevels,const MTuple& AngleStart, const MTuple& AngleExtent, const MTuple& AngleStep,const MTuple& Metric, MTuple* ModelID);
VISION_API void FindNccModel(const MObject& Image, const MTuple& ModelID, const MTuple& AngleStart, const MTuple& AngleExtent, const MTuple& MinScore, const MTuple& NumMatches, const MTuple& MaxOverlap, const MTuple& SubPixel, const MTuple& NumLevels, MTuple* Row, MTuple* Column, MTuple* Angle, MTuple* Score);
VISION_API void ReadNccModel(const MTuple& FileName, MTuple* ModelID);
VISION_API void WriteNccModel(const MTuple& ModelID, const MTuple& FileName);
VISION_API void ClearNccModel(const MTuple& ModelID);

推荐阅读