Peter-St / Android-UVC-Camera

GNU Lesser General Public License v2.1
132 stars 24 forks source link

Saving image with error #42

Open MustafaErkinDal opened 5 months ago

MustafaErkinDal commented 5 months ago

Hi,

I am using Pure Thermal 2 Flir 3.5. I have no problems with camera stream. However, when I save an image it saves in wrong colors (purple and green) with stripes on it. I am using Android Studio. Have you ever face such a problem ? Am I doing something wrong ?

Thanks in advance.

IMG_4565

My settings are:

Packets Per Request = 4 Active Urbs = 4 AltSetting = 1 Maximal Packet Size = 642 Videoformat = YUv2 Camera Format Index = 1 Camera Framelndex = 1 Image Width = 160 Image Height = 120 Camera Frame Interval (fps) = 9 UVC Values: bUnitID = 0 bTerminaliD = 0 bcdUVC = 1.00 LibUsb = true

Peter-St commented 5 months ago

Hoi Mustafa,

I noticed that in the method 'PreviewPrepareStream' in the 'uvc_support.cpp' file there is the part for YUV video format missing (in line 98 - 102). I think that was because YUV is not that often much in use. I will fix it in the next couple of days (depends on the time I have) and then come back to you to test it.

Wish you a happy carnival,

Peter

Peter-St commented 4 months ago

You need to change your Videoformat to UYVY. Do so and report if it worked.

MustafaErkinDal commented 4 months ago

Hello Peter,

I changed the format to UYVY as you said but sadly it did not work. If you may look at the StartIsoStreamActivityUvc.java file line 1302 it is like the following screenshot

ssforpeter

I assume UYVY format is purposely out of use. I tried adding "PreviewPrepareStream(mNativePtr, mPreviewSurface, new IFrameCallback()..." method, copying from other formats code, but I could not see the camera stream. If you have any other suggestions I will be appreciated.

Peter-St commented 4 months ago

Hoi,

Your hints were right and I made some changes to solve the issue. Can you plz update your repo and test out the stream again. Thx, Peter