Skip to content
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

Calculation of the percentage of obscured #945

Open
TheIOne opened this issue Jul 24, 2023 · 2 comments
Open

Calculation of the percentage of obscured #945

TheIOne opened this issue Jul 24, 2023 · 2 comments
Labels
first answer provided question Question, not yet a bug ;)

Comments

@TheIOne
Copy link

TheIOne commented Jul 24, 2023

Describe the issue

I want to get a target detection dataset for an industrial scene based on blenderproc rendering. In an industrial scene, there is a strong relationship between the degree of occlusion of an object and the capture priority. So I want to get the occlusion ratio of each object while rendering coco labels (occlusion ratio = object visible mask / object original mask). My current solution is to use bop_toolkit to compute the object's projection mask based on the target's bitmap, and then compute the target's visible mask, but this way I need to output the bitmap of each model when rendering as well, which is obviously inefficient. Do you have any good suggestions or ways to implement this please?

Minimal code example

No response

Files required to run the code

No response

Expected behavior

Quickly get the proportion of each object that is occluded in the camera view after physical simulation

BlenderProc version

v2.4.1

@TheIOne TheIOne added the question Question, not yet a bug ;) label Jul 24, 2023
@cornerfarmer
Copy link
Member

If you are okay with getting an approximate solution, you could use ray casts.
Similar to how its done in the camera utility

_, _, _, dist = bvh_tree.ray_cast(position, end - position)
, you send rays from the camera into its view.
You do this twice, once using an bvh_tree containing all objects and once using an bvh_tree only containing your target object.
Then compare at which distance the corresponding rays hit. If they hit at the same distance, it means the object is visible at that point, but if the first one hits earlier, it means there is another object in between.

@cuijiale123
Copy link

Hello, could you tell me the specific solution?

I am looking forward to your reply

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first answer provided question Question, not yet a bug ;)
3 participants