-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fisheye sensor #3755
base: dev
Are you sure you want to change the base?
Fisheye sensor #3755
Conversation
Thanks Anna for this PR. These days there is no much activity on the team due holidays, but we will take a look as soon we are back. Regards. |
Hi there, Really impressive results! I love it and would love to see it get into the next release :) Best, |
That sounds interesting. I did something similar by manually creating cube map images (adding 6 90° fov sensors per intended fisheye camera) and generating the fisheye images separately. That is potentially a bit more flexible for creating machine learning datasets since I can extract images and create various different fisheye lens models out of them as needed. Still, this seems to be a more elegant and integrated solution. Can you please elaborate a bit what you're doing here? Especially what fisheye camera model you're using? What parameters would I need to choose to get a perfect equidistant fisheye lens with 210 degrees field of view for example? Having glanced at the code, it seems like you created a shader that does the necessary computations to directly generate the fisheye image on the GPU? I am confused by this code part in CubemapTexturePropertiesFisheye (from the UE4 patch):
The for loop does not seem to be necessary, as it calculates the same thing 10 times? I have seem similar even degreed polynomials in OpenCV, but they don't correspond to what I would expect from the inverse lens mapping function in a fisheye lens. If we take this diagram of terms: Have you thought about caching the displacement map / the direction vector for use in subsequent images? To me it looks like you calculate the direction vector for each pixel in each image that is generated. Since the direction only depends on the camera intrinsics they do not change from image to image. That would save the trigonometric calculations. As to the vignetting effects in the first image, I got rid of those by changing some render settings in
|
@annaornatskaya we have found certain issues with your PR, could we discuss possible changes/ideas? |
Hello Gunther, It would be great to have segmentation and depth fisheyes. For segmentation and depth 2D cameras post process materials are used, so it should be find another way to get the segmentation and depth information for the fisheye camera (based on ue4 scene capture cube). If you have any ideas I’d appreciate you sharing them. Now for the segmentation I use GTMaterial as post process in BP_Sky -> PostProcessing. It doesn’t work like the real segmentation(objects are still segmented but colours don't match with segmentation camera colours) but it still can help in some cases. |
Kannala-Brandt camera model.
d_1, d_2, d_3, d_4 = 0
That's true.
No, that’s not the same calculates. Every time theta becomes more accurate.
That’s a good idea. Now I’m looking for a better way to do it. If you have any ideas I’d appreciate you sharing them.
As I understand, it will change the settings for a whole project. I use different BP_Sky settings for different cases. |
yes, @dmitry0000 and I are open to any ideas and suggestions. |
I've only glanced at it to date, but found one paper about it that is an interesting read: Kinda sad that they glossed over the "without loss of generality we will use an odd polynomial" part for equation 6 -- from a Math standpoint that is not obvious. I am guessing that it yields superior accuracy with fewer parameters, but the mathematician in me really would like the proof for that...
Oh, silly me, really... I am guessing that you're calculating the inverse here? Since you need the inverse lens mapping function for the image to world mapping and got supplied the world to image lens mapping function? You could also think about calculating the inverse lens mapping function somewhere once -- or have the user supply it. In my application I calculated a numerical approximation of the inverse via a polyfit algorythm. An odd polynomial would probably also work for that (educated guess, the math probably works out, but have not really looked into it). It might also be worth it to handle equidistant projection as a special case, since in many use cases it might be sufficient, and for equidistant projection since it's linear you can easily calculate the (accurate) inverse. In my case the whole lens mapping function was a template parameter for C++ code, a functor or lambda or so that got called with theta = lensMappingFunction(uDistance, vDistance) basically. I did offset and aspect ratio correction before calling it.
In my case I had the 6 cube mapping images, so I created a displacement map as a 3 channel 32 bit integer "image" (OpenCV
Yes. Not an issue for my case. About depth images: Please be aware of issues #2494 and #2287. I'm not sure if that is still the case or not. |
The most effective approach would be to have a discussion in our Discord network. Please, could you sign up and send me a private message? PM: germanros |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Just curious if there has been any progress with this PR? Hence the bump. |
I'm also very interested in this pull request being merged!! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I am still very interested in this! |
Hi @annaornatskaya , |
可以用 |
I'm also interested in this PR being merged! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Will this change be merged into the main branch ? Interested in having fisheye camera for automated parking application testing |
When I try to apply the patch I get an error:
Any idea why ? Same is the case even with 4.24:
Also last change in the patch file seems to do nothing:
Hello @annaornatskaya: EDIT:
|
Do you know what this build error that I am getting could be caused due to ?
EIDT: Might be due to the lack of LAYOUT_FIELD macros: |
I have built the code with Unreal 4.26 and testing with latest CARLA. I have defined the fisheye camera in the carla-ros-bridge as follows:
But I get the following warnings I the sensor does not receive images: [INFO] [1675075694.702107, 6.685779]: Object (type='sensor.camera.fisheye', id='fisheye') spawned successfully as 50. [WARN] [1675075694.780804, 6.685779]: Created Unsupported Camera Actor(id=50, type=sensor.camera.fisheye, attributes={'d_4': '0.0008542188930970716', 'd_3': '-0.008587261043925865', 'd_2': '0.01112126630599195', 'c_y': '480', 'd_1': '0.08309221636708493', 'c_x': '640', 'f_y': '320', 'f_x': '320', 'y_size': '720', 'max_angle': '210', 'x_size': '1280', 'role_name': 'fisheye'}) [INFO] [1675075694.820235, 6.685779]: Created ActorControl(id=10003) |
Hello rreddy78, Thanks for your help. |
I didn't use the patch as it is. It does not work. I manually took out the changes from the patch file and made the changes in corresponding files. |
OK, I know. Thanks. |
@rreddy78 |
|
Thanks for your response. |
Is there any possibility that this feature will be added to new releases of Carla? |
@Qdriving |
@annaornatskaya Please, can you give me the reference of the distortion model which you have used?
|
I have a problem when using fisheye sensor model. I deploy one fisheye on ego car ,the resolution is 3840x2160. The FPS of carla is 14, but I use RGB sensor model, the fps is 28. So how to solve the low fps problem? My computer GPU:RTX 4090, CPU: AMD 7950 |
Hello, you need just merge the modify from the patch manually. |
Hi, I met the same problem, do you have a solution? Thank you for sharing!
|
Are you sure you've changed the carla source code (not just ue4), because it looks like carla didn't find the fisheye model. |
Hello, thank you for providing the fisheye camera patch project. Currently, I have modified the file according to https://github.com/carla-simulator/carla/issues/5678 under Unreal Engine version(s): 4.26. ubuntu20.04 After preliminary judgment, it is caused by the operation of self.sensor.listen(lambda image: CameraManager._parse_image(weak_self, image)). How can I fix this problem? |
我已经解决了pythonAPI的问题,在carla根目录下启动终端,执行 |
do you have some solution? Thank you for sharing! |
You don't seem to be using UE4.24. Try to remove the inline function "Serialize", and you seem to need to replace the declaration of the private part of the newly added class with the macro LAYOUT_FIELD, which does what Serialize and declare. That's what UE4.26 does. |
what's the meaning of "max angle", does it equal to FOV? |
add a new patch file,in order to match UE4.26.(git clone --depth 1 -b carla https://github.com/CarlaUnreal/UnrealEngine.git ~/UnrealEngine_4.26) Convenient for subsequent reproduction |
Dear all and @annaornatskaya , However, like @Hassan-BABAOUSMAIL , I am confused by the formula : I did some research and for example in Matlab and OpenCV websites which are also using and presenting KB method, the formula is:
Furthermore, could someone explain me why the black borders seems not centered, it seems always "bigger"/"stronger" on the top. Why is it so ? Is there a way to remove this black border ? Thank you for your time and feedback in advance, Br, Jeremy |
Description
Added a new sensor - fisheye camera.
Fisheye image example:
Fisheye camera works better with the following BP_Sky settings:
BP_SKY -> PostProcces -> PostProccesVolume:
As an example fisheye sensor is added to the sensors list in manual_control.py and can be used like other camera-sensors.
['sensor.camera.fisheye', cc.Raw, 'Camera Fisheye', {}]
Fisheye sensor attributes:
For ex. (attributes used for images above):
bp.set_attribute('x_size', str(1280))
bp.set_attribute('y_size', str(720))
bp.set_attribute('max_angle', str(210))
bp.set_attribute('d_1', str(0.08309221636708493))
bp.set_attribute('d_2', str(0.01112126630599195))
bp.set_attribute('d_3', str(-0.008587261043925865))
bp.set_attribute('d_4', str(0.0008542188930970716))
bp.set_attribute('f_x', str(320))
bp.set_attribute('f_y', str(320))
bp.set_attribute('c_x', str(640))
bp.set_attribute('c_y', str(480))
In UE4_patch_fisheye-sensor.zip you can find a patch for UE4 which is obligatory for the fisheye sensor.
UE4_patch_fisheye-sensor.zip
Where has this been tested?
This change is