halcon算子翻譯——gen_image1


名稱

gen_image1 - 從指向像素的指針創建一個圖像。

用法

gen_image1( : Image : Type, Width, Height, PixelPointer : )

描述

  算子gen_image1創建一個Width*Height大小的圖像。 PixelPointer中的像素按線順序存儲。 給定像素的類型(PixelPointer)必須對應於Type(請參閱gen_image_const以獲取更詳細的像素類型描述)。 新圖像的存儲是由HALCON新創建的。 因此,在PixelPointer上的存儲可以在調用之后被釋放。 請注意,如何傳遞一個指針值取決於所使用的算子和編程環境。 確保傳遞存儲圖像數據的實際內存地址,而不是指針變量的地址。 必須注意不要在64位體系結構上截斷64位指針。

並行

●  多線程類型:可重入(與非獨占算子並行運行)。
●  多線程范圍:全局(可以從任何線程調用)。
●  不並行化處理。

參數

Image (output_object)   image → object (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)
  新創建的圖像矩陣。


Type (input_control)    string → (string)
  像素類型。
  Default value: 'byte'
  List of values: 'byte', 'cyclic', 'direction', 'int1', 'int2', 'int4', 'real', 'uint2'


Width (input_control)    extent.x → (integer)
  圖像寬度。
  Default value: 512
  Suggested values: 128, 256, 512, 1024
  Typical range of values: 1 ≤ Width ≤ 512 (lin)
  Minimum increment: 1
  Recommended increment: 10
  Restriction: Width >= 1


Height (input_control)    extent.y → (integer)
  圖像高度。
  Default value: 512
  Suggested values: 128, 256, 512, 1024
  Typical range of values: 1 ≤ Height ≤ 512 (lin)
  Minimum increment: 1
  Recommended increment: 10
  Restriction: Height >= 1


PixelPointer (input_control)    pointer → (integer)
  指向第一個灰度值的指針。

Example (C)

void NewImage(Hobject *new)
{
  unsigned char  image[768*525];
  int            r,c;
  for (r=0; r<525; r++)
    for (c=0; c<768; c++)
      image[r*768+c] = c % 255;
  gen_image1(new,"byte",768,525,(Hlong)image);
}

 

結果

如果參數值正確,則算子gen_image1返回值2(H_MSG_TRUE)。 否則會引發異常。

Possible Predecessors

gen_image_const, get_image_pointer1

Alternatives

gen_image3, gen_image1_extern, gen_image_const, get_image_pointer1

See also

reduce_domain, paint_gray, paint_region, set_grayval

模塊

Foundation


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM