-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Q: Again a stupid question... #618
Comments
Hi @neilyoung, There is no such driver available in the release, but I have something similar available in tests. It's enough to copy the source code and use it in your project. This import javax.swing.JFrame;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import com.github.sarxos.webcam.ds.test.DummyDriver;
public class DummyDriverExample {
static {
Webcam.setDriver(new DummyDriver());
}
public static void main(String[] args) {
JFrame window = new JFrame("Dummy Test");
window.add(new WebcamPanel(Webcam.getDefault()));
window.setResizable(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.pack();
window.setVisible(true);
}
} If you want to feed your RGB data to the application and render as image from webcam then If you want to paint your RGB data on the real image from webcam, then In this example transformer does nothing more than changing image to grayscale, but in the same way you can paint any RGB data on the image. |
@sarxos Thanks, will give it a try |
OK, have used this as a template. It works excellent. By using it I was able to write my own MJPEG decoder (tailored to the needs). I found, that the frame rate I can achieve (with 30 fps) is more or less exactly 30 fps on the sink, whereas your MjpegDriver is reaching 18 to 20 fps. Not sure, what it is, but if you like I can share my sources on a private channel. Because my consuming process has a little problem being fed with one and the same frame several times (the using app is able to achieve 90 fps) I'm now refactoring the code so that "getImage" is hanging on a semaphore and just released on a new "real" frame. I will conserve the current state so that I can send it to you if you like. The MIME decoder is pretty much nailed to the project, but it works great. EDIT: I have now introduced thread sync means, so that getImage() is hung if no new frame is available. The frame rate now is comparable to your results... I suppose, you are also doing sort of sync (not checked). So you can forget about :) But what I don't understand is this: I have several frame rate counters
So now: At application level I'm only having 15 fps... I know we had this discussion already once, but I can't remember exactly. Or I think I wasn't following your suggestion, because it seemed to complicated to me... But as a matter of fact: 30fps after decoding, 30fps at driver getImage(). But only 15 fps after webcam.getImage. This needs to be resolved... Here is the application code running in a separate thread. I have omitted all unnecessary stuff for clarity.
|
@sarxos This log will not tell you much, but this is what I see (and currently don't understand): fps : Measured at driver level, whenever a new frame is decoded and made available
|
OK, giving up for today. Don't get it really. Here is a raw trace of one particular second, which I don't understand: Explanation: The
The
So as far as I can see each However, only every 2nd delivery ends up in a
|
Found our old conversation: #599. Still not convinced that it has to be that complicated. Thinking about a direct frame callback from driver to application... And |
@sarxos Finally found a better way: Dropped WebcamPanel, doing my own drawing in the capture thread. Can be closed. |
... is there a way feed a webcam instance with RGB data? Like a "software cam"?
The text was updated successfully, but these errors were encountered: