Methods
# inner RGBtoGray(image) → {Image}
Converts an RGBA image to grayscale.
Parameters:
Name | Type | Description |
---|---|---|
image |
Image
|
Image |
cv.cvtColor(image, image, cv.COLOR_RGB@GRAY)
Image
# inner getImageDimensions(image) → {string}
Retrieves the dimensions of an image.
Parameters:
Name | Type | Description |
---|---|---|
image |
Image
|
Image |
getImageDimensions(image)
string
# inner imageResize(image, shape) → {Image}
Resizes an image to the specified shape.
Parameters:
Name | Type | Description |
---|---|---|
image |
Image
|
Image |
shape |
Array
|
The shape to resize the image to |
cv.resize(image, image, new cv.Size(...shape))
Image
# inner imageTensor(image, shape) → {Tensor}
Converts an image into a TensorFlow tensor with the specified shape.
Parameters:
Name | Type | Description |
---|---|---|
image |
Image
|
Image |
shape |
Array
|
The shape of tensor required |
tf.tensor(image.data, shape)
Tensor
# inner imageTo32Bit(image) → {Image}
Converts an image to a 32-bit floating-point format.
Parameters:
Name | Type | Description |
---|---|---|
image |
Image
|
Image |
- image.convertTo(image, cv.CV_32F)
Image
# inner loadImage() → {Image}
Asynchronously loads an image from an input element with the ID 'upload_image'.
Converts the loaded image to an OpenCV Mat object.
await loadImage()
Image
# inner normalizeImage(image, min, max) → {Image}
Normalizes the pixel values of an image to a specified range.
Parameters:
Name | Type | Description |
---|---|---|
image |
Image
|
Image |
min |
Number
|
The minimum cutoff value |
max |
Number
|
The maximum cutoof value |
cv.normalize(image, image, min, max, cv.NORM_MINMAX)
Image