gen_image1gen_image1GenImage1GenImage1 (Operator)

Name

gen_image1gen_image1GenImage1GenImage1 — Erzeugen eines Bildes aus einem Zeiger auf die Pixel.

Signatur

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

Herror gen_image1(Hobject* Image, const char* Type, const Hlong Width, const Hlong Height, const Hlong PixelPointer)

Herror T_gen_image1(Hobject* Image, const Htuple Type, const Htuple Width, const Htuple Height, const Htuple PixelPointer)

void GenImage1(HObject* Image, const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PixelPointer)

void HImage::HImage(const HString& Type, Hlong Width, Hlong Height, void* PixelPointer)

void HImage::HImage(const char* Type, Hlong Width, Hlong Height, void* PixelPointer)

void HImage::HImage(const wchar_t* Type, Hlong Width, Hlong Height, void* PixelPointer)   (Nur Windows)

void HImage::GenImage1(const HString& Type, Hlong Width, Hlong Height, void* PixelPointer)

void HImage::GenImage1(const char* Type, Hlong Width, Hlong Height, void* PixelPointer)

void HImage::GenImage1(const wchar_t* Type, Hlong Width, Hlong Height, void* PixelPointer)   (Nur Windows)

static void HOperatorSet.GenImage1(out HObject image, HTuple type, HTuple width, HTuple height, HTuple pixelPointer)

public HImage(string type, int width, int height, IntPtr pixelPointer)

void HImage.GenImage1(string type, int width, int height, IntPtr pixelPointer)

Beschreibung

gen_image1gen_image1GenImage1GenImage1GenImage1 erzeugt ein Bild in der Größe WidthWidthWidthWidthwidth * HeightHeightHeightHeightheight. Die Pixel in PixelPointerPixelPointerPixelPointerPixelPointerpixelPointer sind zeilensequentiell abgelegt. Der Typ der übergebenen Pixel (PixelPointerPixelPointerPixelPointerPixelPointerpixelPointer) muss mit TypeTypeTypeTypetype übereinstimmen (siehe gen_image_constgen_image_constGenImageConstGenImageConstGenImageConst für eine detailliertere Beschreibung der Pixeltypen). Der Speicher für das neue Bild wird von HALCON neu angelegt. Der Speicherplatz auf den PixelPointerPixelPointerPixelPointerPixelPointerpixelPointer kann also nach dem Aufruf freigegeben werden. Wie ein Zeigerwert übergeben wird hängt von der benutzten Operatorsignatur und der Programmierumgebung ab. Es ist sicherzustellen, dass die tatsächliche Speicheradresse unter der die Bilddaten gespeichert sind übergeben wird und nicht die Adresse der Zeigervariablen. Es ist darauf zu achten, dass 64-Bit-Zeiger auf 64-Bit-Architekturen nicht beschnitten werden.

Achtung

gen_image1gen_image1GenImage1GenImage1GenImage1 überprüft nicht, ob PixelPointerPixelPointerPixelPointerPixelPointerpixelPointer einen gültigen Wert hat oder nicht. Es muss also darauf geachtet werden, dass der Wert gültig ist, da es sonst zum Programmabsturz kommen kann!

Ausführungsinformationen

Parameter

ImageImageImageImageimage (output_object)  image objectHImageHImageHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)

Erzeugtes Bild mit neuer Bildmatrix.

TypeTypeTypeTypetype (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Pixeltyp.

Defaultwert: 'byte' "byte" "byte" "byte" "byte"

Werteliste: 'byte'"byte""byte""byte""byte", 'cyclic'"cyclic""cyclic""cyclic""cyclic", 'direction'"direction""direction""direction""direction", 'int1'"int1""int1""int1""int1", 'int2'"int2""int2""int2""int2", 'int4'"int4""int4""int4""int4", 'real'"real""real""real""real", 'uint2'"uint2""uint2""uint2""uint2"

WidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Breite des Bildes.

Defaultwert: 512

Wertevorschläge: 128, 256, 512, 1024

Typischer Wertebereich: 1 ≤ Width Width Width Width width ≤ 512 (lin)

Minimale Schrittweite: 1

Empfohlene Schrittweite: 10

Restriktion: Width >= 1

HeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Höhe des Bildes.

Defaultwert: 512

Wertevorschläge: 128, 256, 512, 1024

Typischer Wertebereich: 1 ≤ Height Height Height Height height ≤ 512 (lin)

Minimale Schrittweite: 1

Empfohlene Schrittweite: 10

Restriktion: Height >= 1

PixelPointerPixelPointerPixelPointerPixelPointerpixelPointer (input_control)  pointer HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Zeiger auf den ersten Grauwert.

Beispiel (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);
}

Ergebnis

Sind die Parameterwerte korrekt, dann liefert gen_image1gen_image1GenImage1GenImage1GenImage1 den Wert 2 (H_MSG_TRUE). Andernfalls wird eine Fehlerbehandlung durchgeführt.

Vorgänger

gen_image_constgen_image_constGenImageConstGenImageConstGenImageConst, get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1

Alternativen

gen_image3gen_image3GenImage3GenImage3GenImage3, gen_image1_externgen_image1_externGenImage1ExternGenImage1ExternGenImage1Extern, gen_image_constgen_image_constGenImageConstGenImageConstGenImageConst, get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1

Siehe auch

reduce_domainreduce_domainReduceDomainReduceDomainReduceDomain, paint_graypaint_grayPaintGrayPaintGrayPaintGray, paint_regionpaint_regionPaintRegionPaintRegionPaintRegion, set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayval

Modul

Foundation