Giter Club home page Giter Club logo

Comments (3)

timholy avatar timholy commented on July 19, 2024 2

👍 , thanks indeed @johnnychen94.

But we should use a keyword argument for ratio. Otherwise it has ambiguous intent for one-dimensional "images." (JuliaImages has a much firmer commitment to providing good support for images of arbitrary dimensionality than does Matlab.) Or we could use Percent but I think a keyword argument would be better.

from imagetransformations.jl.

johnnychen94 avatar johnnychen94 commented on July 19, 2024

Update:

The document of imresize doesn't say sz must be Tuple{Vararg{Integer}} type, so I just try the MATLAB way of using imresize, and it throws an unexpected StackOverflowError.

  • use [128,128] as size, it's Array type.
  • use ceil.(size(img) .* 0.5) as size, it is Tuple{Float64,Float64} Type
using Images, TestImages
lena = testimage("lena_gray_256")

imresize(lena, (128, 128)) # work as expected
imresize(lena, [128, 128]) # throw StackOverflowError
imresize(lena, (128.0, 128.0)) # throw StackOverflowError

With a temporary solution, just use

using Images, TestImages
lena = testimage("lena_gray_256")

imresize(lena, (128, 128)) # work as expected
imresize(lena, ceil.(Int, size(lena) .* 0.5)) # work as expected

Also,
can we add an imresize(img, ratio) API support to this function just like MATLAB? Since Images are always at least 2D, there will be no ambiguity. I think it might be fairly easy to implement.

imresize(original::AbstractArray, dim1, dimN...) = imresize(original, (dim1,dimN...)) 
imresize(original::AbstractArray, ratio) = imresize(original, round.(Int, size(original).* ratio) # add this line of code

from imagetransformations.jl.

Evizero avatar Evizero commented on July 19, 2024

Thanks for the thorough report. I agree the current situation is suboptimal. I also like the ratio idea

from imagetransformations.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.