1

I am capturing jpegs from my ip camera and I convert it to a byte array and then I invoke a web service and upload those bytes.

When I convert that byte array back to a jpeg and render it I notice that sometimes the image quality has deteriorated.

I have used the encoder quality on varying scales but still get some loss of quality.

Is there an alternative to a byte array that will ensure image quality?

I could post the code but it is generic and I want to focus on alternative ways to upload an image but with low as possible byte array size and as quickly as possible.

2 Answers 2

2

You should perform some test with a given fixed image.

The flow actually isCamera => JPEG => byte array ~> byte array -> JPEG -> screen.

  • Where => arrows are camera side.
  • Where ~> arrow is the network.
  • Where -> arrows are PC side.

JPEG => byte array ~> byte array -> JPEG Have to be loss-less and should be tested.

Network connection handle only byte array, that it. So the alternative are on the compression algorithm. Maybe you should look at video compression algorithm (witch use previous images to encode new ones, and have much more better result).

But your IP camera have to handle it :o(

Sign up to request clarification or add additional context in comments.

5 Comments

Hi, thanks for your time. Yes, I have performed exhaustive tests :) this is why I have discerned that passing jpegs via conversion to byte array and back can lead to loss of quality. I have also looked at video compression but will give me an unacceptable lag in stream unfortunately. I too think compression algorithm is the only option I have left to play with. I lived in hope by positing the original question :)
You say that "[you] have discerned that passing jpegs via conversion to byte array and back can lead to loss of quality". It surprises me a lot, you should have the exact same data. I will test JPEG0 => byteArray0 => JPEG1 => byteArray1 flow and compare byteArray0 to byteArray1. They have to be the same...
Hi, sorry for delay - get coffee. The drop in quality is occurring when the jpeg is converted to stream- byte array.
That means the all-ready data-loose-compressed jpeg is data-loose-compressed again when converted to byte array ... ?!? It's more likely that the jpeg compression occurs when the image (not jpeg) is converted to stream. Anyway good luck to find the issue.
Hi, to get a byte array I need to convert to stream. So, whatever why you look at it there is a slight deterioration in quality in converting to byte array before uplaod to my wcf. Hence, my problem i originally posted. I should add this affects low saturation and redish colors..
2

I have always used byte array and never had an issue with it. if there is a data loss, the image should be corrupted.

there is no other way to send the image via webservice. I believe you should check your network and see if everything is ok with your network.

3 Comments

Hi, I have seen posts that there is a slight disruption to quality of jpegs. I have tested locally on my own network and I see the same results so it is not a network issue. The image is not corrupted. I will add this quality loss affects the red spectrum. Thanks for your input though - much appreciated :)
But, you have confirmed that I have to use a byte array
Thanks for the information, I will pay more attention to it. I might had the same problem but never realized it, maybe.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.