LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   image decoding (https://www.linuxquestions.org/questions/linux-newbie-8/image-decoding-640200/)

pjpunnoose 05-06-2008 01:16 AM

image decoding
 
how do i recognise a character that is embedded on a .jpeg or an mpeg file
hoping that somebody will give me a correct answer
punnoose

Simon Bridge 05-06-2008 01:21 AM

Quote:

hoping that somebody will give me a correct answer
"correct"?? Is this homework?

Quote:

how do i recognise a character that is embedded on a .jpeg or an mpeg file
Depends on how the character was embedded.

pjpunnoose 05-06-2008 01:32 AM

this is a work given to me by my company. i haveto decode a character given at a particular location on the screen how do i decode that
with regards
punnoose

Simon Bridge 05-06-2008 01:55 AM

Depends on how the character was encoded.

Sounds like a test. You employers want to know if you have the knowledge to figure this out? In which case, you need to understand character encoding and image formats.

For eg. a way to add a character to a bitmap would be to replace a particular pixel value with the character's ascii value. In the picture, it would appear as a single wrong pixel, lost in a high-res image.

You could extract it by zooming in on the image (without anti-aliasing) until individual pixels are visible, then using a color picker tool.

A more common way is to xor the string, suitably padded, to the binary of the image. You extract the plaintext with xor and the unadulterated image.

It is also possible to create a bitmap of the character at a suitable resolution - then odd it to the bitmap image, then compress the image. Nasty as jpeg compression is lossy.

My point here is that there are lots of ways of getting text into another file (image file in this case). If you have not been told how, then you will have to use your native wit, and your knowledge of the resources available to the people who made the image, to figure it out.

brianmcgee 05-06-2008 03:18 AM

http://en.wikipedia.org/wiki/Optical...er_recognition

Simon Bridge 05-06-2008 06:00 AM

Quote:

Originally Posted by brianmcgee (Post 3144272)

Exactly - are we talking about a character drawn in the image at a particular x-y location - in that sence "embedded" or one of the other myriad methods available?

More information is needed.

pjpunnoose 05-06-2008 10:12 PM

how do i encode this using coding in c++ please help me
with
pjpunnoose

Simon Bridge 05-07-2008 01:43 AM

Please answer the questions in the previous responses.

If I use my previous example of adding a string to a bitmap - you will notice that the string is just a row of numbers, and so is the bitmap. In the bitmap, the numbers represent color values while in the string the numbers represent characters.

The exact meaning of the numbers depends on how the characters/colors are encoded. Maybe the colors are HSV, maybe the characters are utf8? Whatever.

Normally an image will have some metadata at the start - this will depend on the actual encoding of the image. Typically, the metadata will say how wide hde image is and what the color encoding is. If the metadata of the image occupies the first N bytes, and the string has S bytes, then you can substitute the bytes of the string for the bytes of thu image starting at byte N+1 and ending at N+S.

So, you need to study character and image encoding methods. You need to find the C++ instructions for manipulating binary files. Then you will have your solution.

Another alternative would be to write out your string as a bitmap - in a painting program, for eg. Then you can just xor the two bitmaps together.

Z = Img xor Str

In which case, you just need to know how to do an xor operation in C++

Good luck.


All times are GMT -5. The time now is 08:08 PM.