saki4510t / UVCCamera

library and sample to access to UVC web camera on non-rooted Android device
2.99k stars 1.2k forks source link

add contrast and brightness to test 4 #536

Open imad-123 opened 4 years ago

imad-123 commented 4 years ago

hi @saki4510t i send message values of contrast and brightness from cameraclient to cameraserver and i apply it in uvccamera but i don't get any result can you help me please to achieve that thanks

public void setValue(final int flag, final int value) {
    if ( DEBUG ) Log.v(TAG, String.format("svalue(%d,%d)", flag, value));
    //checkReleased();
    final CameraThread thread = mWeakThread.get();
    final UVCCamera camera = thread != null ? thread.mUVCCamera : null;
    if (camera != null) {
        if (flag == UVCCamera.PU_BRIGHTNESS) {
            camera.setBrightness(value);
             camera.getBrightness();
        } else if (flag == UVCCamera.PU_CONTRAST) {
            camera.setContrast(value);
             camera.getContrast();
        }
    }
    //throw new IllegalStateException();
}

public void getValue(final int flag) {
    if ( DEBUG ) Log.v(TAG, String.format("gvalue(%d)", flag));

    //checkReleased();
    final CameraThread thread = mWeakThread.get();
    final UVCCamera camera = thread != null ? thread.mUVCCamera : null;
    if (camera != null) {
        if (flag == UVCCamera.PU_BRIGHTNESS) {
             camera.getBrightness();
        } else if (flag == UVCCamera.PU_CONTRAST) {
             camera.getContrast();
        }
    }
    //throw new IllegalStateException();

}