Re: mapping a pixel to a character
- From: jg.campbell.ng@xxxxxxxxx
- Date: 27 Jan 2006 10:11:07 -0800
j0mbolar wrote:
> I have access to the pixels of an image in grayscale.
> I would like to map each pixel to a character.
> I have 64 characters arranged in order based on
> their densities. What is a technique that would
> perform this kind of mapping?
>
> There are also 24 bits per pixel and 3 bytes per
> pixel.
>
>>From section 4.5 of:
http://www.jgcampbell.com/ip/ip4.txt
Your input image is f1. Suppose, a<=f1(x,y)<=b, i.e. the range of f1()
is [a,b], and you
want the range mapped to z0<=z'<=G, then the transformation is
(4.5-2) z'= (zG-z0).(z-a)/(b-a) + z0
= (zG-z0).z/(b-a) + (z0.b-zG.a)/(b-a)
scale shift
Your [a, b] is [0, 63]; round or truncate the value to an integer and
you have an index into a character array -- i.e. put the grey level
characters in an array. If you want, I have some very kludgy C code
that prints an image as a page of characters; but I could never find
more than ten suitable. On a line printer, one could do overstrike, so
i think i managed 24 grey levels with that.
Assuming that is what you mean. Initially I thought OCR was your goal.
Best regards,
Jon C.
.
- References:
- mapping a pixel to a character
- From: j0mbolar
- mapping a pixel to a character
- Prev by Date: Re: Please use wxWidgets
- Next by Date: linux persistent c application with http protocol?
- Previous by thread: Re: mapping a pixel to a character
- Next by thread: Double Linked List start Help
- Index(es):
Relevant Pages
|