Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is optimal way of background removing with javaCV?
    primarykey
    data
    text
    <p>I'm looking for the most optimal way of extracting single color on background and replace it with some picture on the fly in JavaCV. I wrote very simple method reading pixel by pixel and replacing it if the color is green for example. This is very slow and even if I divided it into few threads it works dramatically slow. This must be done on live so I have to find out some other method. Perhaps I will have to add some watermark as well after background replacing, so the application must be quite fast.</p> <p>Does anybody can help me finding right way of doing it ? I spend all day long trying to find other way of doing it, but.. all examples I have found doesn't work or maybe I do not know how to adopt them to my needs.</p> <p>This guy (<a href="http://www.youtube.com/watch?v=WOEuE3D88b0" rel="nofollow">http://www.youtube.com/watch?v=WOEuE3D88b0</a>) wrote that he is reading pixel by pixel - no way, or maybe he had very fast multi-core workstation. On my MacBook Pro 2.5 i5 it just doesn't work :(</p> <p>I have used your example and I think that I have mixed it totally. I can see mask of moving me ( white on black background) and if I use CvCopy I can see background appearing at the places where white dots are. Unfortunatelly his is not requested result, but I think I must be very close to it ;) I have to leave me and replace all static objects. Could you please examine my code ?</p> <p><code> private static final IplImage back = cvLoadImage("/Users/user/app/eclipse/JavaCV/resources/1.png", CV_LOAD_IMAGE_COLOR);</p> <pre><code>private static BackgroundSubtractorMOG2 bgs = new BackgroundSubtractorMOG2(30,16,false); public static IplImage replacePixels2(IplImage img){ IplImage frame = cvCloneImage(img); //bgs.getBackgroundImage(frame); IplImage image = IplImage.create(frame.width(), frame.height(), IPL_DEPTH_8U,1); bgs.apply(frame, image, -1); IplROI roi = new IplROI(); roi.xOffset(0); roi.yOffset(0); roi.width(frame.width()); roi.height(frame.height()); IplImage backImageWithRoi = frame.roi(roi); cvCopy(back, backImageWithRoi, image ); return backImageWithRoi; } </code></pre> <p></code></p> <p>I also tried grabCut but this is extremely slow and can't be used in changing stream on live :(</p> <p>Best Regards Jan</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload