Skip to content

Commit

Permalink
compat fix for Julia < v1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnychen94 committed Apr 11, 2022
1 parent 08f3aed commit 68e46bc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/matlab.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ im_to_matlab(::Type{T}, img::AbstractMatrix{<:RGB}) where T =
im_to_matlab(::Type{T}, img::AbstractArray{<:RGB}) where T =
throw(ArgumentError("For $(ndims(img)) dimensional color image, manual conversion to MATLAB layout is required."))

# this method allows `data === im_to_matlab(im_from_matlab(data))` for gray image
im_to_matlab(::Type{T}, img::Base.ReinterpretArray{CT,N,T,<:AbstractArray{T,N}, true}) where {CT,N,T} =
img.parent
if VERSION >= v"1.6.0-DEV.1083"
# this method allows `data === im_to_matlab(im_from_matlab(data))` for gray image
im_to_matlab(::Type{T}, img::Base.ReinterpretArray{CT,N,T,<:AbstractArray{T,N}, true}) where {CT,N,T} =
img.parent
else
im_to_matlab(::Type{T}, img::Base.ReinterpretArray{CT,N,T,<:AbstractArray{T,N}}) where {CT,N,T} =
img.parent
end

0 comments on commit 68e46bc

Please sign in to comment.