Load, save and manipulate 2D images.
More...
|
typedef int | reme_image_t |
| Handle referencing a 2D image object.
|
|
reme_error_t | reme_image_create (reme_context_t c, reme_image_t *i) |
| Create a new empty image object.
|
|
reme_error_t | reme_image_destroy (reme_context_t c, reme_image_t *i) |
| Destroy a previously created image object.
|
|
reme_error_t | reme_image_get_info (reme_context_t c, reme_image_t i, int *width=0, int *height=0, int *num_channels=0, int *num_bytes_per_channel=0, int *row_stride=0) |
| Get image information such as size, channels and layout.
|
|
reme_error_t | reme_image_save_to_file (reme_context_t c, reme_image_t i, const char *filename) |
| Save the image in the desired format.
|
|
reme_error_t | reme_image_load_from_file (reme_context_t c, reme_image_t i, const char *filename) |
| Load image from disk.
|
|
reme_error_t | reme_image_get_bytes (reme_context_t c, reme_image_t i, const void **pixels, int *length) |
| Get image pixel data as byte array.
|
|
Load, save and manipulate 2D images.
This modules provides methods to load, save and manipulate 2d images.
The example below illustrates the functionality.
int width, height, nchans;
int counter = 0;
{
if (counter % 30 == 0) {
char buffer[50];
sprintf (buffer, "image_%i.png", counter);
printf("Saved image (%ix%i - %i channels) to %s \n", width, height, nchans, buffer);
}
counter += 1;
}
In case you want to acces the pixel data itself, you need to get a pointer to the internal data.
const void *data;
int width, height, length;
Next you use reme_image_get_bytes to access the data. In the following snipped OpenCV is used to perform something meaningful with the data.
cv::Mat rgb(height, width, CV_8UC3, (char*)data);
cv::Mat bgr;
cv::cvtColor(rgb, bgr, CV_RGB2BGR);
cv::imshow("RGB", bgr);
cv::waitKey(10);
Handle referencing a 2D image object.
A reme_image_t represents a 2D image object.
Create a new empty image object.
- Parameters
-
c | A valid context object |
i | A pointer that will receive the handle of the created image |
- Return values
-
- Examples:
- example_reconstructmesdk_calibration.cpp, example_reconstructmesdk_colorize.cpp, example_reconstructmesdk_image.cpp, example_reconstructmesdk_one_minute.cpp, example_reconstructmesdk_point_and_shoot_with_colors.cpp, example_reconstructmesdk_recorder.cpp, example_reconstructmesdk_scan_tilt.cpp, example_reconstructmesdk_sensor.cpp, example_reconstructmesdk_sensor_multi_independent.cpp, example_reconstructmesdk_sensor_printing.cpp, example_reconstructmesdk_sensor_threaded.cpp, example_reconstructmesdk_surface.cpp, and example_reconstructmesdk_volume.cpp.
Destroy a previously created image object.
- Parameters
-
c | A pointer to a valid context object |
i | A mutable pointer to a valid image handle to destroy |
- Return values
-
Get image information such as size, channels and layout.
You can pass a zero pointer for those fields you are not interested in.
- Parameters
-
c | A valid context object |
i | A valid image object |
width | Width of image in pixels |
height | Height of image in pixels |
num_channels | Number of channels per pixel |
num_bytes_per_channel | Number of bytes per channel |
row_stride | Distance between successive rows in bytes |
- Return values
-
- Examples:
- example_reconstructmesdk_image.cpp.
Save the image in the desired format.
The exporter is chosen based on the file extension. Currently supported are
- .PNG - Portable Network Graphics
- .BMP - Windows Bitmap
- .JPG - Jpeg
- Parameters
-
c | A valid context object |
i | A valid image object |
filename | path to save image to |
- Return values
-
- Examples:
- example_reconstructmesdk_image.cpp.
Load image from disk.
The importer is chosen based on the file extension. Currently supported are
- .PNG - Portable Network Graphics
- .BMP - Windows Bitmap
- .JPG - Jpeg
- Parameters
-
c | A valid context object |
i | A valid image object |
filename | path to save image to |
- Return values
-
Get image pixel data as byte array.
- Parameters
-
c | A valid context object |
i | A valid image object |
pixels | A mutable pointer that will receive the address of pixel array |
length | A pointer that will receive the length of the array in bytes (use reme_image_get_info to derive the correct format) |
- Return values
-
- Examples:
- example_reconstructmesdk_image.cpp.