Git Product home page Git Product logo

Comments (4)

blueOkiris avatar blueOkiris commented on June 10, 2024

Huh, I didn't know that. I'm on Arch too, and I didn't realize it! Added it to the list.

As for the other issue. I see you have python3.9, so that shouldn't be the issue.
Ah I know what it is. You didn't provide a replacement background, and I didn't properly implement the function overloading.

I think I can fix that

from bgrm.

blueOkiris avatar blueOkiris commented on June 10, 2024

Should be fixed now. Tested with and without bg argument. Basically combined:

    def getFrame(self):
        _success, frame = self._vidFeed.read()
        noBgFrame = self._segmentor.removeBG(
            frame, self._settings.fillColor,
            threshold = self._settings.rmThresh
        )
        return (frame, noBgFrame)
    
    def getFrame(self, bgImg):
        _success, frame = self._vidFeed.read()
        noBgFrame = self._segmentor.removeBG(
            frame, bgImg,
            threshold = self._settings.rmThresh
        )
        return (frame, noBgFrame)

which isn't correct because that just gets rid of the first one into:

    def getFrame(self, bgImg = None):
        _success, frame = self._vidFeed.read()

        if shape(bgImg) == ():
            noBgFrame = self._segmentor.removeBG(
                frame, self._settings.fillColor,
                threshold = self._settings.rmThresh
            )
        else:
            noBgFrame = self._segmentor.removeBG(
                frame, bgImg,
                threshold = self._settings.rmThresh
            )
        return (frame, noBgFrame)

from bgrm.

BachoSeven avatar BachoSeven commented on June 10, 2024

Thanks for the quick fix!

By the way, an unrelated idea: do you think it could be possible to implement the "blur background" functionality in this program or would that be off-scope?

If it is, then perhaps we could provide an example of how to pass a still blurred image of the background directly to bgrm, using convert $(shot of current bg) -blur 0x7 "image to be passed to bgrm" for example

from bgrm.

blueOkiris avatar blueOkiris commented on June 10, 2024

It's probably possible to do.
Basically in the main loop:

# Loop over feed
while True:
     # Get cam feed
     if settings.bgImg == '':
         frame, noBgFrame = cam.getFrame()
     else:
         frame, noBgFrame = cam.getFrame(bgImg)
     
     # Write to virtual camera
     virtCam.write(cvtColor(noBgFrame, COLOR_BGR2YUV_I420))

     # Display
     stackFrame = cam.stackFrames(frame, noBgFrame)
     if not cam.display(stackFrame):
         break

In between the frame, noBgFrame setting and the virtCam write, you'd insert something like (i.e. not exactly this):

if settings.blur:
    background = frame - noBgFrame
    blurred = GausianBlur(background, settings.blurAmount)
    noBgFrame += blurred

And of course make sure to run with no background provided

from bgrm.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.