nekocode / camerafilter Goto Github PK
View Code? Open in Web Editor NEW📷 Realtime camera filters on android.
License: Apache License 2.0
📷 Realtime camera filters on android.
License: Apache License 2.0
Hello, thanks for great implementation. Can we run this program on Single bitmaps instead of camera?
I tried a lot but cannot figure out how.
It would be very cool to have this distributed through F-Droid: https://f-droid.org/
anyone help for case we can set the level of the filter
A check with VirusTotal reports a trojan named "Android/C2M.I.62A80EEE7B6C" for v2.2. Any idea what could cause it? To me it looks like a "false positive" (especially as only 1 out of 55 engines reports it), but there's no background info on it. Would be nice to get rid of that nasty flag :)
i try to open it with Android Studio, but it appears to be not a project folder. The zip not include /.gradule /.idea /build folder.
how can i trans-plant this to my soft
please provied solution for below issue :
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.remfit.pillowsuggester, PID: 4655
java.lang.NullPointerException: Attempt to read from field 'java.lang.Object android.util.Pair.second' on a null object reference
at com.remfit.pillowsuggester.CameraFilter.CameraRenderer.onSurfaceTextureAvailable(CameraRenderer.java:159)
at android.view.TextureView.getHardwareLayer(TextureView.java:370)
at android.view.View.updateDisplayListIfDirty(View.java:14274)
at android.view.View.getDisplayList(View.java:14319)
at android.view.View.draw(View.java:15089)
at android.view.ViewGroup.drawChild(ViewGroup.java:3405)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.updateDisplayListIfDirty(View.java:14292)
at android.view.View.getDisplayList(View.java:14319)
at android.view.View.draw(View.java:15089)
at android.view.ViewGroup.drawChild(ViewGroup.java:3405)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.draw(View.java:15364)
at android.widget.FrameLayout.draw(FrameLayout.java:600)
at android.view.View.updateDisplayListIfDirty(View.java:14297)
at android.view.View.getDisplayList(View.java:14319)
at android.view.View.draw(View.java:15089)
at android.view.ViewGroup.drawChild(ViewGroup.java:3405)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.draw(View.java:15364)
at android.view.View.updateDisplayListIfDirty(View.java:14297)
at android.view.View.getDisplayList(View.java:14319)
at android.view.View.draw(View.java:15089)
at android.view.ViewGroup.drawChild(ViewGroup.java:3405)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.updateDisplayListIfDirty(View.java:14292)
at android.view.View.getDisplayList(View.java:14319)
at android.view.View.draw(View.java:15089)
at android.view.ViewGroup.drawChild(ViewGroup.java:3405)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.updateDisplayListIfDirty(View.java:14292)
at android.view.View.getDisplayList(View.java:14319)
at android.view.View.draw(View.java:15089)
at android.view.ViewGroup.drawChild(ViewGroup.java:3405)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.draw(View.java:15364)
at android.widget.FrameLayout.draw(FrameLayout.java:600)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2835)
at android.view.View.updateDisplayListIfDirty(View.java:14297)
at android.view.View.getDisplayList(View.java:14319)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:273)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:279)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:318)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2646)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2468)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2098)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1161)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6198)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5280)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)
va.lang.IllegalThreadStateException: Thread already started
at java.lang.Thread.checkNotStarted(Thread.java:849)
at java.lang.Thread.start(Thread.java:1059)
at cn.nekocode.camerafilter.CameraRenderer.onSurfaceTextureAvailable(CameraRenderer.java:121)
In android 7.0, app first of all asks for permission to take pictures and record video . On allowing it, just the white screen comes with no camera as shown. Although, on restarting the app , camera is working absolutely fine.
Also, in the Filter named 'Cracked', the feature is working fine but with a little bit of lag
Please check
Hello nekocode. Great work there. Am only battling with how to make the rendere looks better, if am choosing to be on fullscreen mode. i.e layoutWidth and Height = "match_parent".
How can i go about this, thank you for all your help and libraries, hoping to get a reply from you soon.
Storage permission should be there in main activity just like camera. for new permission modal
It's awesome!!
the apk that you provide run on my device crash
Hello nekocode. Am trying to use the front camera, but the view is rotated upside down. I tried camera.setDisplayOrientation(90); but didnt work as well as parameter.setRotation(90) .
Please how can i go about this. Thank you for the time invested in this library.
how to take a photo ,,using button?
我想将该项目接入第三方视频服务商,不知道能否
guys thanks in advance.
I am trying to improve camera quality.
Please give some way what all i need to do to improve camera quality.
Waiting
Thanks for this awesome library,can you please help me to switch camera from back to front.
I was using ShaderToy to create a filter of my own and when I put it on the app, it seems to be a compatibility issue involving the texture class.
It appears that ShaderToy has the new version in which Texture2D
was replaced by only texture
and that's how I built my shader on the online tool:
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord.xy;
int id = 5;
vec3 s = texture(iChannel0, fragCoord.xy / iResolution.xy).xyz;
vec3 c = vec3(50, 50, 50);
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
vec3 dest = vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
vec3 color = max(s,dest);
fragColor = vec4(color,1.0);
}
If I put the code like this on the app, the screen turns black, that because of the texture that is not supported. If I simply change from texture
to texture2D
in line 4, is like the entire screen in only one huge pixel that changes color as I move my camera.
Do you have any idea how I can change this code or the one on MyGLUtils class so it will work properly?
Hello,
thank you in advance,
i use this library to take camera image but image quality is not that much good.
i use below capture code
private boolean caputre() {
String mPath = genSaveFileName(getTitle().toString() + "_", ".png");
File imageFile = new File(mPath);
if (imageFile.exists()) {
imageFile.delete();
}
//sessionManager.setStringData(SessionManager.KEY_picturepath);
sessionManager.putStringData(SessionManager.KEY_picturepath,mPath);
// create bitmap screen capture
Bitmap bitmap = textureView.getBitmap();
//Bitmap bitmap = textureView.getDrawingCache();
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream(imageFile);
// bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
outputStream.flush();
outputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
}
please give some solution to improve quality
But if restart the app - all works fine. I think the problem still in runtime permissions
I just run on android studio3.1.2, but when app run, show this error:"Camera access is required". And I look at the source .code, it is here, how can I resolve this bug?
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED && permit) {
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
Toast.makeText(this, "Camera access is required.", Toast.LENGTH_SHORT).show();
} else {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA},
REQUEST_CAMERA_PERMISSION);
}
} else {
setupCameraPreviewView();
}
i don't want zoomed image.
please give some solution how to do zoom out in camera preview.
thanks in advance.
Hi, Nikocode! First of all, thank you for your work! I can 't figure out how I can zoom in and zoom out real time camera in your programm? setParameters.setZoom() is not working! Thanks!
07-29 10:05:28.757 32089-32089/? I/art: Late-enabling -Xcheck:jni
07-29 10:05:28.757 32089-32089/? I/art: Late-enabling JIT
07-29 10:05:28.776 32089-32089/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
07-29 10:05:28.839 32089-32089/cn.nekocode.camerafilter W/System: ClassLoader referenced unknown path: /data/app/cn.nekocode.camerafilter-2/lib/arm
07-29 10:05:28.924 32089-32089/cn.nekocode.camerafilter W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-29 10:05:29.170 32089-32116/cn.nekocode.camerafilter D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
07-29 10:05:29.222 32089-32116/cn.nekocode.camerafilter I/mali_so: [File] : hardware/arm/maliT760/driver/product/base/src/mali_base_kbase.c; [Line] : 928; [Func] : base_context_deal_with_version_affairs_rk_ext;
arm_release_ver of this mali_so is 'r12p0-04rel0', rk_so_ver is '13@0', built at '15:42:56', on 'Aug 16 2016'.
07-29 10:05:29.222 32089-32116/cn.nekocode.camerafilter I/mali_so: [File] : hardware/arm/maliT760/driver/product/base/src/mali_base_kbase.c; [Line] : 955; [Func] : base_context_deal_with_version_affairs_rk_ext;
mali_ver_property has been set to 'r12p0-04rel0-13-13@0', to return.
07-29 10:05:29.224 32089-32116/cn.nekocode.camerafilter I/OpenGLRenderer: Initialized EGL, version 1.4
07-29 10:05:29.232 32089-32116/cn.nekocode.camerafilter D/Surface: Surface::final mReqUsage=a00
07-29 10:05:29.232 32089-32116/cn.nekocode.camerafilter D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
07-29 10:05:29.343 32089-32089/cn.nekocode.camerafilter W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
07-29 10:05:29.947 32089-32161/cn.nekocode.camerafilter D/Surface: Surface::final mReqUsage=200
07-29 10:05:29.947 32089-32161/cn.nekocode.camerafilter D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
07-29 10:05:30.288 32089-32161/cn.nekocode.camerafilter D/skia: ---- fAsset->read(1024) returned 0
07-29 10:05:31.174 32089-32161/cn.nekocode.camerafilter E/GLConsumer: error creating EGLImage: 0x3003
07-29 10:05:31.174 32089-32161/cn.nekocode.camerafilter E/GLConsumer: Failed to create image. size=2200x1650 st=2200 usage=0x333 fmt=21
07-29 10:05:31.174 32089-32161/cn.nekocode.camerafilter W/GLConsumer: [SurfaceTexture-3-32089-1] updateAndRelease: unable to createImage on display=0x1 slot=0
07-29 10:05:31.178 32089-32161/cn.nekocode.camerafilter E/AndroidRuntime: FATAL EXCEPTION: Thread-229
Process: cn.nekocode.camerafilter, PID: 32089
java.lang.RuntimeException: Error during updateTexImage (see logcat for details)
at android.graphics.SurfaceTexture.nativeUpdateTexImage(Native Method)
at android.graphics.SurfaceTexture.updateTexImage(SurfaceTexture.java:240)
at cn.nekocode.camerafilter.CameraRenderer.run(CameraRenderer.java:190)
at java.lang.Thread.run(Thread.java:818)
07-29 10:10:31.281 32089-32161/cn.nekocode.camerafilter I/Process: Sending signal. PID: 32089 SIG: 9
Can i record video using these filters ? Please help me
Hi,
How can i create a filter chain?
I need multiple outputs with different filters and blend them to single frame?
I have a Project dialog box pop-up options are to achieve the switch call comes with the camera's current interface display video camera, that is, the use of your framework, as well as the call to select the local album API
I called the interface initialization after the start of the preview, and then call the system comes with a camera callback is always 0 activity.RESULT_CODE=CANNEL, which is how it happened? As well as the choice of album came back and then click to take pictures
Thread already started va.lang.IllegalThreadStateException:
Java.lang.Thread.checkNotStarted at (Thread.java:849)
Java.lang.Thread.start at (Thread.java:1059)
Cn.nekocode.camerafilter.CameraRenderer.onSurfaceTextureAvailable at (CameraRenderer.java:121)
Hello,
I am trying to change camera preview as per button click.
on button click need to switch internal camera to external OTG camera and vice versa.
Please give some solution for this
thank you in advance.
For the 1.4 release, the APK still shows 1.4:
package: name='cn.nekocode.camerafilter' versionCode='1' versionName='1.0'
Could you please upload a fixed version, and keep numbers in sync? Thanks in advance!
Hello,
when i o camera it show mirror image.
i need to show it as it is no need to mirror it.
Please give me some solution for this issue
thanks in advance.
Can you help me with landscape mode? I am trying to modify your source code, but nothing comes
I want to apply my custom filters like Vignette, GrayScale, Blur, Blue Mess and many more, how can i achieve using your code.?
How can I save the preview as a video?
Hi,
After lots of time trying to find a camera preview approach for fast video processing, this one seems the best.
Our goal is to
Could you please help us finding the fastest way to achieve the 2nd and 4th steps ?
I rilly like the EmInterference, and would like to create another type of this which instead of green tone, will be yellow or red tones e.t.c as well as the "Contrast Filter", how can i go about this please. Thanks for the anticipated support :)
hi ,thanks so much for this greate work, i have a question there's any way to apply the filters in image seleted from gallery
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.