开发者

Artifacts when receiving image from camera in Java

开发者 https://www.devze.com 2023-01-13 16:09 出处:网络
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

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:

Artifacts when receiving image from camera in Java

Artifacts when receiving image from camera in Java

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 J开发者_开发知识库ava 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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消