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  EstimatePoseConstraintEnum { CONSTRAINT_NONE , CONSTRAINT_POSITION , CONSTRAINT_ORIENTATION , CONSTRAINT_INTERNAL }
 Bitmask to know which parameters are fixed and should not be estimated. More...
 
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 All (Number iVisCrit=2)
 Get all the SImage in the document. More...
 
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, EstimatePoseConstraintEnum iContraints=CONSTRAINT_NONE)
 Estimate the pose of an image using reference points. More...
 
Array EstimatePose (String path)
 Estimate the pose of an image using reference points stored in a file. More...
 
Array EstimatePoseFromFile (String path, EstimatePoseConstraintEnum iContraints=CONSTRAINT_NONE)
 Estimate the pose of an image using reference points stored in a file. More...
 
static Array ExportOrthoImage (String iOutputFilePath, SVector iViewDirection, SVector iHorizontalNormal, SPoint iUpperLeftCorner, Number iBackgroundColor, Number iWidthInDocumentUnit, Number iHeightInDocumentUnit, Number iPixelSize, Number iPointAndLineSize)
 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 iMatrix)
 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

◆ EstimatePoseConstraintEnum

Bitmask to know which parameters are fixed and should not be estimated.

Enumerator
CONSTRAINT_NONE 
CONSTRAINT_POSITION 
CONSTRAINT_ORIENTATION 
CONSTRAINT_INTERNAL 

◆ SImageType

Image Type.

Enumerator
ABSTRACT 
PERSPECTIVE 
SPHERICAL 
ORTHO 

Member Function Documentation

◆ All

static Array SImage::All ( Number  iVisCrit = 2)
inlinestaticslot

Get all the SImage in the document.

Parameters
[in]iVisCritVisibility selection criteria:
  • 0 Only not visible images
  • 1 Only visible images
  • 2 (default) All images
Return values
Arraycontaining all the SImage contained in the document that fulfill the visibility criteria

◆ 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,
EstimatePoseConstraintEnum  iContraints = CONSTRAINT_NONE 
)
slot

Estimate the pose of an image using reference points.

Parameters
[in]CrdModel3DThe 3D coordinates
[in]CrdUVImageThe Texture UV coordinates
[in]iConstraintsThe constraints (parameters that must not change) for the estimation:
Return values
Array.ValueThe sum of the residual re-projection error
Array.ImageThe image with its new estimated pose

◆ EstimatePose [2/2]

Array SImage::EstimatePose ( String  path)
slot

Estimate the pose of an image using reference points stored in a file.

Parameters
[in]pathThe path of the file where reference points are stored
Return values
Array.ValueThe sum of the residual re-projection error
Array.ImageThe image with its new estimated pose
Deprecated:
This function is deprecated, use EstimatePoseFromFile instead.

◆ EstimatePoseFromFile

Array SImage::EstimatePoseFromFile ( String  path,
EstimatePoseConstraintEnum  iContraints = CONSTRAINT_NONE 
)
slot

Estimate the pose of an image using reference points stored in a file.

Parameters
[in]pathThe path of the file where reference points are stored
[in]iConstraintsThe constraints (parameters that must not change) for the estimation:
Return values
Array.ValueThe sum of the residual re-projection error
Array.ImageThe image with its new estimated pose

◆ ExportOrthoImage

static Array SImage::ExportOrthoImage ( String  iOutputFilePath,
SVector  iViewDirection,
SVector  iHorizontalNormal,
SPoint  iUpperLeftCorner,
Number  iBackgroundColor,
Number  iWidthInDocumentUnit,
Number  iHeightInDocumentUnit,
Number  iPixelSize,
Number  iPointAndLineSize 
)
staticslot

Exports an ortho image and creates a georeferencing file.

Note
Coordinates must be provided with respect to the global coordinates system.
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]iViewDirectionThe view 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 the document unit.
[in]iHeightInDocumentUnitThe height of the image, in the document unit.
[in]iPixelSizeSize of a single pixel, in the document unit.
[in]iPointAndLineSizeThe point and line factor size. This factor applies to the resulting image pixels, and thus depends on iPixelSize.

◆ 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.