.. SPDX-FileCopyrightText: 2021 Intel Corporation .. .. SPDX-License-Identifier: CC-BY-4.0 .. _usm-image-accessor: USM Image Accessor ================== .. rubric:: Description :class: sectiontitle USM Image accessor provides access to a USM image. .. rubric:: Include Files :class: sectiontitle ``oneapi/ipl.hpp`` .. rubric:: Domain Dependencies :class: sectiontitle Headers: ``oneapi/ipl.hpp`` Libraries: ``oneipl.lib`` .. rubric:: Syntax :class: sectiontitle .. doxygenclass:: oneapi::ipl::usm_image_accessor :project: oneIPL :members: Supported values for AccessMode: .. list-table:: :header-rows: 0 * - ``sycl::access_mode::write`` * - ``sycl::access_mode::read`` Supported values for AccessDataT: .. list-table:: :header-rows: 0 * - ``std::int8_t`` * - ``std::uint8_t`` * - ``std::int16_t`` * - ``std::uint16_t`` * - ``std::int32_t`` * - ``std::uint32_t`` * - ``float`` The code example below demonstrates how to use the ``oneapi::ipl::usm_image_accessor``: .. code-block:: cpp using image_t = image; const roi_rect roi_rect{ image_size / 6, image_size / 3 }; // Create queue sycl::queue queue{}; // Create allocator shared_usm_allocator_t allocator{ queue }; // RGB image (usm_image) image_t usm_image{ queue, image_data_pointer, image_size, allocator }; // USM image accessor const image_t::accessor_t usm_image_accessor(usm_image); // Reading first pixel const sycl::int2 coords2d{ 0, 0 }; const auto pixel = usm_image_accessor.read(coords2d); std::cout << "Pixel: " << pixel[0] << " " << pixel[1] << " " << pixel[2] << std::endl;