Question

Hey all, weird question. My company has an application from another company that records an image taken by a camera connected via Ethernet. Their app is written in C++ and I've been trying to convert/hack it using Java.

I'm able to receive images, but the quality is not the same. The photo on top is from their app and the photo on bottom is from mine:

alt text

alt text

Any idea why those artifacts are showing up in my version of the app written in Java? It happens with both BMP and JPG images.

The way it works is just through sockets (both the C++ and Java versions)... a command is sent to capture an image and the camera responds by sending the data (bytes). I save a byte array then create a new BufferedImage from them:

// Create buffered image from bytes
image = ImageIO.read(new ByteArrayInputStream(imageBytes));

Thanks for any input or ideas.

Was it helpful?

Solution

Could it be a data type issue? What is the data format? (ints, shorts, unsigned shorts?)

OTHER TIPS

This looks like a palette problem, ie the numeric values of the individual pixels remain the same, but the table mapping those values onto actual RGB values may be messed up (actually, looking at the specific picture, it might even be that the source is BW and yours is color). My guess would be that the transmission is not the problem. Try sending a known bytestring to confirm that if you like, but I'd further concentrate on the image encoding.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top