Home > Net >  C # and halcon perfect union
C # and halcon perfect union

Time:09-16

How to import halcon program in c # and realize image processing functions I import into the display image is only half

CodePudding user response:

Halcon can directly export c # code and then integrated into it

CodePudding user response:

C # how to import halco program

CodePudding user response:

What you said is the program to deal with images, or images results display problem?
If is to display problem, because you hwindowcontrol window size and your picture is not the same as the actual size,
So I need
 HOperatorSet. GetImageSize (_img, out wid out hei); 
HOperatorSet. SetPart (_hWindowHandle, 0, 0, hei, wid);
HOperatorSet. DispObj (_img _hWindowHandle);

CodePudding user response:

//load the picture
HObject HImage;
HOperatorSet. ReadImage (out HImage, filename);
//get wide high
HTuple imgwidth imgheight;
HOperatorSet. GetImageSize (HImage out imgwidth, out imgheight);

CodePudding user response:

HObject Image; //define a HObject object, this is the image object halcon

Image. GenEmptyObj (); //generates an empty object, similar to instantiate objects, HObject object does not generate an empty object in advance you use words may be wrong

HOperatorSet. ReadImage (out Image, "Image path"); //image read from the specified image path into HObject objects

HTuple Width, Height; //define two variables used to capture images of wide high

HOperatorSet. GetImageSize (Image, out Width, out Height); //get the image from the image data wide high

HOperatorSet. SetPart (hwc_Horizontal. HalconWindow, 0, 0, Height 1, Width 1); //set the display area size of halcon image display control (" hwc_Horizontal "is the control name to" HalconWindow "attribute is the control handle to you directly as I just write here)

HOperatorSet. DispObj (Image, hwc_Horizontal HalconWindow); //show the picture to the controls,

This is my a piece of code I change of existing projects,
Halcon display controls don't know how to add a look at this https://blog.csdn.net/u010655348/article/details/80659945
  •  Tags:  
  • C#
  • Related