DirectX: Support conversion for more types, including float16 types#20260
Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom Jun 11, 2021
Merged
Conversation
Support the following type conversions: * CV_16FC4 --> DXGI_FORMAT_R16G16B16A16_FLOAT * CV_16FC2 --> DXGI_FORMAT_R16G16_FLOAT * CV_16FC1 --> DXGI_FORMAT_R16_FLOAT * CV_32FC2 --> DXGI_FORMAT_R32G32_FLOAT * CV_32FC1 --> DXGI_FORMAT_D32_FLOAT * CV_32SC2 --> DXGI_FORMAT_R32G32_UINT * CV_32SC2 --> DXGI_FORMAT_R32G32_SINT * CV_8UC4 --> DXGI_FORMAT_R8G8_B8G8_UNORM * CV_8UC4 --> DXGI_FORMAT_G8R8_G8B8_UNORM
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support the following conversions from OpenCV types to DXGI types (via functions such as
cv::directx::convertToD3D11Texture2D):CV_16FC4-->DXGI_FORMAT_R16G16B16A16_FLOATCV_16FC2-->DXGI_FORMAT_R16G16_FLOATCV_16FC1-->DXGI_FORMAT_R16_FLOATCV_32FC2-->DXGI_FORMAT_R32G32_FLOATCV_32FC1-->DXGI_FORMAT_D32_FLOATCV_32SC2-->DXGI_FORMAT_R32G32_UINTCV_32SC2-->DXGI_FORMAT_R32G32_SINTCV_8UC4-->DXGI_FORMAT_R8G8_B8G8_UNORM**CV_8UC4-->DXGI_FORMAT_G8R8_G8B8_UNORM**Of these, conversion to
DXGI_FORMAT_R16G16B16A16_FLOATis the most widely useful because this is a standard format for the back buffer when Windows is running in HDR mode.With the changes, I have successfully tested the
CV_16FC4-->DXGI_FORMAT_R16G16B16A16_FLOATconversion in a closed-source project that performs HDR rendering.**
DXGI_FORMAT_R8G8_B8G8_UNORMandDXGI_FORMAT_G8R8_G8B8_UNORMare packed formats. Using these formats in OpenCV (with aCV_8UC4representation) would be unusual but it is possible. For example, they would be compatible with basic arithmetic manipulations such ascv::addWeightedto blend two images.