halcon算子翻譯——gen_image3


名稱

gen_image3 - 從三個指向像素的指針(紅/綠/藍)創建一個圖像。

用法

gen_image3( : ImageRGB : Type, Width, Height, PixelPointerRed, PixelPointerGreen, PixelPointerBlue : )

描述

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

並行

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

參數

ImageRGB (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


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


PixelPointerRed (input_control)    pointer → (integer)
  指向第一個紅色值的指針(通道1)。


PixelPointerGreen (input_control)    pointer → (integer)
  指向第一個綠色值的指針(通道2)。


PixelPointerBlue (input_control)    pointer → (integer)
  指向第一個藍色值的指針(通道3)。

Example (C)

void NewRGBImage(Hobject *new)
{
  unsigned char  red[768*525];
  unsigned char  green[768*525];
  unsigned char  blue[768*525];
  int            r,c;
  for (r=0; r<525; r++)
    for (c=0; c<768; c++)
    {
      red[r*768+c]   = c % 255;
      green[r*768+c] = (767 - c) % 255;
      blue[r*768+c]  = r % 255;
    }
    gen_image3(new,"byte",768,525,(Hlong)red,(long)green,(long)blue);
}

main()
{
  Hobject  rgb;
  open_window(0,0,768,525,0,"","",&WindowHandle);
  NewRGBImage(&rgb);
  disp_color(rgb,WindowHandle);
  clear_obj(rgb);
}

 

結果

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

Possible Predecessors

gen_image_const, get_image_pointer1

Possible Successors

disp_color

Alternatives

gen_image1, compose3, gen_image_const

See also

reduce_domain, paint_gray, paint_region, set_grayval, get_image_pointer1, decompose3

模塊

Foundation


免責聲明!

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



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