forked from jywarren/image-sequencer
-
Notifications
You must be signed in to change notification settings - Fork 209
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
[WIP] Fisheye for GIF #1489
Open
ataata107
wants to merge
14
commits into
publiclab:main
Choose a base branch
from
ataata107:fisheye
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[WIP] Fisheye for GIF #1489
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
92e4008
WIP Fisheye for GIF
ataata107 fcb9529
Merge branch 'main' into fisheye
harshkhandeparkar 2225f87
Merge branch 'main' into fisheye
harshkhandeparkar f8486f6
added callback
ataata107 96491c9
Merge branch 'main' into fisheye
ataata107 6418952
Merge branch 'main' into fisheye
ataata107 c7caf0b
Merge branch 'fisheye' of https://github.com/ataata107/image-sequence…
ataata107 4f67bc5
added multiple canvases
ataata107 91db859
Added transpose for gif
ataata107 169190d
Refactored
ataata107 e862e4d
Manipulate using dataurl
ataata107 ab619ec
Merge branch 'main' into fisheye
ataata107 b7d132c
Added callback to fetch datauri
ataata107 26ab43f
Merge branch 'main' into fisheye
harshkhandeparkar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const pixelSetter = require('../../util/pixelSetter.js'), | ||
getPixels = require('get-pixels'); | ||
|
||
module.exports = exports = function (options, pixels, oldPixels, url1,distorter, isGif,cb) { | ||
// Parse the inputs | ||
options.a = parseFloat(options.a) || distorter.lens.a; | ||
options.b = parseFloat(options.b) || distorter.lens.b; | ||
options.Fx = parseFloat(options.Fx) || distorter.lens.Fx; | ||
options.Fy = parseFloat(options.Fy) || distorter.lens.Fy; | ||
options.scale = parseFloat(options.scale) || distorter.lens.scale; | ||
options.x = parseFloat(options.x) || distorter.fov.x; | ||
options.y = parseFloat(options.y) || distorter.fov.y; | ||
|
||
// Set fisheyegl inputs | ||
distorter.lens.a = options.a; | ||
distorter.lens.b = options.b; | ||
distorter.lens.Fx = options.Fx; | ||
distorter.lens.Fy = options.Fy; | ||
distorter.lens.scale = options.scale; | ||
distorter.fov.x = options.x; | ||
distorter.fov.y = options.y; | ||
|
||
distorter.setImage(url1, function() { | ||
getPixels(distorter.getImage().src, function (err, distorted) { | ||
|
||
for (let x = 0; x < oldPixels.shape[0]; x++) { | ||
for (let y = 0; y < oldPixels.shape[1]; y++) { | ||
|
||
|
||
pixelSetter( | ||
x, | ||
y, | ||
[ | ||
distorted.get(x, y, 0), | ||
distorted.get(x, y, 1), | ||
distorted.get(x, y, 2), | ||
distorted.get(x, y, 3) | ||
], | ||
pixels | ||
); | ||
|
||
} | ||
} | ||
|
||
if(cb) cb(); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the data URI used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the module (fisheye) we need an image source for distorter to set the image. One option was to put pixels into canvas and get the url using canvas.todataurl() but this failed for gifs as it was making the transpose of that array. Hence to counter that i directly used the source url without using canvas method