Generating and saving images of characters

This forum is for eXpress++ general support.
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Generating and saving images of characters

#41 Post by Eugene Lutsenko »

rdonnay wrote:
what i mean : what is this good for ... ? why not store Bitmap into BLOB ? (same Result on Screen)
Eugene needed the pixel information in a 2-dimensional array that stores RGB colors as array elements.
He finds that it is easier to manipulate the data in an array that is representative of the image. I would tend to agree. Tweaking a color of a pixel would be simple.

Example:

Pixel 234/456 would be represented as aPixel[234,456].
The color would be a 3-element array.

aColor := aPixel[234,456]

aColor[1] += 10
aColor[2] += 10
aColor[3] += 10

This can be done before saving the array or restoring the array from the database. The image can then be repainted with TransferImage() or it can be saved to the database.
Hi, Roger!

I really, as you say, I would like to be able to change the image. Something I did. For example, I was able to make contouring. Obtain and determine the minimum sufficient rectangular image area.

I wanted to use your example that you brought up, and try to change the brightness and contrast of the image. I wrote a function (shown below). Everything works. But it looks like something more difficult than in your example.

Code: Select all

FUNCTION LightImage( hDC1, hDC2, aPixel )

LOCAL i, j, nColor, lEmptyArray := aPixel[1,1] == nil, ;
      nXSize := Len(aPixel), nYSize := Len(aPixel[1])

D = 10  // Шаг изменения яркости при одном нажатии

FOR i := 0 TO nXSize-1
    FOR j := 0 TO nYSize-1

        IF lEmptyArray
           nColor = GetPixel(hDC1,i,j)
        ELSE
           nColor = aPixel[i+1,j+1]
        ENDIF

        nColor = AutomationTranslateColor(nColor, .t.)

*       DC_DebugQout(nColor)

        IF GraIsRGBColor(nColor)
         
           aRGB = GraGetRGBIntensity(nColor)

*          DC_DebugQout(nColor, aRGB[1], aRGB[2], aRGB[3] )

           aRGB[1] = IF(aRGB[1]+D < 255, aRGB[1]+D, 255 )
           aRGB[2] = IF(aRGB[2]+D < 255, aRGB[2]+D, 255 )
           aRGB[3] = IF(aRGB[3]+D < 255, aRGB[3]+D, 255 )

           aPixel[i+1,j+1] := AutomationTranslateColor(GraMakeRGBColor(aRGB),.f.)

           SetPixel(hDC2,i,j,aPixel[i+1,j+1])

        ENDIF
    NEXT
NEXT

RETURN nil
[/size]

I'm using the sample charts Roger master the different operations with images. Here is what is at the moment:
http://lc.kubagro.ru/Dima/DC_Graph9.zip
http://lc.kubagro.ru/Dima/a.doc (The universal cognitive analytical system 'Aidos')

Of course, there is still a lot of questions. For Example:
- I would like to be able to know not only the coordinates of the mouse, but also depressed there any mouse button (left or right);
- How to save a rectangular region of the image, given the coordinates, not in an array, but simply as an image file to disk;
- The use of standard graphics operations in Alaska along with the graphics in the style of Roger (accordingly, I understand a little like).

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Generating and saving images of characters

#42 Post by Auge_Ohr »

Eugene Lutsenko wrote:For example, I was able to make contouring.
normal you do this with a Image and API Function ...
Eugene Lutsenko wrote:Obtain and determine the minimum sufficient rectangular image area.
why you need this ?
while you Demo use Font ... it depends on "proportional" or "non-proportional" Font ( oFont:Fixed )
using Truetype Font, like M$ ArialUNI.TTF, does not give "real" Raster Grafik while it use Cleartype which use aliasing with GraStringAt() ( see PDR 6314 )
Eugene Lutsenko wrote:... and try to change the brightness and contrast of the image.
to change alpha, hue, saturation or brightness you need ARGB Value.

Code: Select all

	R — the red component (0-255)
	G — the green component (0-255)
	B — the blue component (0-255)
	A — the alpha component (0-255, 255 by default) 
Questioen : do you talk about
HSL (hue, saturation and lightness)
HSV (hue, saturation and value )
HSB (B for brightness)
HSI (hue, saturation and intensity )

search on Wikipedia how to convert RGB to HS*
greetings by OHR
Jimmy

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Generating and saving images of characters

#43 Post by Eugene Lutsenko »

Hi, Jimmy!

1. I understand that the delineation did very, very primitive. I know that in fact it is not completely solve the problem. I have seen numerous scientific papers discussing how to do it. I myself have several new scientifically options to improve the algorithm, which are not found in the literature. But all this is for the future. It is necessary to get a working version, and only then improve it. Immediately raise very large reservoir, I can not. This is not my work, for which I am paid and for failure to which I was punished. Now I leave, and I did a weekend doing urgent and Extremely urgent task to work. For failure of such jobs at the University has sacked a number of deans and heads of departments. Using the API, I would really, really wanted to learn. Perhaps you will help me in this.

2. Images of characters of different sizes and fonts, I used only for debugging and training purposes. Maybe this will be useful and offered me to illustrate the methods in this article. These modes are used not only for the analysis of character images. And this is not the main purpose of them. I want to use these methods to identify objects in their images with generalized categories (classes). Offered me image analysis techniques based on information theory. I see an image of the object as a noisy message generalized categories to which this object belongs. For example the image of elderly man http://www.kubsau.ru/education/chairs/c ... taff/3965/ (I currently) can be identified by the system as my old man of a certain nationality, as a professor, as a grandfather .

3. Experiments with the brightness and contrast of images are interesting to me is not to improve their design and to improve the reliability of the identification. I'm in this direction has not moved significantly forward. The only thing that I realized that the apparently most informative are the internal and external contours (reflecting local variations in brightness and color). That's why I wrote the article: http://ej.kubagro.ru/2015/06/pdf/09.pdf. (In this article there is a reference to my other articles associated with image analysis). Here is a serious article in English: http://ej.kubagro.ru/2015/06/pdf/102.pdf. This article is about the work carried out by a system developed by Eidos me and my mathematical model. This article is also connected with the analysis of images reflecting global climate change. All of this I call: "The automated system-cognitive analysis of the images."

4. Automated system-cognitive analysis - a new innovation (ready for implementation) method of artificial intelligence, which I proposed in 2001-2002. Eidos But the system has been developed much earlier (the first version). Already in 1987 he was received acts on the implementation of the work, done with it: http://ej.kubagro.ru/2009/10/pdf/04.pdf. Then I worked on computers Wang-2200C and it was done to them.


Привет, Джимми!

1. Я понимаю, что сделал оконтуривание весьма и весьма примитивно. Я знаю, что на самом деле это не до конца решенная проблема. Я видел многочисленные научные работы, обсуждающие как это лучше сделать. У меня самого есть еще несколько новых в научном плане вариантов улучшения алгоритма, которые не встречаются в литературе. Но все это на будущее. Надо получить работающий вариант, а уже потом его улучшать. Сразу поднять очень большой пласт я не в состоянии. Это не является моей работой, за которую мне платят и за невыполнение которой меня наказывают. Сейчас у меня отпуск, а я даже в выходные дни выполняю срочные и сверхважные задания по работе. За невыполнение подобных заданий в университете уже сняли с должности несколько деканов и заведующих кафедрами. Использование API я бы очень и очень хотел освоить. Может быть Вы в этом мне поможите.

2. Изображения символов разных размеров и шрифтов я использовал только для отладки и учебных целей. Может быть это пригодится и для иллюстрации предлагаемых мной методов в статье. Эти режимы используются не только для анализа изображений символов. И это вообще не является основным их назначением. Я хочу использовать эти методы для идентификации объектов по их изображениям с обобщенными категориями (классами). Предлагаемые мной методы анализа изображений основаны на теории информации. Я рассматриваю изображение объекта как зашумленное сообщение об обобщенных категориях, к которым этот объект относится. Например изображение мужчины пожилого возраста http://www.kubsau.ru/education/chairs/c ... taff/3965/ (это я в настоящее время) может быть идентифицировано моей системой как пожилой мужчина определенной национальности, как профессор, как дедушка.

3. Эксперименты с управлением яркостью и контрастностью изображений мне интересны не для улучшения их дизайна, а для улучшения достоверности их идентификации. Я в этом направлении еще не продвинулся заметно вперед. Единственное, что я понял, что по-видимому наиболее информативными являются внешние и внутренние контуры (отражающие локальные изменения яркости и цвета). Поэтому я и написал статью: http://ej.kubagro.ru/2015/06/pdf/09.pdf. (В этой статье есть ссылки на другие мои статьи, связанные с анализом изображений). Вот еще серьезная статья на английском языке: http://ej.kubagro.ru/2015/06/pdf/102.pdf. Это статья о работе, проведенной с помощью разработанной мной системы Эйдос и моей математической модели. Эта статья тоже связанна с анализом изображений, отражающих глобальные климатические изменения. Все это я называю: "Автоматизированный системно-когнитивный анализ изображений".

4. Автоматизированный системно-когнитивный анализ - это новый инновационный (готовый к внедрению) метод искусственного интеллекта, который я предложил в 2001-2002 годах. Но система Эйдос была разработана значительно раньше (первые версии). Уже в 1987 году был получены акты внедрения на работы, выполненную с ее помощью: http://ej.kubagro.ru/2009/10/pdf/04.pdf. Тогда я работал на компьютерах Wang-2200C и это было сделано на них.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Generating and saving images of characters

#44 Post by Eugene Lutsenko »

Thank you for your help. Some results are described in the article:
http://ej.kubagro.ru/2015/07/pdf/19.pdf

Post Reply