imgdata package¶
Submodules¶
imgdata.coordinates module¶
- filename
sppas.src.imgdata.coordinates.py
- author
Florian Hocquet, Brigitte Bigi
- contact
- summary
Data structure to represent an area with a confidence score.
- class imgdata.coordinates.sppasCoords(x=0, y=0, w=0, h=0, confidence=None)[source]¶
Bases:
object
Class to illustrate coordinates of an area.
A sppasCoords object represents the coordinates of an area in an image. It has 5 parameters:
x: coordinate on the x axis
y: coordinate on the y axis
w: width of the visage
h: height of the visage
an optional confidence score
- Example
>>> c = sppasCoords(143, 17, 150, 98, 0.7) >>> c.get_confidence() >>> 0.7 >>> c.get_x() >>> 143 >>> c.get_y() >>> 17 >>> c.get_w() >>> 150 >>> c.get_h() >>> 98
- MAX_H = 8640¶
- MAX_W = 15360¶
- __init__(x=0, y=0, w=0, h=0, confidence=None)[source]¶
Create a new sppasCoords instance.
Allows to represent a point (x,y), or a size(w,h) or both, with an optional confidence score ranging [0.0,1.0].
- Parameters
x – (int) The x-axis value
y – (int) The y-axis value
w – (int) The width value
h – (int) The height value
confidence – (float) An optional confidence score ranging [0,1]
- property h¶
Return height value (int).
- intermediate(other)[source]¶
Return the coordinates with the intermediate position and size.
- Parameters
other – (sppasCoords)
- Returns
(sppasCoords)
- intersection_area(other)[source]¶
Return the intersection area of two rectangles.
- Parameters
other – (sppasCoords)
- overlap(other)[source]¶
Return the 2 percentage of overlaps.
the overlapped area is overlapping other of XX percent of its area.
the overlapped area is overlapping self of XX percent of my area.
- Parameters
other – (sppasCoords)
- Returns
percentage of overlap of self in other and of other in self.
- scale(coeff, image=None)[source]¶
Multiply width and height values with given coefficient value.
- Parameters
coeff – (int) The value to multiply with.
image – (numpy.ndarray or sppasImage) An image to check w, h.
- Returns
Returns the value of the shift to use on the x-axis,
according to the value of the scale in order to keep the same center. :raise: TypeError, ScaleWidthError, ScaleHeightError
- set_confidence(value)[source]¶
Set confidence value.
- Parameters
value – (float) The new confidence value ranging [0, 1].
- Raise
TypeError, ValueError
- shift(x_value=0, y_value=0, image=None)[source]¶
Shift position of (x,y) values.
- Parameters
x_value – (int) The value to add to x-axis value.
y_value – (int) The value to add to y-axis value.
image – (numpy.ndarray or sppasImage) An image to check coords.
- Raise
TypeError
- static to_dtype(value, dtype=<class 'int'>, unsigned=True)[source]¶
Convert a value to int or raise the appropriate exception.
- property w¶
Return width value (int).
- property x¶
Return x-axis value (int).
- property y¶
Return y-axis value (int).
imgdata.image module¶
imgdata.imageutils module¶
imgdata.imgcoordswriter module¶
imgdata.imgdataexc module¶
- filename
sppas.src.imgdata.imgdataexc.py
- author
Brigitte Bigi
- contact
- summary
Image data exceptions.
- exception imgdata.imgdataexc.ImageBoundError(value, img_value)[source]¶
Bases:
ValueError
:ERROR 2330:.
The value {} can’t be superior to the one of the image {}.
- exception imgdata.imgdataexc.ImageEastingError(value, img_value)[source]¶
Bases:
ValueError
:ERROR 2336:.
The x-axis value {} can’t be superior to the width {} of the image.
- exception imgdata.imgdataexc.ImageHeightError(value, img_value)[source]¶
Bases:
ValueError
:ERROR 2334:.
The height value {} can’t be superior to the height {} of the image.
- exception imgdata.imgdataexc.ImageNorthingError(value, img_value)[source]¶
Bases:
ValueError
:ERROR 2338:.
The y-axis value {} can’t be superior to the height {} of the image.
- exception imgdata.imgdataexc.ImageReadError(name)[source]¶
Bases:
OSError
:ERROR 2610:.
Image of file {filename} can’t be read by opencv library.
imgdata.imgsequence module¶
imgdata.imgsimilarity module¶
imgdata.objdetec module¶
Module contents¶
- filename
sppas.src.imgdata.__init__.py
- author
Brigitte Bigi
- contact
- summary
Package for the management of image files
imgdata: management of image files¶
Requires the following other packages:
config
Requires the following other external libraries:
opencv
numpy
If the video feature is not enabled, the sppasEnableFeatureError() is raised when a class is instantiated.
- class imgdata.NeuralNetTensorFlowDetector(*args, **kwargs)[source]¶
Bases:
imgdata.sppasImageDataError
- class imgdata.sppasCoords(x=0, y=0, w=0, h=0, confidence=None)[source]¶
Bases:
object
Class to illustrate coordinates of an area.
A sppasCoords object represents the coordinates of an area in an image. It has 5 parameters:
x: coordinate on the x axis
y: coordinate on the y axis
w: width of the visage
h: height of the visage
an optional confidence score
- Example
>>> c = sppasCoords(143, 17, 150, 98, 0.7) >>> c.get_confidence() >>> 0.7 >>> c.get_x() >>> 143 >>> c.get_y() >>> 17 >>> c.get_w() >>> 150 >>> c.get_h() >>> 98
- MAX_H = 8640¶
- MAX_W = 15360¶
- __init__(x=0, y=0, w=0, h=0, confidence=None)[source]¶
Create a new sppasCoords instance.
Allows to represent a point (x,y), or a size(w,h) or both, with an optional confidence score ranging [0.0,1.0].
- Parameters
x – (int) The x-axis value
y – (int) The y-axis value
w – (int) The width value
h – (int) The height value
confidence – (float) An optional confidence score ranging [0,1]
- property h¶
Return height value (int).
- intermediate(other)[source]¶
Return the coordinates with the intermediate position and size.
- Parameters
other – (sppasCoords)
- Returns
(sppasCoords)
- intersection_area(other)[source]¶
Return the intersection area of two rectangles.
- Parameters
other – (sppasCoords)
- overlap(other)[source]¶
Return the 2 percentage of overlaps.
the overlapped area is overlapping other of XX percent of its area.
the overlapped area is overlapping self of XX percent of my area.
- Parameters
other – (sppasCoords)
- Returns
percentage of overlap of self in other and of other in self.
- scale(coeff, image=None)[source]¶
Multiply width and height values with given coefficient value.
- Parameters
coeff – (int) The value to multiply with.
image – (numpy.ndarray or sppasImage) An image to check w, h.
- Returns
Returns the value of the shift to use on the x-axis,
according to the value of the scale in order to keep the same center. :raise: TypeError, ScaleWidthError, ScaleHeightError
- set_confidence(value)[source]¶
Set confidence value.
- Parameters
value – (float) The new confidence value ranging [0, 1].
- Raise
TypeError, ValueError
- shift(x_value=0, y_value=0, image=None)[source]¶
Shift position of (x,y) values.
- Parameters
x_value – (int) The value to add to x-axis value.
y_value – (int) The value to add to y-axis value.
image – (numpy.ndarray or sppasImage) An image to check coords.
- Raise
TypeError
- static to_dtype(value, dtype=<class 'int'>, unsigned=True)[source]¶
Convert a value to int or raise the appropriate exception.
- property w¶
Return width value (int).
- property x¶
Return x-axis value (int).
- property y¶
Return y-axis value (int).