ndk-samples icon indicating copy to clipboard operation
ndk-samples copied to clipboard

sample camera has no button

Open francoisnicolas opened this issue 7 years ago • 4 comments

Hello, I have compiled the camera sample on my galaxy A8 2018. There is no button on the screen in order to capture an image. There is just the video view.

The procedure 👍 public void EnableUI(final long[] params) (line 274 of CameraActivity.java) is never called (detected by the Android studio compiler)

Sincerely, F.NICOLAS

francoisnicolas avatar Mar 31 '19 14:03 francoisnicolas

could it be that this phone does not support Camera2? Probably check on this line to see what you got on that phone: https://github.com/googlesamples/android-ndk/blob/master/camera/basic/src/main/java/com/sample/camera/basic/CameraActivity.java#L134

ggfan avatar Apr 01 '19 20:04 ggfan

Hello,

It never pass through this line of code. I add a break point, and the program doesn't go at this line. I added break points elsewhere, and the program stop at these break points.

The capture preview is very strange. I have the impression of distorition of the image (view) when I move the camera. As if the program was in late, capture a part of the scene, and another part, and combine the image.

Look at this program, it works well : https://github.com/hyl87/CameraView-1#capturing-images

perhaps it's a fork of your software, the view is normal. You can add record of image and video, the procedure are in the code, just add a call.

Actually, I try to use this software in order to capture and analyse in real time images (full HD images 1920x1080). The software give me the image as a jpg for each frame coming from the camera, then It converts it in RGB8888. It takes about 120ms on my phone.

I tried to capture all the screen showing the preview, it takes about 40ms. Unfortunatly, google has removed the call to 😂

v1.setDrawingCacheEnabled(true); Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache()); v1.setDrawingCacheEnabled(false);

in compileSdkVersion = 28 (with graddle > 3.3)

So in the image there is just the screen containing the buttons.

If android can show the camera preview image at a good rate,

it could be also possible get the raw data (RGB8888) of the image at a good rate (better than 100 ms) from the GPU.

There is an other function :

PixelCopy.request(...)

But I don't know how to write the code for the parameter : PixelCopy.OnPixelCopyFinishedListenerhttps://developer.android.com/reference/android/view/PixelCopy.OnPixelCopyFinishedListener.html listener, Handlerhttps://developer.android.com/reference/android/os/Handler.html listenerThread)

If you have solutions, it would be interesting to publish an article on this subject, as many software enginners, working on vision in real time would be interested, and spend too much time to find the solutions.

It would be interesting also that camera provides RGB8888 data directly through the GPU (for conversion), and also HSV, as it's better for analysing image.

Sincerely,

F.NICOLAS


De : Gerry [email protected] Envoyé : lundi 1 avril 2019 22:02 À : googlesamples/android-ndk Cc : francoisnicolas; Author Objet : Re: [googlesamples/android-ndk] sample camera has no button (#634)

could it be that this phone does not support Camera2? Probably check on this line to see what you got on that phone: https://github.com/googlesamples/android-ndk/blob/master/camera/basic/src/main/java/com/sample/camera/basic/CameraActivity.java#L134

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/googlesamples/android-ndk/issues/634#issuecomment-478725280, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASumxan1JY8_6iKs6G4AaqPoY58f-Dj0ks5vcmXbgaJpZM4cUU46.

francoisnicolas avatar Apr 02 '19 08:04 francoisnicolas

thank you very much for your suggestions! I will pass the info to the camera experts here.

The sample you referred is from Java side; distortion from this sample would coming from the surface view of java side though, from native side, the image is raw from camera, will not distort ( it is displaying portion of logic -- scaling part of this sample needed to be revisited). If I get chance, I would get a similar phone to try it out ( will see: too tied with other things ).

ggfan avatar Apr 02 '19 15:04 ggfan


De : Francois Nicolas [email protected] Envoyé : mardi 2 avril 2019 18:48 À : googlesamples/android-ndk Objet : RE: [googlesamples/android-ndk] sample camera has no button (#634)

Today, I have found the source of a very good App which will be interesting for starting a project for capturing frame in real time : https://github.com/ManuelSchmitzberger/visor-android

https://play.google.com/store/apps/details?id=de.visorapp.visor [https://lh3.googleusercontent.com/iRZU9hEkbHw3H04BSAEVIWqtHeXy6dfpKtKj2U0aMr4UMauHoLgFis2v_tpUqejtA_E]https://play.google.com/store/apps/details?id=de.visorapp.visor

visor - low vision magnifier - Apps on Google Playhttps://play.google.com/store/apps/details?id=de.visorapp.visor Enlarge difficult to read text by 3 magnification levels and change contrast to 5 different viewing modes. Optionally, turn on the LED flash of your device to help you see better in low-light conditions. Visor supports VoiceOver with TalkBack in German and English. During the day, there is a lot printed text to read: restaurant menus, price tags, the newspaper, letters or photos from your loved ones — visor zooms and improves the contrast of whatever you want to see. Its advanced color modes and simple interface are made for giving you the best possible perception of printed text on your screen like you'd expect it from a handheld electronic magnifier. ‣ 3 magnification levels The 3 magnification levels of visor are easily accessible anytime with the touch of a button. After closing the app, visor remembers the last selected magnification level and contrast mode. ‣ 5 different color modes Many visually impaired people suffer from dazzling effects when reading dark characters on a light background. Visor play.google.com

Press the stop button ( || ) , then a capture button appears. It takes only about 40 ms for getting the raw data in RGB of the frame. You open the picture in the viewer, and start again. (A little bug, if you don't open the picture, the next time, when you capture, the preview mode is still active, and the capture is black -> I will read the source tomorrow in order to find the bug).

I send you a zip containing information about a bug in the NDK (or compiler) : add some files missing in new version of NDK. Read the file : How to resolve “No toolchains found in the NDK toolchains folder for ABI with prefix…html " You can compile only because the graddle version is low.

I have found a video explaining RendserScript : https://www.youtube.com/watch?v=kybZnFQh6fE (I know a little cuda on windows, it's the same principle) So if we combine the two software, we can grab and transform FULL HD images in HSV in less than 100 ms. [https://www.bing.com/th?id=OVP.p1oGRUXnwtZhXjln2enm7AEsDh&pid=Api]https://www.youtube.com/watch?v=kybZnFQh6fE

Using RenderScript in Android Studio in 8 minhttps://www.youtube.com/watch?v=kybZnFQh6fE This shows how to develop an Android app that uses RenderScript in Android Studio. It goes from "New Project" to running in an emulator. Discuss on G+ RenderScript ... www.youtube.com

The source in attached files : rssimple


De : Gerry [email protected] Envoyé : mardi 2 avril 2019 17:39 À : googlesamples/android-ndk Cc : francoisnicolas; Author Objet : Re: [googlesamples/android-ndk] sample camera has no button (#634)

thank you very much for your suggestions! I will pass the info to the camera experts here.

The sample you referred is from Java side; distortion from this sample would coming from the surface view of java side though, from native side, the image is raw from camera, will not distort ( it is displaying portion of logic -- scaling part of this sample needed to be revisited). If I get chance, I would get a similar phone to try it out ( will see: too tied with other things ).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/googlesamples/android-ndk/issues/634#issuecomment-479056856, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASumxf89U5wZO9Y7SzKUKfWtk1ow7Uy3ks5vc3mdgaJpZM4cUU46.

francoisnicolas avatar Apr 02 '19 16:04 francoisnicolas

Was working fine earlier today, so presumably was fixed sometime between now and then. lmk if you're still seeing the problem.

DanAlbert avatar May 03 '24 23:05 DanAlbert