Coder Social home page Coder Social logo

Comments (4)

timholy avatar timholy commented on July 28, 2024

This is an area I need to document and improve. Scaling of images turns out to be surprisingly subtle. You generally want to take a Uint8 image at face value, but other types may need to be scaled for any kind of sensible display. The ScaleMinMax type is a good general default; however, often one could get by with fewer operations, and at least when I tested it some time ago this can have a measurable impact on movie playing speeds. Hence the other types.

Are you calling this programmatically, or from ImageView's display? If programmatically, my recommendation is to create your own ScaleInfo object. If you want to convert to a Uint8 you can say

uint32color!(buf, img, scaleminmax(img))

If you're calling it from display, then I'm aware this is an area which needs some work. (I'm partway to having a GUI to show a histogram, but other priorities have risen above this one.) For now you should be able to say

display(img, render! = (buf, img) -> uint32color!(buf, img, scaleminmax(img))

If you have a movie, this will auto-scale each image separately. You can fix the range manually with scaleminmax(Uint8, img, minval, maxval) instead of just scaleminmax(img).

Does this help?

from imageview.jl.

timholy avatar timholy commented on July 28, 2024

See also be64cbe8ba40fdf49374bbd854f223a4516f55c9.

from imageview.jl.

timholy avatar timholy commented on July 28, 2024

Also, I don't understand how you went from a Uint16 to a Uint64.

from imageview.jl.

rsrock avatar rsrock commented on July 28, 2024

Now that's pretty nifty. I am using display() for now, and your line up above scales my movie display range just right. I'm impressed that display() makes it so easy to define custom renderers like that, I'm going to have to poke around in there some more.

Playback is at ~ 10 fps. I can't seem to get the right-click in the button area to change the frame rate on my Mac, but I don't really need that right now. Overall, pretty useful.

Your other question about Uint16 to Uint64 was actually answered by your changes to Images.jl in be64cbe. I was confused about the promotion to Uint64 with the bitwise &, but Stefan confirms that this is the expected behavior.

from imageview.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.