Comments (4)
I guess the issue is that bpy.ops.wm.cgt_feature_detection_operator is bound to blenders window manager (mainly to show realtime updates) and while running blender headless this results in an error.
BlendArMocap/src/cgt_mediapipe/cgt_mp_detection_operator.py
if you check the operator, you'll see it uses the window manager. You can just use the operator as baseline to create your own operator, remove the modal, window manger stuff and just use a while loop in the execute
method.
If you have an issue with the opencv image display (idk if that's an issue in the docker as there is no window manager), you'll find a get stream
method in the operator. BlendArMocap/src/cgt_mediapipe/cgt_mp_core/cv_stream.py
-> You'll probably just overwrite the streams 'draw' method so it just passes on draw and should be good in this case.
So either overwrite in the add-ons operator directly or create an own operator :)
Quick outline:
class DOCKER_CGT_MP_modal_detection_operator(bpy.types.Operator):
# register the new operator with a custom id
...
def get_chain(self, stream) -> cgt_nodes.NodeChain:
...
return chain
def get_stream(self):
# overwrite the stream if necessary
return stream
def execute(self, context):
# here are some changes
self.user = context.scene.cgtinker_mediapipe # noqa
# init stream and chain
stream = self.get_stream()
self.node_chain = self.get_chain(stream)
if self.node_chain is None:
self.user.modal_active = False
return {'FINISHED'}
# memo skipped frames
self.memo = []
while self. overwritten_modal(context) == {'PASS_THROUGH'}:
pass
return {'OPERATOR_FINISHED'}
@staticmethod
def simple_smoothing(memo, cur):
...
return memo
def overwritten_modal(self, context):
""" Run detection as modal operation, finish with 'Q', 'ESC' or 'RIGHT MOUSE'. """
if self.user.detection_input_type == 'movie':
# get data
data, _frame = self.node_chain.nodes[0].update([], self.frame)
if data is None:
return self.cancel(context)
self.simple_smoothing(self.memo, data)
if self.frame % self.key_step == 0:
for node in self.node_chain.nodes[1:]:
node.update(self.memo, self.frame)
self.memo.clear()
self.frame += 1
return {'PASS_THROUGH'}
def cancel(self, context):
""" Upon finishing detection clear the handlers. """
del self.node_chain
return {'FINISHED'}
from blendarmocap.
I just found the time to adapt the operator and it works like a charm. Haven't build a Docker container out of it yet but I can fully run the end-2-end process from the terminal now. Thank you so much! Is that something you would be interested in having as well?
from blendarmocap.
You are welcome, glad it works!
Feel free to create a separate folder like src/docker
with a short readme so others which might need to run detection in a docker can use your implementation swell :)
from blendarmocap.
@NikKaem It will be great if you would sare your solution. Thank you!
from blendarmocap.
Related Issues (20)
- Support VRM humanoid avatar HOT 1
- Pose Transfer seems incomplete HOT 7
- Freemocap import HOT 1
- Blenrig compatibility and integration HOT 1
- Question about transferring the face animation
- Increase MediaPipe's detection model complexity
- Installation of attrs failed
- Why the video stream is so slow?
- Linux crash after Linux Mint upgrade HOT 1
- Face Motion is a Bit Limited with MPFB HOT 1
- Error in Start DETECTION HOT 1
- NEW BUG HOT 1
- Running mp_hand_detector.py file indivudualy to get coordinates
- Error at installing dependencies in Blender 3.6.2 version at Windows HOT 7
- BlendArMocap v1.6.1 I can't install the Dependencies in Blender 3.6.0 and Blender 4.0.0. HOT 2
- I need help understanding how this plugin works
- Error using mediapipe when i click on start detection
- Media Pipe (dependency) will not install 😭 HOT 1
- Blender "Not Responding" when click on Install Dependencies
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 blendarmocap.