Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2021.
SImage Class Reference

This class is only available if you have the Survey plugin.
. More...

Inheritance diagram for SImage:
SComp SObject

Public Types

enum  SImageType { ABSTRACT , PERSPECTIVE , SPHERICAL , ORTHO }
 Image Type. More...
 
- Public Types inherited from SComp
enum  RepresentationTypeEnum {
  SMOOTH , FLAT , WIRE , SMOOTH_WIRE ,
  FLAT_WIRE , SMOOTH_ROTWIRE , FLAT_ROTWIRE , TEXTURE ,
  INSPECTION
}
 The different representation types for inherited classes.
Use (inherited class).SMOOTH. Example: for a cloud, use SCloud.SMOOTH. More...
 

Public Slots

static Array ConvertColorToTexture (SPoly ioPoly, Number iPixelPerTriangle, Boolean isUpdateOnlyTriWithoutTexture)
 Convert colors/inspections of a SPoly into texture. More...
 
static Array ConvertColorToTexture (SPoly ioPoly, Number iPixelPerTriangle, Boolean isUpdateOnlyTriWithoutTexture)
 Convert colors/inspections of a SPoly into texture. More...
 
static Array ConvertTextureMapsToAtlas (SPoly ioPoly)
 Convert all the texture maps of a SPoly into one (or several) texture atlas. More...
 
Array EstimatePose (Array< SPoint > CrdModel3D, Array< SPoint > CrdUVImage)
 Estimate the pose of an image using reference points. More...
 
Array EstimatePose (String path)
 Estimate the pose of an image using reference points. More...
 
static Array ExportOrthoImage (String iOutputFilePath, SVector iScreenNormal, SVector iHorizontalNormal, SPoint iUpperLeftCorner, Number iBackgroundColor, Number iWidthInDocumentUnit, Number iHeightInDocumentUnit, Number iPixelScale, Number PointAndLineSize)
 Exports an ortho image and creates a georeferencing file. More...
 
static Array ExtractImageFromTexture (SPoly iPoly)
 Convert dynamic textures from a poly to scene images. More...
 
static Array FromFile (String iFileName, SImageType iImageType={})
 Function to import an image, and create a new SImage from file. The function automatically detects image type (ortho, perspective...) and loads calibration or georeferencing information. The image type can also be forced by using the SImageType in input. If ABSTRACT type is set, the automatically image type detected won't be changed. File extensions authorized: .bmp, .tif, .jpg, .png, .gif. More...
 
static Array FromName (String Name)
 Search all the component with the given name. More...
 
static Array FromPix4DProject (String iFileName)
 Function to import images from a Pix4D project. More...
 
static Array FromSel ()
 Function to get selected images. More...
 
Array GetCameraExternalParameters ()
 Get external camera parameters of perspective and spherical images. More...
 
Array GetCameraInternalParameters ()
 Get internal camera parameters of a perspective image. More...
 
Array GetImageType ()
 Get image type. More...
 
Array GetOrthoParameters ()
 Get ortho image parameters. More...
 
Array GoToCameraViewpoint ()
 Go to the camera viewpoint. More...
 
static SImage New (SImage iOther, SImageType iImageType={})
 Constructs a SImage by copying the SImage Other and setting the SImageType in input. If ABSTRACT type is set, the image type of the SImage Other is used. More...
 
Array SetCameraExternalParameters (SCameraExternal iExternalParams)
 Set external camera parameters for perspective and spherical images. More...
 
Array SetCameraInternalParameters (SCameraInternal iInternalParams)
 Set internal camera parameters for a perspective image. More...
 
Array SetOrthoParameters (SPoint iPosition, Number iRotation, Number iPixelSize)
 Set ortho image parameters. More...
 
static Array TextureMesh (SPoly ioPoly, Array< SImage > iImgTbl, Number iVisibilityOption, Number iImageOption, Number iExistingOption)
 Texture a mesh with images. More...
 
String toString ()
 Get the type of the variable. More...
 
String toString ()
 Get the type of the variable. More...
 
- Public Slots inherited from SComp
 AddToDoc ()
 To add the object to the document. More...
 
static Array All (Number VisCrit)
 To get all the SComp in the document. More...
 
 ApplyTransformation (SMatrix Matrix)
 To apply a geometric transformation to the current object by making a product with the given matrix. More...
 
 Clear ()
 To deallocate object memory. More...
 
static Array FromClick ()
 Displays a dialog box to select an SComp in the scene. More...
 
static Array FromName (String Name)
 Search all the component with the given name. More...
 
static Array FromSel ()
 To get all the selected SComp. More...
 
Array GetBoundingBox ()
 Calculates the bounding box of the component. More...
 
Array GetColors ()
 To get the colors of the component. More...
 
String GetFolderName ()
 
String GetName ()
 
 Invert ()
 Normal of the component is inverted. More...
 
Boolean IsInDoc ()
 Return if the component is in the document or not. More...
 
Boolean IsVisible ()
 
 MoveToGroup (String GroupPath, Boolean MoveInsideTopParent)
 Move the object to the document group represent by the given path. If some groups, in the path, don't exist, they will be created. More...
 
 RemoveFromDoc ()
 To remove the object from the document. More...
 
 SetClippable (Boolean clipping)
 Set clippable or not. More...
 
 SetColors (Number Red, Number Green, Number Blue)
 Sets the colors of the component. More...
 
 SetName (String ComponentName)
 To set the component's name. More...
 
 SetRepresentationType (RepresentationTypeEnum Representation)
 The shading type of the component is modified. More...
 
 SetTransparency (Number Alpha)
 Sets the transparency of the component. More...
 
 SetVisibility (Boolean Visible)
 Sets the component to be visible, or not visible. More...
 
String toString ()
 Get the type of the variable. More...
 
String toString ()
 Get the type of the variable. More...
 
 Translate (SVector Vector)
 To make a translation of the current object with an SVector. More...
 
- Public Slots inherited from SObject
 Clear ()
 To deallocate memory of the object. More...
 
String toString ()
 Get the type of the variable. More...
 

Detailed Description

This class is only available if you have the Survey plugin.
.

Warning
How to use function from namespace SImage ?
Use name of the namespace before to call function.
var result = SImage.ConvertTextureMapsToAtlas( myPoly );
This class is only available if you have the Survey plugin. .
Definition: SImage.h:29
static Array ConvertTextureMapsToAtlas(SPoly ioPoly)
Convert all the texture maps of a SPoly into one (or several) texture atlas.

Member Enumeration Documentation

◆ SImageType

Image Type.

Enumerator
ABSTRACT 
PERSPECTIVE 
SPHERICAL 
ORTHO 

Member Function Documentation

◆ ConvertColorToTexture [1/2]

static Array SImage::ConvertColorToTexture ( SPoly  ioPoly,
Number  iPixelPerTriangle,
Boolean  isUpdateOnlyTriWithoutTexture 
)
staticslot

Convert colors/inspections of a SPoly into texture.

Note
the function will used the current representation to convert the color
See also
SetPolyRepresentation()
Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Parameters
[in,out]ioPolypoly to convert
[in]iPixelPerTrianglenumber of pixel per triangle to create the texture value (between 4 and 32)
[in]isUpdateOnlyTriWithoutTextureIf true: updates only triangles that are not already textured

◆ ConvertColorToTexture [2/2]

static Array SImage::ConvertColorToTexture ( SPoly  ioPoly,
Number  iPixelPerTriangle,
Boolean  isUpdateOnlyTriWithoutTexture 
)
staticslot

Convert colors/inspections of a SPoly into texture.

Note
the function will used the current representation to convert the color
See also
SetPolyRepresentation()
Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Parameters
[in,out]ioPolypoly to convert
[in]iPixelPerTrianglenumber of pixel per triangle to create the texture value (between 4 and 32)
[in]isUpdateOnlyTriWithoutTextureIf true: updates only triangles that are not already textured

◆ ConvertTextureMapsToAtlas

static Array SImage::ConvertTextureMapsToAtlas ( SPoly  ioPoly)
staticslot

Convert all the texture maps of a SPoly into one (or several) texture atlas.

Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Parameters
[in,out]ioPolypoly to convert

◆ EstimatePose [1/2]

Array SImage::EstimatePose ( Array< SPoint CrdModel3D,
Array< SPoint CrdUVImage 
)
slot

Estimate the pose of an image using reference points.

Return values
Array.ValueThe sum of the residual re-projection error
Array.ImageThe image with its new estimated pose
Parameters
[in]CrdModel3Dthe 3D coordinates
[in]CrdUVImagethe Texture UV coordinates

◆ EstimatePose [2/2]

Array SImage::EstimatePose ( String  path)
slot

Estimate the pose of an image using reference points.

Return values
Array.ValueThe sum of the residual re-projection error
Array.ImageThe image with its new estimated pose
Parameters
[in]paththe path to the file containing the reference points

◆ ExportOrthoImage

static Array SImage::ExportOrthoImage ( String  iOutputFilePath,
SVector  iScreenNormal,
SVector  iHorizontalNormal,
SPoint  iUpperLeftCorner,
Number  iBackgroundColor,
Number  iWidthInDocumentUnit,
Number  iHeightInDocumentUnit,
Number  iPixelScale,
Number  PointAndLineSize 
)
staticslot

Exports an ortho image and creates a georeferencing file.

Return values
Array.ErrorCodeThe error code:
  • 0 ok
  • -1: unknown file extension
  • -2: error during processing
  • -9: invalid given point (null pointer)
Parameters
[in]iOutputFilePathfile (with path) to save
[in]iScreenNormalthe screen direction (perpendicular to the created picture)
[in]iHorizontalNormalthe horizontal direction
[in]iUpperLeftCornerthe upper left corner of the image
[in]iBackgroundColorthe background color -> iBackgroundColor = ColBlue * 2^16 + ColGreen * 2^8 + ColRed
[in]iWidthInDocumentUnitthe width of the image in document unit
[in]iHeightInDocumentUnitthe height of the image in the document unit
[in]iPixelScalesize of one pixel (one pixel correspond to 20 unit => size/20)
[in]PointAndLineSizethe point and line factor size

◆ ExtractImageFromTexture

static Array SImage::ExtractImageFromTexture ( SPoly  iPoly)
staticslot

Convert dynamic textures from a poly to scene images.

Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Array.ImageTblThe images extracted from the texture.
Parameters
[in]iPolypoly to extract texture from

◆ FromFile

static Array SImage::FromFile ( String  iFileName,
SImageType  iImageType = {} 
)
staticslot

Function to import an image, and create a new SImage from file. The function automatically detects image type (ortho, perspective...) and loads calibration or georeferencing information. The image type can also be forced by using the SImageType in input. If ABSTRACT type is set, the automatically image type detected won't be changed. File extensions authorized: .bmp, .tif, .jpg, .png, .gif.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.ImageThe image.
Note
If a world file having the same name than the image is present in the same folder, georeferencing information will be associated to the image.
If image is a geotif, the georeferencing will be read.
If a .xml or a.incam file having the same name than the image is present in the same folder, calibration information will be associated to the image.
If only one .xml or a.incam file is present in the same folder, calibration information will be associated to the image.
If a .excam file having the same name than the image is present in the same folder, external parameters will be associated to the image.
Parameters
[in]iFileNamepath and name of the image file to import
[in]iImageTypethe image type, ABSTRACT by default

◆ FromName

static Array SImage::FromName ( String  Name)
inlinestaticslot

Search all the component with the given name.

Return values
Arrayall the SImage with the given name

◆ FromPix4DProject

static Array SImage::FromPix4DProject ( String  iFileName)
staticslot

Function to import images from a Pix4D project.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 some errors are found while reading the information.
  • 2 the file can't be open
Array.ImageTblThe images.
Parameters
[in]iFileNamepath and name of the .p4d file to read

◆ FromSel

static Array SImage::FromSel ( )
staticslot

Function to get selected images.

Return values
Arrayof selected SImage

◆ GetCameraExternalParameters

Array SImage::GetCameraExternalParameters ( )
slot

Get external camera parameters of perspective and spherical images.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 Wrong image type.
Array.CameraExternalThe camera external parameters SCameraExternal

◆ GetCameraInternalParameters

Array SImage::GetCameraInternalParameters ( )
slot

Get internal camera parameters of a perspective image.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 Wrong image type.
Array.CameraInternalThe camera internal parameters SCameraInternal

◆ GetImageType

Array SImage::GetImageType ( )
slot

Get image type.

Return values
Array.ImageTypeThe image type

◆ GetOrthoParameters

Array SImage::GetOrthoParameters ( )
slot

Get ortho image parameters.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 Wrong image type.
Array.PointThe top left corner of the ortho image
Array.RotZThe rotation of the ortho image in degrees
Array.LengthThe pixel size in document unit

◆ GoToCameraViewpoint

Array SImage::GoToCameraViewpoint ( )
slot

Go to the camera viewpoint.

◆ New

static SImage SImage::New ( SImage  iOther,
SImageType  iImageType = {} 
)
staticslot

Constructs a SImage by copying the SImage Other and setting the SImageType in input. If ABSTRACT type is set, the image type of the SImage Other is used.

Parameters
[in]iOtherthe image to copy
[in]iImageTypethe image type, ABSTRACT by default

◆ SetCameraExternalParameters

Array SImage::SetCameraExternalParameters ( SCameraExternal  iExternalParams)
slot

Set external camera parameters for perspective and spherical images.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 Wrong image type.
Parameters
[in]iExternalParamscamera external parameters

◆ SetCameraInternalParameters

Array SImage::SetCameraInternalParameters ( SCameraInternal  iInternalParams)
slot

Set internal camera parameters for a perspective image.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 Wrong image type.
Parameters
[in]iInternalParamscamera internal parameters

◆ SetOrthoParameters

Array SImage::SetOrthoParameters ( SPoint  iPosition,
Number  iRotation,
Number  iPixelSize 
)
slot

Set ortho image parameters.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 Wrong image type.
Parameters
[in]iPositioninsertion point (top left corner)
[in]iRotationrotation value in degrees
[in]iPixelSizepixel size of the ortho image in document unit

◆ TextureMesh

static Array SImage::TextureMesh ( SPoly  ioPoly,
Array< SImage iImgTbl,
Number  iVisibilityOption,
Number  iImageOption,
Number  iExistingOption 
)
staticslot

Texture a mesh with images.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThe textured mesh.
Parameters
[in]ioPolypoly to texture
[in]iImgTblimages
[in]iVisibilityOptiontriangles that will be textured
  • 0 : include invisible parts
  • 1 : texture triangles with at least one visible vertex
  • 2 : texture only fully visible triangles
[in]iImageOptionused if iImgTbl contains more that 1 image
  • 0 : Choose the image in which the projected triangle is the biggest
  • 1 : The same image is used to texture a large group of neighboring triangles
[in]iExistingOptionused if the poly is already textured
  • 0 : overwrite existing texture
  • 1 : keep existing texture

◆ toString [1/2]

String SImage::toString ( )
slot

Get the type of the variable.

◆ toString [2/2]

String SImage::toString ( )
slot

Get the type of the variable.