image_to_array {keras3} | R Documentation |
Converts a PIL Image instance to a matrix.
Description
Converts a PIL Image instance to a matrix.
Usage
image_to_array(img, data_format = NULL, dtype = NULL)
Arguments
img |
Input PIL Image instance. |
data_format |
Image data format, can be either |
dtype |
Dtype to use. |
Value
A 3D array.
Example
image_path <- get_file(origin = "https://www.r-project.org/logo/Rlogo.png") (img <- image_load(image_path))
## <PIL.Image.Image image mode=RGB size=724x561>
array <- image_to_array(img) str(array)
## num [1:561, 1:724, 1:3] 0 0 0 0 0 0 0 0 0 0 ...
See Also
Other image utils:
image_array_save()
image_from_array()
image_load()
image_smart_resize()
op_image_affine_transform()
op_image_crop()
op_image_extract_patches()
op_image_hsv_to_rgb()
op_image_map_coordinates()
op_image_pad()
op_image_resize()
op_image_rgb_to_grayscale()
op_image_rgb_to_hsv()
Other utils:
audio_dataset_from_directory()
clear_session()
config_disable_interactive_logging()
config_disable_traceback_filtering()
config_enable_interactive_logging()
config_enable_traceback_filtering()
config_is_interactive_logging_enabled()
config_is_traceback_filtering_enabled()
get_file()
get_source_inputs()
image_array_save()
image_dataset_from_directory()
image_from_array()
image_load()
image_smart_resize()
layer_feature_space()
normalize()
pad_sequences()
set_random_seed()
split_dataset()
text_dataset_from_directory()
timeseries_dataset_from_array()
to_categorical()
zip_lists()