-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert color image to gray scale #449
Comments
julia> using TestImages, Colors
julia> img = testimage("mandrill")
RGB Images.Image with:
data: 512x512 Array{ColorTypes.RGB{FixedPointNumbers.UFixed{UInt8,8}},2}
properties:
colorspace: sRGB
spatialorder: x y
julia> imgg = convert(Image{Gray}, img)
Gray Images.Image with:
data: 512x512 Array{ColorTypes.Gray{FixedPointNumbers.UFixed{UInt8,8}},2}
properties:
colorspace: sRGB
spatialorder: x y I see there's a stray property, but note julia> colorspace(imgg)
"Gray" gives the right answer. (Dispatch wins over dictionary properties.) Obviously I/someone should clean this up, though. |
That works fine. Thanks a lot for your help!!!!! |
Closed by #577 |
This is currently failing for me on MacOs HighSierra, I see the following error, after: imgg = convert(Image{Gray},img)
|
That was the old syntax. New syntax is documented at http://juliaimages.github.io/latest/. Just use |
What documentation are you following? It would be good to correct posted documents that are out of date. |
Hello guys,
I'm trying to convert a color image to a gray scale using these commands:
mean(temp.data, 1)
and the output error is:
ERROR: MethodError:
converthas no method matching convert(::Type{ColorTypes.RGB{Float32}}, ::Int64) This may have arisen from a call to the constructor ColorTypes.RGB{Float32}(...), since type constructors fall back to convert methods. Closest candidates are: ColorTypes.RGB{T<:Union{AbstractFloat,FixedPointNumbers.FixedPoint{T<:Integer,f}}}(::Any, ::Any, ::Any) call{T}(::Type{T}, ::Any) convert{C<:ColorTypes.Colorant{T,N}}(::Type{C<:ColorTypes.Colorant{T,N}}, ::ColorTypes.Colorant{T,N}) ... in fill! at multidimensional.jl:557 in mean at statistics.jl:31
And if I use this command:
convert(Image{Gray}, temp)
I get this output:
ERROR: UndefVarError: Gray not defined
do you have anay idea how can I solve the problem?
Thanks
The text was updated successfully, but these errors were encountered: