Comments (6)
Is there a way to calculate the transformation once, and then apply it multiple times to each of the frames?
Calculating the transformation won't be the major performance hotspot, so what benefits does it give? BTW, there's also an in-place version imresize!
.
from imagetransformations.jl.
I'm sure you are correct, but that depends on the number of frames I'm processing. But perhaps the number of frames needed for this to start making a difference is in the thousands -- I don't know how much of the time goes to the interpolation versus calculating the transform.
More importantly, it would allow me to use the viewed versions of the warp functions. In my case I'm looking for the next location of the tracked animal only in the vicinity of the last know location, so there's no need to scale the whole image, just the region of interest.
And the reason I don't simply build my own transformation with CoordinateTransformations.jl
is due to VideoIO.jl
's requirement that the dimensions of a saved frame be a multiple of 2. So I need some way of guaranteeing that scaled image has pair height and width. That is straightforward with imresize
.
from imagetransformations.jl.
Maybe you can instead build a lookup table of coordinates and calling warp!
, and see how that improves the performance. Something like #64 (comment) but backed by a pre-computed lookup table, with the core coordinate computation reduced to getindex
.
To call warp!
we current need to build our own extrapolation, for the simplest bilinear case with zero fill value we can do etp = extrapolate(interpolate(img, BSpline(Linear())), zero(eltype(img)))
from imagetransformations.jl.
I might not follow you exactly, but to be clear this is the kind of transform I'm using:
scale = 4
sar = 4/3
scaleh = scale * sar
scalew = scale
tform = LinearMap(SDiagonal(scaleh, scalew))
pretty standard stuff. I'm just shrinking the image by a factor of 4 and fixing its aspect ratio. So no need to use a novel lookup table...?
I think I need to either get my hands on the transform imresize
is using, or be able to produce a LinearMap
that guarantees the resulting image has dimensions that are multiples of 2.
from imagetransformations.jl.
Building a transformation map won't take much time, it is applying map(i-> tform(SVector(i.I)), CartesianIndices(img))
that takes time, so if you want to save the computation, you can pre-calculate lookup_table = map(i-> tform(SVector(i.I)), CartesianIndices(img))
and then define a function to directly query from this table instead of computing it for every frame.
from imagetransformations.jl.
The linear coordinate transform that imresize
uses is defined this way:
ImageTransformations.jl/src/resizing.jl
Lines 144 to 153 in 4d89e5c
from imagetransformations.jl.
Related Issues (20)
- Does ForwardDiff work with ImageTransformations? HOT 3
- demo: grid stretching and elastic transformation
- add swirl function HOT 1
- Images getting generated differently HOT 4
- No stable version document is deployed HOT 6
- Add `Projective` transformation HOT 2
- Demos using CoordinateTransformations and Rotations
- `imrotate(img, pi/2)` changes size of image HOT 3
- Clarification of rotations HOT 7
- Rotation operation is inaccurate HOT 2
- Custom image transformation? HOT 4
- imresize without interpolation for integer upscaling
- imflip function
- The reference frame associated to an image is not the best one to perform a shear transformation HOT 6
- Support for autodiff in warping?
- Support v0.15 of Interpolations.jl HOT 1
- Warp seems to be off HOT 1
- Add docs for imresize!
- Cropping after warp HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imagetransformations.jl.