parent
24c920a33a
commit
86f7a357ae
2 changed files with 46 additions and 45 deletions
@ -1,19 +1,30 @@ |
|||||||
package org.opencv.samples.tutorial5; |
package org.opencv.samples.tutorial5; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
import org.opencv.android.JavaCameraView; |
import org.opencv.android.JavaCameraView; |
||||||
|
|
||||||
import android.content.Context; |
import android.content.Context; |
||||||
|
import android.hardware.Camera; |
||||||
import android.util.AttributeSet; |
import android.util.AttributeSet; |
||||||
|
|
||||||
public class CustomJavaCameraView extends JavaCameraView { |
public class CustomJavaCameraView extends JavaCameraView { |
||||||
|
|
||||||
public CustomJavaCameraView(Context context, AttributeSet attrs) { |
public CustomJavaCameraView(Context context, AttributeSet attrs) { |
||||||
super(context, attrs); |
super(context, attrs); |
||||||
} |
} |
||||||
|
|
||||||
|
public List<String> getEffectList() { |
||||||
|
return mCamera.getParameters().getSupportedColorEffects(); |
||||||
|
} |
||||||
|
|
||||||
|
public String getEffect() { |
||||||
|
return mCamera.getParameters().getColorEffect(); |
||||||
|
} |
||||||
|
|
||||||
@Override |
public void setEffect(String effect) { |
||||||
protected boolean connectCamera(int width, int height) { |
Camera.Parameters params = mCamera.getParameters(); |
||||||
boolean result = super.connectCamera(width, height); |
params.setColorEffect(effect); |
||||||
return result; |
mCamera.setParameters(params); |
||||||
} |
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue