fisheye | Easily create a fisheye effect
kandi X-RAY | fisheye Summary
kandi X-RAY | fisheye Summary
Easily create a fisheye effect anywhere you need it.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of fisheye
fisheye Key Features
fisheye Examples and Code Snippets
Community Discussions
Trending Discussions on fisheye
QUESTION
ANSWER
Answered 2021-Apr-30 at 10:53You may convert from YUV 4:2:2 to YUV 4:4:4, undistorted the 4:4:4, and convert back to 4:2:2.
Illustration of the conversion stages:
YUV422 -> YUV444 -> remap(YUV444) -> YUV422
I could not find an OpenCV function for converting from YUV 4:2:2 to YUV 4:4:4.
Implementing the conversion by simple for loops is quite straight forward:
QUESTION
I'm working on a project for school where I need to implement a fisheye shader, and I'm struggling with the process for determining the depth values of the vertices. I know that for a point in space P1 = (x, y, z, w) that P * my projection matrix should result in a new point P2 = (a, b, c, d) where for any point between the near and far clipping planes P2.c/P2.d results in a number between 0 and 1.
My hlsl vertex shader contains this code where input.Position is the raw Vertex Position
...ANSWER
Answered 2021-May-08 at 06:39If this is only a problem with the triangles far away it could be that you are hitting your depth buffer precision limit? If you already didn't do so, you should set your close/far-plane correctly so that you don't waste floating point precision for a part of the scene you are not rendering anything in. Also is the 3rd element of your hypotenuse calculation correct? Seems like the third squared element should be input[2]*input[2].
QUESTION
What is the difference between these two functions provided in OpenCV?
Why is there cv2.fisheye.calibrate() function we need?
I tried using cv2.calibrateCamera() for barrel distorted images and I think it is giving me good results, so why would I want to use fisheye.calibrate()?
...ANSWER
Answered 2021-Mar-29 at 14:57Distortion in fisheye lenses is really high. At least in older versions cv2.calibrateCamera() did not fit polynomials with sufficiently high order, so results were poor or the calibration failed altogether. So cv2.fisheye.calibrate() implemented a camera model with higher order polynomials.
QUESTION
I am writing a raycaster using SDL's C API. I have spent weeks trying to fix the notorious fisheye effect to no avail. According to this source, I can multiply my calculated distance by the cosine of half of the FOV to fix it. That has not worked for me. I still have the cosine correction in my code nonetheless.
Here are two images demonstrating the distortion:
I think a core problem of my code may be that my angle increment is constant, while the increment should be smaller as I'm closer to the screen borders. Unfortunately, I don't know how to start implementing this.
If possible, could anyone please take a look at my code and give me a tip on how to remove the fisheye? To move in any direction, use the arrow keys. Use the 'a' and 's' keys to turn left and right respectively.
This is how I'm compiling: clang `pkg-config --cflags --libs sdl2` raycaster.c
ANSWER
Answered 2021-Mar-11 at 22:09Okay I found a guide which talks about this exact issue.
Before drawing the wall, there is one problem that must be taken care of. This problem is known as the "fishbowl effect." Fishbowl effect happens because ray-casting implementation mixes polar coordinate and Cartesian coordinate together. Therefore, using the above formula on wall slices that are not directly in front of the viewer will gives a longer distance. This is not what we want because it will cause a viewing distortion such as illustrated below.
Thus to remove the viewing distortion, the resulting distance obtained from equations in Figure 17 must be multiplied by cos(BETA); where BETA is the angle of the ray that is being cast relative to the viewing angle. On the figure above, the viewing angle (ALPHA) is 90 degrees because the player is facing straight upward. Because we have 60 degrees field of view, BETA is 30 degrees for the leftmost ray and it is -30 degrees for the rightmost ray.
QUESTION
I am writing a raycaster using the SDL library with C. I have been dealing with the fisheye effect for many weeks now. For a field of view like 60 degrees, I multiply the distance to the wall by the cosine of the relative angle (ranging from -30 to 30), but still, I get the same fisheye. Here's what that looks like:
I don't know what to do at this point, given that so many sources have recommended cosine correction and it just does not fix the distortion in my case.
- I am compiling like this:
clang `pkg-config --cflags --libs sdl2` raycaster.c
- To go forward and back, press the up and down keys. Press left and right to strafe. You can use the
a
ands
keys to turn left and right respectively.
My code is below if you want to take a look. If you manage to figure out why I am getting a warped perspective in my engine, please let me know.
...ANSWER
Answered 2021-Mar-16 at 03:52There are two major problem in this code. The distance to the wall must be calculated for the intersection point of your ray to the wall instead of just relying that your endpoint lies inside the wall square.
Having a camera at C, the distortion is solved by casting rays from C through a sufficient number of points between A and B, just dividing this plane (your screen) to equally wide columns (pixels).
I'm fairly pessimistic about the cosine correction, since what I can tell, one should more likely adjust the drawn column width or position with it, than the column height.
QUESTION
This project is taking pictures for the sky and then it's going to mask the clouds, so there will be two pictures, one is the original and the other is the masked one.
I just want to upload every picture taken by the camera pi to Dropbox.
Here is the main code:
...ANSWER
Answered 2020-Oct-26 at 14:36When using the files_upload
method in the Dropbox Python SDK, you specify where you want to upload via the value you supply to the path
parameter.
A path/conflict/file
error when uploading to Dropbox indicates that the upload failed because "There’s a file in the way".
Looking at your code, this seems expected in this case since you're always specifying the value '/image.jpg'
, so after the first successful call, there will already be a file there.
You should instead change your code to use a different path
for each different file.
QUESTION
I am looking for a fast way to interpolate a 3 channel image on a grid of x-y points. I have a functioning code using map_coordinates
. As you can see, i am doing 3 times the same thing, I would like a faster way that can do at least the 3 channels at the same time.
ANSWER
Answered 2020-Oct-21 at 10:04I think the following should work. (I've changed x/y to row/col to avoid confusion over swapping of axis order...)
QUESTION
I am using cytoscape js with react cytoscape and cytoscape undoRedo and cytoscape expand collapse. On first render I want to have layout by preset(I have all node's positions). It works well but when i perform api.collapseAll() it looks like nodes does not have these positions. Even though groupped nodes have the same position as parent. On expand I want to use cose bilkent layout. Is there a way to do it?
...ANSWER
Answered 2020-Sep-10 at 08:45Yes it is possible. I made it via setting layoutBy within collapseAll method;)
QUESTION
What does cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR)
do when the map1
has a shape (h,w,2)
and map2
a shape (h,w)
.
These maps come as an output to the cv2.fisheye.initUndistortRectifyMap
but the documentation is not very clear. If I change the map2
variable for a numpy.array([],dtype=np.int16)
it will still give me a output that looks close to the one without omitting map2
but there are differences.
Does cv2.remap
change the data type of img
during this process?
ANSWER
Answered 2020-Aug-29 at 21:37Yes, the documentation is unfortunately not quite clear on this. However, if you take a look at cv2.remap
and
cv2.computeMaps
this tells you what they actually mean.
In summary, the output of cv2.fisheye.initUndistortRectifyMap
provides two maps where the first map is a two channel matrix where the first channel are the x
coordinates and the second channel are the y
coordinates for the remapping. Now what is different is that this is a result of fixed-point precision instead of a typical floating-point precision matrix. Fixed-point is primarily used for computational speedups in calculating the remapped image. The second map is a table of interpolation coefficients so that when you use this in concert with the first map, it provides nearly identical results compared to using the normal floating-point precision matrices but with great computational savings.
By omitting the second map, you are still getting decent results, but the second map being empty produces a loss of precision as you are not providing the interpolation table to produce what would have been created if you used a floating-point precision map. This is why you are viewing an image with somewhat lower quality.
QUESTION
I've got a CG shader which scrolls a sprite in a SpriteRenderer in Unity, like so:
The problem is that there's no "bending" on the edges of the sprite, so it doesn't look like the bowling ball is rolling. I'd like to add a fisheye effect. I see there is a simple fisheye effect shader here:
http://www.michaelbibby.co.uk/2017/10/05/simple-fish-eye-post-process-shader/
which I am trying to add to my scrolling effect by taking the frag
shader function and putting it in my shader. But when I do, it tells me that the v2f
called i
in the frag shader doesn't have a .uv
property. I don't understand this problem, because there doesn't seem to be a definition for a struct of type v2f
in my shader, though there is in the fisheye effect one.
Here's my starting point, which is the scrolling shader being used in the video. Can anyone advise me on how to add the fisheye effect?
...ANSWER
Answered 2020-Aug-29 at 10:30The definition of v2f
is in UnitySprites.cginc:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
Install fisheye
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page