-
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
[Request] Fix horizontal direction. #227
Comments
Hi @jamesst20, Indeed, this is good feature. You can check it by using the following JAR: WebcamPanel panel = new WebcamPanel(webcam);
panel.setFPSDisplayed(true);
panel.setImageSizeDisplayed(true);
panel.setMirrored(true); |
Thanks you works perfectly! :D really appreciate it :) The only bad point is that it kills the panel repainting FPS a bit :/ I guess we can't help about that right? |
Hi @jamesst20, how big the FPS drop is? In regards if this can be fixed... I don't know. I would need to experiment a little bit, but this performance drop does not appear on my PC :( I constantly have ~30 FPS. |
@jamesst20, in regards to your previous question (about rendering acceleration). This may be interesting for you, especially the Image Scaling Performance Improvements paragraph: http://www.oracle.com/technetwork/java/perf-graphics-135933.html |
Well, at default scalling, the FPS drops around 19 and if I resize the window, it drops around 9 to 10. Running the jar this way : "java -jar WebcamTest.jar -Dsun.java2d.ddscale=true" made no difference sadly. What am I missing :/ |
Can you please verify performance of this JAR? I made a small change to target the performance issue when image is mirrored, but it's just a blindly hit with a hope it will work. I modified: if (mirrored) {
x = x + w;
w = -w;
}
gr.drawImage(image, x, y, w, h, null); Into: int sx1, sx2, sy1, sy2; // source rectangle coordinates
int dx1, dx2, dy1, dy2; // destination rectangle coordinates
dx1 = x;
dy1 = y;
dx2 = x + w;
dy2 = y + h;
if (mirrored) {
sx1 = iw;
sy1 = 0;
sx2 = 0;
sy2 = ih;
} else {
sx1 = 0;
sy1 = 0;
sx2 = iw;
sy2 = ih;
}
gr.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null); And here is another, very good source of information about the acceleration in http://www.jhlabs.com/ip/managed_images.html I discovered that the problem you found was caused by the fact that image from webcam was not in the format applicable for acceleration (it was |
Much better ! :) Thanks, much appreciated :) Glad I could make you figure out a mistake ! |
Yay! Great :) Thanks for pointing this out. I would be unaware of the rendering issue since it was working perfectly on my Ubuntu laptop. |
Would it be possible to make the "horizontal" more natural. Because actually when I turn my head right, it turns left on screen which is kind of odd. Well it is normal because I am facing the camera, but it would be great to fix that :)
The text was updated successfully, but these errors were encountered: