Black and white banding around image


#1

When I take an image I’m seeing black-and-white banding around the top and bottom of it in the image thumbnail and dialog. In the thumbnail there are a few thicker black and white lines, and in the dialog there are many small black and white bands.

This was taken with a Samsung Galaxy S4. In an emulator there is no such banding.

Any idea what is going on?


#2

I get the same thing on my S4.

It doesn’t seem to like the best supported preview size reported back from the camera for some reason.

If I change the code to:

				Size s = getBestSupportedSize(parameters.getSupportedPreviewSizes(), width, height);
				s.width = 1440;
				parameters.setPreviewSize(s.width, s.height);

it works fine for me.


#3

I don’t have much to say about that other than that it’s very odd. :confused:

Honestly, we’re considering the idea of ditching the Camera chapters in future editions for this very reason. It is a tarpit of device-specific issues.


#4

Please don’t ditch it - if an app needs a picture it NEEDS a picture! Overcoming OEM issues cannot become a reason not to use device features like a camera! Overcoming them in a rational way is more in line with a BNR level of understanding don’t you think?

My Galaxy4 has the same issue. First the external SD issues now the camera - why does the world’s most popular android OEM and device have to have these issues?


#5

I am wondering if the 1440 “fix” has something to do with the size of the “TAKE” button or some other parameters not accounted for in the camera driver. Since it is in landscape mode the full 1920 pixels are not being used for preview since the button overlays some of them. Just a thought, or perhaps something else about the camera that needs to be accounted for?

WHat seems really weird to me is that the preview adjustment makes a difference - one would think the size selected for the setPictureSize call would make more of a difference in what is actually captured…


#6

Also found this article which I am trying to use to see if they have a better take - alvinalexander.com/java/jwarehou … java.shtml

It mentions a “centered” surfaceview for overcoming issues with preview sizes maybe diff aspect ratio of the device display - and I suspect this may be the issue on the S4. ANyone?

**

  • A simple wrapper around a Camera and a SurfaceView that renders a centered preview of the Camera
  • to the surface. We need to center the SurfaceView because not all devices have cameras that
  • support preview sizes at the same aspect ratio as the device’s display.
    */

#7

Hi,

Usually aspect raito of image-sensor is 4:3.
Recently, some devices offer feature taking wide picture of 16:9, and in that case, JPEG file has black bandings. (PNG doesn’t)

  • JPEG does not have transparent color, so it has to fill transparent part with some color and usually black color is used.

So, I recommend you to trim the bitmap image according to the aspect ratio of the selected size if necessary (usually only for 16:9) in either CrimeCameraFragment, CrimeFragment or PictureUtils.

Thanks,