Skip to content
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

Gray fixed point number image arithmetic broken #178

Closed
romainFr opened this issue Sep 7, 2014 · 5 comments
Closed

Gray fixed point number image arithmetic broken #178

romainFr opened this issue Sep 7, 2014 · 5 comments

Comments

@romainFr
Copy link
Contributor

romainFr commented Sep 7, 2014

Maybe I'm missing something with the fixed point numbers change, but here is the symptom :

julia> using Images

julia> using TestImages

julia> test = testimage("mandril_gray")
Gray Image with:
  data: 512x512 Array{Gray{UfixedBase{Uint8,8}},2}
  properties:
    IMcs: Gray
    spatialorder:  x y
    pixelspacing:  1 1

julia> 2*test
ERROR: `.*` has no method matching .*(::Gray{UfixedBase{Uint8,8}}, ::Int64)
 in .* at array.jl:758
 in * at /home/romain/.julia/v0.3/Images/src/algorithms.jl:35
@timholy timholy closed this as completed in f556bdd Sep 8, 2014
@timholy
Copy link
Member

timholy commented Sep 8, 2014

Sorry about that. Pkg.update() should fix it.

@elsuizo
Copy link

elsuizo commented Sep 8, 2014

And the element-wise comparation is related with this?
I mean:

julia> img = TestImages.testimage("mandril_gray")
Gray Image with:
  data: 512x512 Array{Gray{UfixedBase{Uint8,8}},2}
  properties:
    IMcs: Gray
    spatialorder:  x y
    pixelspacing:  1 1

julia> mask =  img .< 37
ERROR: `isless` has no method matching isless(::Gray{UfixedBase{Uint8,8}}, ::Int64)
 in bitcache_lt at broadcast.jl:376
 in .< at broadcast.jl:392
 in .< at /home/elsuizo/.julia/v0.3/Images/src/algorithms.jl:118

@timholy
Copy link
Member

timholy commented Sep 8, 2014

I'll add that too.

But you should read https://github.com/timholy/Images.jl#loading-your-first-image-how-images-are-represented and perhaps https://github.com/JeffBezanson/FixedPointNumbers.jl, and change that comparison to img .< 37/255. Still won't work until I add more methods, but at least it will be correct once I do.

@timholy timholy reopened this Sep 8, 2014
@elsuizo
Copy link

elsuizo commented Sep 8, 2014

I read and i like so much the new framework, great job ¡¡
yes works if:

mask =  img .< Images.Gray(37/255)

@timholy
Copy link
Member

timholy commented Sep 8, 2014

Ah, that was unexpected. Great. I'll leave this open and check related methods, though. Will probably be a couple of days, I need to prepare a talk...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants