Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SImage Class Reference

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

#include <SImage.h>

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...
 
Array ClearMask ()
 Clear the link between and image and its texture mask. More...
 
static Array ConvertColorToTexture (SPoly ioPoly, Number iPixelPerTriangle, Boolean iIsUpdateOnlyTriWithoutTexture)
 Converts colors/inspections of a mesh into texture. More...
 
static Array ConvertTextureMapsToAtlas (SPoly ioPoly)
 Converts all the texture maps of a mesh into one (or several) texture atlas. More...
 
Array CreateMaskAuto ()
 Create an automatic mask from the SImage. More...
 
Array EstimatePose (Array< SPoint > iCrdModel3D, Array< SPoint > iCrdUVImage, EstimatePoseConstraintEnum iContraints=CONSTRAINT_NONE)
 Estimate the pose of an image using reference points. More...
 
static Array EstimatePose (SImage iImageToEstimate, Array< SPoint > iCrdModel3D, Array< SPoint > iCrdUVImage, Array iOptions)
 Estimate the pose of an image using reference points. More...
 
static Array EstimatePose (SImage iImageToEstimate, String iPath, Array iOptions)
 Estimate the pose of an image using reference points from a file. More...
 
Array EstimatePose (String iPath)
 Estimate the pose of an image using reference points stored in a file. More...
 
Array EstimatePoseFromFile (String iPath, 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)
 Converts dynamic textures from a mesh 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 iName)
 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...
 
Boolean HasMask ()
 Return if the SImage has a mask or not. 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 SetMaskFromFile (String iMaskFilePath)
 Set the texture mask of the SImage from a file.
File extensions authorized: .bmp, .tif, .jpg, .png, .gif.
The texture mask image must have the same size as the current image. More...
 
Array SetOrthoParameters (SPoint iPosition, Number iRotation, Number iPixelSize)
 Set ortho image parameters. More...
 
static Array SphericalFromPerspectiveImages (Array< SImage > iImages, Number iClusteringDistance, SCloud iCloud)
 Convert perspective images to spherical images. More...
 
static Array TextureMesh (SPoly iPoly, Array< SImage > iImgTbl, Number iVisibilityOption, Number iImageOption, Number iExistingOption)
 Textures 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 ()
 Launches a click interaction to select a 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 ()
 The component containing folder's name. More...
 
String GetName ()
 The component's name. More...
 
String GetPath ()
 To get the full path of a comp in the tree. More...
 
 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)
Converts all the texture maps of a mesh 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

◆ ClearMask

Array SImage::ClearMask ( )
slot

Clear the link between and image and its texture mask.

Return values
Array.ErrorCodeThe error code
  • 0 Success
  • 1 An error occurred
  • 2 The image doesn't contain any mask.

◆ ConvertColorToTexture

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

Converts colors/inspections of a mesh into texture.

Note
The function will use the current representation to convert the color
See also
SPoly.SetPolyRepresentation(), STexturingUtil.ConvertColorToTexture()
Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Deprecated:
This function is deprecated, use STexturingUtil.ConvertColorToTexture() instead.
Parameters
[in,out]ioPolyMesh to convert
[in]iPixelPerTriangleNumber of pixels per triangle to create the texture value (between 4 and 32)
[in]iIsUpdateOnlyTriWithoutTextureIf true: updates only triangles that are not already textured

◆ ConvertTextureMapsToAtlas

static Array SImage::ConvertTextureMapsToAtlas ( SPoly  ioPoly)
staticslot

Converts all the texture maps of a mesh into one (or several) texture atlas.

See also
STexturingUtil.ConvertTextureMapsToAtlas()
Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Deprecated:
This function is deprecated, use STexturingUtil.ConvertTextureMapsToAtlas() instead.
Parameters
[in,out]ioPolyMesh to convert

◆ CreateMaskAuto

Array SImage::CreateMaskAuto ( )
slot

Create an automatic mask from the SImage.

Return values
Array.ErrorCodeThe error code
  • 0 Success
  • 1 An error occurred

◆ EstimatePose [1/4]

Array SImage::EstimatePose ( Array< SPoint iCrdModel3D,
Array< SPoint iCrdUVImage,
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
Deprecated:
This function is deprecated, use EstimatePose(image,crdModel3D, crdUvImage, options) instead.

◆ EstimatePose [2/4]

static Array SImage::EstimatePose ( SImage  iImageToEstimate,
Array< SPoint iCrdModel3D,
Array< SPoint iCrdUVImage,
Array  iOptions 
)
staticslot

Estimate the pose of an image using reference points.

Note
Example to fill the iOptions array: var options = { keepPosition : false, keepOrientation : false, keepInternal : false, projection : 0 }
Return values
Array.ValueThe sum of the residual re-projection errors.
Array.ErrorCodeThe error code of the computation:
  • 0: Success.
  • 1: Not enough control points (need at least 4).
  • 2: Missing texture.
  • 3: Invalid projection type.
  • 4: Invalid residual error (more than 1% deviation, results usable).
Array.ImageThe image with its new estimated pose.
Parameters
[in]iImageToEstimateThe image to estimate the pose of.
[in]iCrdModel3DThe 3D coordinates.
[in]iCrdUVImageThe Texture UV coordinates.
[in]iOptionsData structure containing computation options. This data structure have to contain the following fields:
  • keepPosition: [Boolean] Keep the position of the camera or not (default: false). Images of type Unknown cannot be at true.
  • keepOrientation: [Boolean] Keep the orientation of the camera or not (default: false). Images of type Unknown cannot be at true.
  • keepInternal: [Boolean] Keep the internal parameters of the camera or not (default: false). Images of type Spherical or Unknown cannot be at true.
  • projection: [Number] The desired projection type: either 0 for Perspective or 1 for Spherical (default: 0). Images of type Perspective and Spherical must have a matching projection type. Images of type Unknown can be both.

◆ EstimatePose [3/4]

static Array SImage::EstimatePose ( SImage  iImageToEstimate,
String  iPath,
Array  iOptions 
)
staticslot

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

Note
Example to fill the iOptions array: var options = { keepPosition : false, keepOrientation : false, keepInternal : false, projection : 0 }
Return values
Array.ValueThe sum of the residual re-projection errors.
Array.ErrorCodeThe error code of the computation:
  • 0: Success.
  • 1: Not enough control points (need at least 4).
  • 2: Missing texture.
  • 3: Invalid projection type.
  • 4: Invalid residual error (more than 1% deviation, results usable).
Array.ImageThe image with its new estimated pose.
Parameters
[in]iImageToEstimateThe image to estimate the pose of.
[in]iPathThe path of the file where reference points are stored.
[in]iOptionsData structure containing computation options. This data structure have to contain the following fields:
  • keepPosition: [Boolean] Keep the position of the camera or not (default: false). Images of type Unknown cannot be at true.
  • keepOrientation: [Boolean] Keep the orientation of the camera or not (default: false). Images of type Unknown cannot be at true.
  • keepInternal: [Boolean] Keep the internal parameters of the camera or not (default: false). Images of type Spherical or Unknown cannot be at true.
  • projection: [Number] The desired projection type: either 0 for Perspective or 1 for Spherical (default: 0). Images of type Perspective and Spherical must have a matching projection type. Images of type Unknown can be both.

◆ EstimatePose [4/4]

Array SImage::EstimatePose ( String  iPath)
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 EstimatePose(image, path, options) instead.

◆ EstimatePoseFromFile

Array SImage::EstimatePoseFromFile ( String  iPath,
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
Deprecated:
This function is deprecated, use EstimatePose(image, path, options) instead.

◆ 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]iPointAndLineSizeLine width, point size and font size scale by this factor. This factor applies to the resulting image pixels, and thus depends on iPixelSize.

◆ ExtractImageFromTexture

static Array SImage::ExtractImageFromTexture ( SPoly  iPoly)
inlinestaticslot

Converts dynamic textures from a mesh to scene images.

See also
STexturingUtil.ExtractImageFromTexture()
Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Array.ImageTblThe images extracted from the texture.
Deprecated:
This function is deprecated, use STexturingUtil.ExtractImageFromTexture() instead.
Parameters
[in]iPolyMesh 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  iName)
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.

◆ HasMask

Boolean SImage::HasMask ( )
slot

Return if the SImage has a mask or not.

◆ 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

◆ SetMaskFromFile

Array SImage::SetMaskFromFile ( String  iMaskFilePath)
slot

Set the texture mask of the SImage from a file.
File extensions authorized: .bmp, .tif, .jpg, .png, .gif.
The texture mask image must have the same size as the current image.

Note
The texture mask is expected to be only black and white.
Therefore, all non-white pixels will be considered as masking area.
Parameters
[in]iMaskFilePathThe path of the file that contains the mask to apply
Return values
Array.ErrorCodeThe error code
  • 0 Success
  • 1 An error occurred

◆ 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

◆ SphericalFromPerspectiveImages

static Array SImage::SphericalFromPerspectiveImages ( Array< SImage iImages,
Number  iClusteringDistance,
SCloud  iCloud 
)
staticslot

Convert perspective images to spherical images.

Return values
Array.ImageTblThe spherical images.
Array.IndicesTblThe indices of the inputs images used to create each spherical image.
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Partial conversion.
  • 2 Unknown Error.
Parameters
[in]iImagesImages to convert.
[in]iClusteringDistanceDistance used to group images according to their positions.
[in]iCloudOptional cloud to improve image quality by computing a depth information.

◆ TextureMesh

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

Textures a mesh with images.

See also
STexturingUtil.TextureMeshStandard()
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThe textured mesh.
Deprecated:
This function is deprecated, use STexturingUtil.TextureMeshStandard() instead.
Parameters
[in]iPolyMesh to texture
[in]iImgTblTable of images used for texturing
[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 than 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 mesh 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.