halcon/c++接口基礎 之 HALCON圖像變量類

在HALCON/C++中,HObject是一個基類,可以表示圖像變量。另外還有三種類繼承自HObject.

  • Class HImage 處理圖像
  • Class HRegion 處理區域
  • Class HXLD 處理多邊形

Regions

一個region是圖像平面坐標點的集合。這樣一個區域不需要被連通,而且可能還有好多洞。a region可以比實際的圖像大。區域在HALCON中可以用所謂的行程編碼實現。類HRegion代表HALCON/C++中的一個區域。HRegion的成員函數如下(列舉幾個重要的):

  • HRegion(void)
    默認構造器。創造一個空的region,即region的面積是0.并不是所有的算子都可以將空region作為輸入參數,例如一些shape property 操作。
  • HRegion(const HRegion &reg)
    拷貝構造函數
  • HRegion &operator = (const HRegion &reg)
    賦值運算符
  • void Display(const HWindow &w) const
    在一個窗口中輸出region

區域的幾何變換

  • HRegion operator * (double scale) const
    放縮區域到任何一個尺度。放縮中心為(0,0)
  • HRegion operator + (const HDPoint2D &point) const
    HRegion &operator += (const HDPoint2D &point)
    平移

區域的形態學處理:

  • HRegion operator >> (double radius) const
    HRegion &operator >>= (double radius)
    用一個圓腐蝕,同erosion_circle
  • HRegion operator << (double radius) const
    HRegion &operator <<= (double radius)
    用一個圓膨脹,同 dilation_circle.
  • HRegion &operator ++ (void)
    用一個含有五個點的十字交叉去膨脹。
  • HRegion &operator -- (void)
    用一個含有五個點的十字交叉去腐蝕。
  • HRegion operator + (const HRegion &reg) const
    HRegion &operator += (const HRegion &reg)
    與另一個區域的Minkowsky 加和, 同 minkowski_add1.
  • HRegion operator - (const HRegion &reg) const
    HRegion &operator -= (const HRegion &reg)
    與另一個區域的Minkowsky 減法, 同 minkowski_sub1.

區域的屬性:

  • double Phi(void) const
    一個等價的橢圓的角度,同 elliptic_axis.
  • double Ra(void) const
    一個區域的等價的橢圓的長半軸,同 elliptic_axis.
  • double Rb(void) const
    一個區域的等價的橢圓的短半軸,同elliptic_axis.
  • long Area(void) const
    區域的面積,即所包含的像素數,見 area_center.
  • double X(void) const
    double Y(void) const
    區域的中心點坐標,見area_center.
  • HRectangle1 SmallestRectangle1(void) const
    區域的最小包圍盒,此包圍盒平行于坐標軸,同 smallest_rectangle1.
  • HBool In(const HDPoint2D &p) const
    檢驗一個點是否在區域內部,同 test_region_point.
  • HBool IsEmpty(void) const;
    檢驗區域是否為空,也就是區域面積是否為0

例1

 #include "HalconCpp.h"
using namespace Halcon;
void main()
{ HImage     image("E:\\halcon\\images\\mreut.png");              // Reading an aerial imageHRegion    region = image >= 190;       // Calculating a thresholdHWindow    w;                           // Display windoww.SetColor("red");                      // Set color for regionsregion.Display(w);                      // Display the regionHRegion    filled = region.FillUp();    // Fill holes in regionfilled.Display(w);                      // Display the region// Opening: erosion followed by a dilation with a circle maskHRegion    open = (filled >> 4.5) << 4.5;w.SetColor("green");                    // Set color for regionsopen.Display(w);                        // Display the regionHDPoint2D  trans(-100, -150);            // Vector for translationHRegion    moved = open + trans;       // TranslationHRegion    zoomed = moved * 2.0;        // Zooming the region
}

First, an aerial image (mreut.png) is read from a file. All pixels with a gray value ≥ 190 are selected. This results in one region (region). This region is transformed by the next steps: All holes in the region are filled (FillUp), small parts of the region are eliminated by two morphological operations, first an erosion, a kind of shrinking the region, followed by a dilation, a kind of enlarging the region. The last step is the zooming of the region. For that the region is first shifted by a translation vector ( ? 100, ? 150) to the upper left corner and then zoomed by the factor two. Figure 6.2 shows the input image and the result of the opening operation.

Region Arrays

HRegionArray是一個包含Region的容器。代表成員函數如下:

  • long Num(void)
    數列的個數,最大序號是Num() ? 1.
  • HRegion const &operator [] (long index) const
    讀取數組的第i個元素,序號是 0 … Num() ? 1.
  • HRegion &operator [] (long index)
    將一個region賦值給區域的第j個元素,The index index can be ≥ Num().
  • HRegionArray operator () (long min, long max) const
    選取介于min與max之間的數據
  • HRegionArray &Append(const HRegion &reg)
    將一個region附加到region array的后面

許多接受region的算子都接受region array作為輸入參數。如形態學操作。

例2

#include "HalconCpp.h"
using namespace Halcon;
void main()
{ HImage        image("E:\\halcon\\images\\control_unit.png");       // Reading an image from file// Segmentation by regiongrowingHRegionArray  regs = image.Regiongrowing(1, 1, 4, 100);HWindow       w;                           // Display windoww.SetColored(12);                          // Set colors for regionsregs.Display(w);                           // Display the regionsHRegionArray  rect;                        // New arrayfor (long i = 0; i < regs.Num(); i++)      // For all regions in array{ // Test size and shape of each regionif ((regs[i].Area() > 1000) && (regs[i].Compactness() < 1.5))rect.Append(regs[i]);                  // If test true, append region}image.Display(w);                          // Display the imagerect.Display(w);                           // Display resulting regions}


原圖

變換后圖像
The first step is to read an image. In this case it shows a control unit in a manufacturing environment, see figure 6.4 on the left side. By applying a regiongrowing algorithm from the HALCON library the image is segmented into regions. Each region inside the resulting region array regs is now selected according to its size and its compactness. Each region of a size larger than 1000 pixels and of a compactness value smaller than 1.5 is appended to the region array rect. After the processing of the for loop only the regions showing on the right side of figure 6.4 are left.

Images

在Halcon中,矩陣叫做通道,一個圖像可能由若干個通道組成。比如灰度圖像由一個通道,而彩色圖像由3個通道組成。通道的類型不僅僅是8位(btype),而且可以有其他類型(比如16 int2)以及實數類型。除了保存像素信息,每一個HALCON圖像也存儲所謂的domain,就是上面介紹的那種Region格式。region可以理解為感興趣的區域,即ROI。一般除了些許異常外,halcon算子都運行在region上處理。這一點與sepera相同。

Image Objects

類HImage是所有繼承的圖像類的根類。通過使用HImage,所有不同的像素類型都可以被以統一的格式處理(多態性)。類HImage不是虛類,因此可以被實例化。如下列舉了幾個重要的成員函數:

  • HImage(void)
    默認構造函數,空的圖像。
  • HImage(const char* file)
    從一個文件中讀取圖像,同read_image
  • HImage(int width,int height,const char* type)
    構造一幅圖像,指定了大小和類型。同gen_image_const
  • HImage(void *ptr, int width, int height, const char *type)
    構造一幅圖像,使用拷貝的方式,指定圖像的大小和類型,同gen_image1.
  • irtual const char *PixType(void) const
    像素類型,同 get_image_type.
  • int Width(void) const
    圖像寬,見get_image_size.
  • int Height(void) const
    圖像高,見 get_image_size.
  • HPixVal GetPixVal(int x, int y) const
    獲取(x,y)處的像素值,見 get_grayval.
  • HPixVal GetPixVal(long k) const
    線性獲得第k個像素值
  • virtual void SetPixVal(int x, int y, const HPixVal &val)
    設置第(x,y)個像素值,同 set_grayval.
  • virtual void SetPixVal(long k, const HPixVal &val)
    設置第k個像素值
  • virtual void Display(const HWindow &w) const
    在一個窗口上顯示圖像

幾何運算
- HImage operator & (const HRegion &reg) const
裁剪圖像的一部分區域,然后返回此部分的圖像。同reduce_domain.
點評: 此函數設計的還是很好的,比較符合直覺。一幅圖像與區域做&運算,就是獲取共同的部分,也就是裁剪后的圖像。

  • HImage operator + (const HImage &add) const
    圖像相加,同 add_image.
  • HImage operator - (const HImage &sub) const
    圖像相減,同 sub_image.
  • HImage operator * (const HImage &mult) const
    圖像相乘,同 mult_image.
  • HImage operator - (void) const
    圖像取反, invert_image.
  • HImage operator + (double add) const
    HImage operator - (double sub) const
    HImage operator * (double mult) const
    HImage operator / (double div) const
    圖像加減乘除,同scale_image
  • HRegion operator >= (const HImage &image) const
    HRegion operator <= (const HImage &image) const
    Selecting all pixel with gray values brighter than or equal to (or darker than or equal to, respectively) those of the input image, see**dyn_threshold**
    點評:動態閾值,局部閾值處理,一般和均指圖像做比較。
  • HRegion operator >= (double thresh) const
    HRegion operator <= (double thresh) const
    HRegion operator == (double thresh) const
    HRegion operator != (double thresh) const
    閾值處理,同 threshold.

例3

#include "HalconCpp.h"
using namespace Halcon;
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
void main()
{HImage   image("E:\\halcon\\images\\mreut.png");        // Aerial imageHWindow  w;                                 // Output windowimage.Display(w);                           // Display image// Returning the size of the imagecout << "width  = " << image.Width();cout << "height = " << image.Height() << endl;// Interactive drawing of a region by using the mouse HRegion  mask = w.DrawRegion();// Reduce the domain of the image to the maskHImage   reduced = image & mask;w.ClearWindow();                            // Clear the windowreduced.Display(w);                         // Display the reduced image// Applying the mean filter in the reduced imageHImage   mean = reduced.MeanImage(61, 61);mean.Display(w);HRegion  reg = reduced <= (mean -3);reg.Display(w);
}


本例首先從文件中讀取一幅灰度圖像,目的是提取暗的部分。截取部分區域處理只是為了節省時間。可以通過鼠標任意畫出部分區域來選擇我們處理的部分圖像區域。這部分區域掩模用于作為輸入去截取圖像(運算符&).帶有61x61大小的均指掩模被應用于最后截取的圖像獲得均值圖像。暗的像素通過應用算子<= 選取。所有的像素不超過均值-3的都選取。 具體可以參考 dyn_threshold.

Pixel Values

HPixVal被用來訪問類HImage的像素值。灰度值可以獨立于他們的類型而返回和設置。
如下介紹常見的成員函數:

//構造
HPixVal(void)
Default constructor. 
HPixVal(const HComplex &Val)
Constructing a pixel value from a complex number. 
HPixVal(int Val)
Constructing a pixel value from an integer (int). 
HPixVal(long Val)
Constructing a pixel value from a long (long). 
HPixVal(HByte Val)
Constructing a pixel value from a byte (byte). 
HPixVal(double Val)
Constructing a pixel value from a double (double). 
HPixVal(const HPixVal &Val)
Copy constructor. 
HPixVal &operator = (const HPixVal &grey)
Assignment operator. 
operator HByte(void) const
Converting a pixel value to byte (0255). //強制轉換
operator int(void) const
Converting a pixel value to int. 
operator long(void) const
Converting a pixel value to long. 
operator double(void) const
Converting a pixel value to double. 
operator HComplex(void) const
Converting a pixel value to Complex. 

例4

#include "HalconCpp.h"
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
using namespace Halcon;void  main()
{HByteImage  in("E:\\halcon\\images\\mreut.png");         // Aerial imageHWindow w;                       // Output windowin.Display(w);                   // Displaying the imageHByteImage out = in;             // Copying the imageint  width = out.Width();       // Width of the imageint  height = out.Height();      // Height of the imagelong end = width * height;    // Number of pixel of the image// 1. run: linear accessingfor (long k = 0; k < end; k++) {int pix = in.GetPixVal(k);     // Reading the pixelout.SetPixVal(k, 255 - pix);      // Setting the pixel}// Displaying the transformationcout << "Transformed !" << endl;  out.Display(w);   w.Click();cout << "Original !" << endl;  in.Display(w);    w.Click();// 2. run: accessing the image via the coordinates (x,y)for (int y = 0; y < height; y++) {for (int x = 0; x < width; x++) {int pix = in.GetPixVal(x, y); // Reading the pixelout.SetPixVal(x, y, 255 - pix);  // Setting the pixel}}// Displaying the transformationcout << "Transformed !" << endl;  out.Display(w);   w.Click();cout << "Original !" << endl;  in.Display(w);    w.Click();
}

類HPixVal可以由上面的例子(圖像取反)說明。 輸入圖像是一個灰度圖像。首先一幅圖像被復制,并且獲得了圖像大小。第一次運行,像素線性獲得。第二次運行像素值通過(x,y)坐標獲得。

點評: 本例的實質是觀察int與HPixVal的隱式轉換。首先SetPixVal的第三個參數應該是HPixVal,但是輸入實際上是int,由于類HPixVal提供了HPixVal(int Val)的構造函數,使得隱式轉換可以成功。后面GetPixVal獲取像素,又由于類HPixVal提供了operator int(void) const的轉換函數,使得int pix = in.GetPixVal(k);是有效的。

Image Arrays

同之前定義region的數組,HImage也定義了其數組,即HImageArray.
成員函數如下:


HImageArray(void)
Default constructor: empty array, no element. HImageArray(const HImage &reg)
Constructing an image array from a single image. HImageArray(const HImageArray &arr)
Copy constructor. ~HImageArray(void)
Destructor. HImageArray &operator = (const HImageArray &arr)
Assignment operator. long Num(void) const
Returning the number of elements in the array. HImage const &operator [] (long index) const 
Reading the element i of the array. The index is in the range 0 … Num() ? 1.HImage &operator [] (long index)
Assigning an image to the element i of the array. The index index can beNum(). HImageArray operator () (long min, long max)
Selecting a subset between the lower min and upper max index. HImageArray &Append(const HImage &image)
Appending another image to the image array. HImageArray &Append(const HImageArray &images)
Appending another image array to the image array. 

Byte Image

對于每一個像素類型,存在著從HImage繼承的圖像類,如對于像素類型byte(standard 8 bit),對應著HByteImage;對于像素類型int2(signed 16 bit),對應著HInt2Image。但是使用最廣泛的是HByteImage,基本上覆蓋了圖像處理的大部分領域。HByteImage相對于HImage的優點是簡化了像素值的訪問機制。主要是因為HPixVal不再使用。除了HImage的成員函數外,HByteImage還包含了以下擴展:


像素的設置和獲得

  • HByte &operator[] (long k)
    線性設置第k個像素
  • HByte operator[] (long k) const
    線性讀取第k個像素
  • HByte &operator() (long k)
    線性設置第k個像素
  • HByte operator() (long k) const
    線性讀取第k個像素
  • HByte &operator()(int x, int y)
    通過坐標(x,y)設置像素
  • HByte operator()(int x, int y) const
    閱讀坐標(x,y)處的像素

位運算

  • HByteImage operator & (int i)
    與i與運算
  • HByteImage operator << (int i)
    每個像素做左移i位.
  • HByteImage operator >> (int i)
    每個像素右移i位
  • HByteImage operator ~ (void)
    對每個像素去補
  • HByteImage operator & (HByteImage &ima)
    兩圖像對應像素取 &
  • HByteImage operator | (HByteImage &ima)
    兩圖像對應像素取 |
  • HByteImage operator ^ (HByteImage &ima)
    兩圖像對應像素取 異或
    例5
#include "HalconCpp.h"
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
using namespace Halcon;void  main()
{HByteImage  in("E:\\halcon\\images\\mreut.png");         // Aerial imageHWindow w;                       // Output windowin.Display(w);                   // Displaying the imageHByteImage out = in;             // Copying the imageint  width = out.Width();       // Width of the imageint  height = out.Height();      // Height of the imagelong end = width * height;    // Number of pixel of the image// 1. run: linear accessingfor (long k = 0; k < end; k++) {out[k] = 255 - in[k];      // Setting the pixel}// Displaying the transformationcout << "Transformed !" << endl;  out.Display(w);   w.Click();cout << "Original !" << endl;  in.Display(w);    w.Click();// 2. run: accessing the image via the coordinates (x,y)for (int y = 0; y < height; y++) {for (int x = 0; x < width; x++) {out(x, y) = 255 - in(x, y);  // Setting the pixel}}// Displaying the transformationcout << "Transformed !" << endl;  out.Display(w);   w.Click();cout << "Original !" << endl;  in.Display(w);    w.Click();
}

本例是例4的改造版,看起來更簡潔,更像C語言的風格。訪問像素不再需要get/set格式。

XLD Objects

XLD是eXtented Line Description的簡稱。這種數據結構可以描述areas(即任意大小的區域或者多邊形)or 任何封閉的或者打開的輪廓。與regions代表像素精度相反,XLD代表的是亞像素精度。其中有兩種基本的XLD結構: 輪廓(contours)和 多邊形(polygons).

與圖像相似,HALCON/C++也提供了基類HXLD和一些繼承自HXLD的特殊類,比如HXLDCont用于輪廓,HXLDPoly用于多邊形。另外也存在一個容器類,即HXLDArray.

Low—Level Iconic Objects

當以面向過程的方式調用算子時,Hobject可以被用來代表所有的圖像參數,如 an image,a region,an image array.事實上,Hobject是HALCON訪問內部數據的基類。并且,Hobejct也可作為HObject和HObject繼承類,如HImage的基類。

Hobject有如下的成員函數:

Hobject(void)
Default constructor. Hobject(const Hobject &obj)
Copy constructor.virtual ~Hobject(void)
Destructor. Hobject &operator = (const Hobject &obj)
Assignment operator. void Reset(void)
Freeing the memory and resetting the corresponding database key. 

正如前面所講,Hobject的對象也可以包含一個圖像數據的數組。但是不幸的是,Hobject沒有特殊的函數區增加和選擇數組成員,取而代之的是,你必須使用“The Tuple Mode”.一節所描述的算子gen_empty_obj, concat_obj, select_obj, and count_obj 代替。


打賞

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/258882.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/258882.shtml
英文地址,請注明出處:http://en.pswp.cn/news/258882.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

新手求大神,有其他swit-case的思路寫這個程序么?

兩個程序: switch-case與if-else if的區別相同點:可以實現多分支結構;不同點:switch:一般只能用于等值比較.(可以進行范圍運算???---學會用switch計算范圍出爐的思路____待解決)if_else if:可以處理范圍計算. switch(變量) { case 變量: break; } switch括號中的"變量…

netty簡單筆記

2019獨角獸企業重金招聘Python工程師標準>>> Server package com.netty;import io.netty.bootstrap.ServerBootstrap; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelFuture; import io.netty.channel.Channel…

c語言與python通信_python和c++通信示例

先貼一個大牛寫的python與C的通信的經典文章&#xff1a;如何實現 C/C 與 Python 的通信&#xff1f; 里面講到了不少方法來實現C和python之間的通信&#xff0c;我看了之后深有感觸&#xff0c;但里面的例程序大多都是int或者string這樣容易轉換的&#xff0c;但如果是list呢&…

halcon/c++接口基礎 之 控制參數

HALCON/C可以處理各種不同類型的字母數字混合的控制參數&#xff0c;如下&#xff1a; 離散數字&#xff08;long&#xff09;浮點數字&#xff08;double&#xff09;字符串&#xff08;char*&#xff09; 控制參數的一個特殊形式是句柄&#xff0c;提供了途徑去訪問復雜的數…

C#使用多態求方形面積周長和圓的面積周長

class class1{public static void Main(string[] args){//使用多態求矩形面積與周長和圓的面積與周長Shape cl new Circle(5);double clarea cl.GetArea();double clpar cl.GetPerimeter();Console.WriteLine("這個圓的面積是{0},周長是{1}", Math.Round(clarea, …

Java編程的邏輯 (84) - 反射

?本系列文章經補充和完善&#xff0c;已修訂整理成書《Java編程的邏輯》&#xff0c;由機械工業出版社華章分社出版&#xff0c;于2018年1月上市熱銷&#xff0c;讀者好評如潮&#xff01;各大網店和書店有售&#xff0c;歡迎購買&#xff0c;京東自營鏈接&#xff1a;http://…

C# 與 VC Dll 傳輸信息

考慮&#xff1a; 使用string類型傳送&#xff1b; 在VC Dll中解析字符&#xff1b; 使用 string 類型將解析的類型傳送到C#程序中&#xff1b; 建立VC解析的函數&#xff0c;提高代碼可重用性轉載于:https://www.cnblogs.com/ein-key5205/p/3597612.html

linux下python_linux下python安裝

Python2.5的安裝方法&#xff1a; 1&#xff0e;下載源代碼 http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tar.bz2 2&#xff0e; 安裝 $ tar –jxvf Python-2.5.2.tar.bz2 $ cd Python-2.5.2 $ ./configure $ make $ make install 3. 測試 在命令行下輸入python&…

灰度圖像的8位平面分解

所謂灰度圖像&#xff0c;即指8位256顏色的圖像。將圖像的每一位分別取出來&#xff0c;我們就可以將一幅圖像分解開來&#xff0c;形成8幅圖像。下面我們分別介紹使用matlab分解圖像與使用halcon/c分解圖像的方法。 matlab8位分解 clc; clear all; A imread(lena.tif); % 顯…

Win10 UAP 綁定

Compiled DataBinding in Windows Universal Applications (UAP) http://nicksnettravels.builttoroam.com/post/2015/04/26/Compiled-DataBinding-in-Windows-Universal-Applications-(UAP).aspx 讀寫剪貼板 http://www.cnphp6.com/archives/80079 Learn how the Reversi samp…

HDUOJ----4501小明系列故事——買年貨(三維背包)

小明系列故事——買年貨 Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2146 Accepted Submission(s): 953 Problem Description春節將至&#xff0c;小明要去超市購置年貨&#xff0c;于是小明去了自己經常去…

css 橫線_atom.css正式發布,從此跟CSS框架說拜拜。

atom.css 大家好&#xff0c;我寫了一個css庫atom.css&#xff0c;蠻好用的&#xff0c;所以忍不住分享給大家。(https://github.com/MatrixAge/atom.css)起因寫HTML幾年了&#xff0c;再到如今的JSX&#xff0c;最大的感受不是枯燥&#xff0c;而是眼花。寫樣式的時候&#xf…

halcon模板匹配學習(一) Matching 初印象

什么是模板匹配呢&#xff1f;簡單而言&#xff0c;就是在圖像中尋找目標圖像&#xff08;模板&#xff09;&#xff0c;或者說&#xff0c;就是在圖像中尋找與模板圖像相似部分的一種圖像處理技術。依賴于選擇的方法不同&#xff0c;模板匹配可以處理各種情形下的變換&#xf…

第五章 面向方面編程___AOP入門

上一篇講了 AOP 和 OOP 的區別&#xff0c;這一次我們開始入門 AOP 。實現面向方面編程的技術&#xff0c;主要分為兩大類&#xff1a; 一是 采用動態代理技術&#xff0c;利用截取消息的方式&#xff0c;對該消息進行裝飾&#xff0c;以取代原有對象行為的執行&#xff1b; 二…

java將xml中的標簽名稱轉為小寫_深入學習Java Web(七): JSTL標簽庫

本文轉自與博客園一杯涼茶的博客.在之前我們學過在JSP頁面上為了不使用腳本&#xff0c;所以我們有了JSP內置的行為、行為只能提供一小部分的功能&#xff0c;大多數的時候還是會用java腳本&#xff0c;接著就使用了EL表達式&#xff0c;基本上EL表達式看似能滿足我們的要求&am…

python中*args和**args的不同

上一段代碼&#xff0c;大家感受一下 def test_param(*args): print(args) def test_param2(**args): print(args) test_param(test1,test2) >>>(test1,test2) test_param2(p1test1,p2test2) >>>{p1:test1, p2:test2} python提供了兩種特別的方法來定義函數的…

halcon模板匹配學習(二) 準備模板

如下&#xff0c;我們將介紹匹配的第一個操作&#xff1a;準備模板 初始時刻&#xff0c;我們準備好參考圖像&#xff0c;并對其做一定的處理&#xff0c;然后我們需要從參考圖像中導出模板&#xff0c;也就是將參考圖像裁剪成所謂的模板圖像。獲取模板圖像可以通過設置ROI來完…

揭秘繼承技術之虛函數

虛函數 調用虛函數時函數行為將根據對象所屬類的不同而變化。 父類指針或引用指向子類對象時&#xff0c;可訪問子類重寫方法&#xff08; virtual函數&#xff09;但無法訪問在父類中沒有定義的子類方法和數據成員。 #include <iostream>using namespace std;class Supe…

java中GET方式提交和POST方式提交

java中GET方式提交的示例&#xff1a; /*** 獲取關注列表;* return*/SuppressWarnings("unchecked")public static ArrayList<String> getUserList() {StringBuffer bufferRes new StringBuffer();ArrayList<String> users null;try {URL realUrl new…

基于HALCON的模板匹配方法總結

很早就想總結一下前段時間學習HALCON的心得&#xff0c;但由于其他的事情總是抽不出時間。去年有過一段時間的集中學習&#xff0c;做了許多的練習和實驗&#xff0c;并對基于HDevelop的形狀匹配算法的參數優化進行了研究&#xff0c;寫了一篇《基于HDevelop的形狀匹配算法參數…