<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Änderungen am TBitmap]]></title><description><![CDATA[<p>Ich lade ein Bitmap und will daran Änderungen vornehmen:<br />
Der erste Teil läd und zeigt das Bild:</p>
<pre><code class="language-cpp">void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap *Bitmap = new Graphics::TBitmap();
OpenPictureDialog1-&gt;Filter=&quot;Bitmap Files (*.bmp)|*.bmp&quot;;
        if (OpenPictureDialog1-&gt;Execute() )
          Graphics::TBitmap *Bitmap = new Graphics::TBitmap();
  try
  {
    Bitmap-&gt;LoadFromFile(OpenPictureDialog1-&gt;FileName );
    Canvas-&gt;Draw(150,10,Bitmap);
      }
  catch (...)
  {
    MessageBeep(0);
  }
  //delete Bitmap;
  //delete Bitmap2;

}
</code></pre>
<p>Der zweite Teil des Programm soll es es in Schwarz Weis umwandeln aber das haut noch nicht hin:</p>
<pre><code class="language-cpp">void binarize(Graphics::TBitmap *bitmap)
{

int THRESHOLD,WHITE,BLACK;
THRESHOLD=130;
WHITE=1;
BLACK=200;                                              // Binaraize every row in the image
  for (int row = 0; row &lt; bitmap-&gt;Height ; row++) {
    RGBQUAD * pixel = (RGBQUAD *) bitmap-&gt;ScanLine [row];
                                              // Binarize every pixel in each row
    for (int col = 0; col &lt; bitmap-&gt;Width; col++, pixel++) {

      if ((int)pixel-&gt;rgbRed &gt; THRESHOLD &amp;&amp; (int)pixel-&gt;rgbGreen &gt; THRESHOLD &amp;&amp;
            (int)pixel-&gt;rgbBlue &gt; THRESHOLD){ // If ablove the threshold
        pixel-&gt;rgbRed = WHITE;                // Set the pixel to be white
        pixel-&gt;rgbGreen = WHITE;
        pixel-&gt;rgbBlue = WHITE;
      }
      else{                                   // Otherwise the pixel is set to
        pixel-&gt;rgbRed = BLACK;                // black
        pixel-&gt;rgbGreen = BLACK;
        pixel-&gt;rgbBlue = BLACK;
      }
    }
  }

}
</code></pre>
<p>Was muss ich am zweiten Teil ändern??</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/140569/änderungen-am-tbitmap</link><generator>RSS for Node</generator><lastBuildDate>Mon, 03 Aug 2026 16:18:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/140569.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Mar 2006 18:20:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Änderungen am TBitmap on Wed, 15 Mar 2006 19:09:13 GMT]]></title><description><![CDATA[<p>Ich lade ein Bitmap und will daran Änderungen vornehmen:<br />
Der erste Teil läd und zeigt das Bild:</p>
<pre><code class="language-cpp">void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap *Bitmap = new Graphics::TBitmap();
OpenPictureDialog1-&gt;Filter=&quot;Bitmap Files (*.bmp)|*.bmp&quot;;
        if (OpenPictureDialog1-&gt;Execute() )
          Graphics::TBitmap *Bitmap = new Graphics::TBitmap();
  try
  {
    Bitmap-&gt;LoadFromFile(OpenPictureDialog1-&gt;FileName );
    Canvas-&gt;Draw(150,10,Bitmap);
      }
  catch (...)
  {
    MessageBeep(0);
  }
  //delete Bitmap;
  //delete Bitmap2;

}
</code></pre>
<p>Der zweite Teil des Programm soll es es in Schwarz Weis umwandeln aber das haut noch nicht hin:</p>
<pre><code class="language-cpp">void binarize(Graphics::TBitmap *bitmap)
{

int THRESHOLD,WHITE,BLACK;
THRESHOLD=130;
WHITE=1;
BLACK=200;                                              // Binaraize every row in the image
  for (int row = 0; row &lt; bitmap-&gt;Height ; row++) {
    RGBQUAD * pixel = (RGBQUAD *) bitmap-&gt;ScanLine [row];
                                              // Binarize every pixel in each row
    for (int col = 0; col &lt; bitmap-&gt;Width; col++, pixel++) {

      if ((int)pixel-&gt;rgbRed &gt; THRESHOLD &amp;&amp; (int)pixel-&gt;rgbGreen &gt; THRESHOLD &amp;&amp;
            (int)pixel-&gt;rgbBlue &gt; THRESHOLD){ // If ablove the threshold
        pixel-&gt;rgbRed = WHITE;                // Set the pixel to be white
        pixel-&gt;rgbGreen = WHITE;
        pixel-&gt;rgbBlue = WHITE;
      }
      else{                                   // Otherwise the pixel is set to
        pixel-&gt;rgbRed = BLACK;                // black
        pixel-&gt;rgbGreen = BLACK;
        pixel-&gt;rgbBlue = BLACK;
      }
    }
  }

}
</code></pre>
<p>Was muss ich am zweiten Teil ändern??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1017011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017011</guid><dc:creator><![CDATA[Carpe Noctum]]></dc:creator><pubDate>Wed, 15 Mar 2006 19:09:13 GMT</pubDate></item><item><title><![CDATA[Reply to Änderungen am TBitmap on Thu, 16 Mar 2006 07:33:40 GMT]]></title><description><![CDATA[<p>du kannst kein Farbbild in ein Binärbild umwandeln. Mach dazu nen Umweg über ein Graubild und berechne den Grauwert eines jeden Pixels, z.b nach Intensität G = (R + G + <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f60e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--smiling_face_with_sunglasses"
      title="B)"
      alt="😎"
    /> / 3. Kannst natürlich auch eine gewichtete Berechnung (entspricht mehr dem menschlichen Sehen) machen, z.b: G = ((77 * R) + (151 * G) + (28 * B)) &gt;&gt; 8;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1017253</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017253</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Thu, 16 Mar 2006 07:33:40 GMT</pubDate></item><item><title><![CDATA[Reply to Änderungen am TBitmap on Thu, 16 Mar 2006 10:39:18 GMT]]></title><description><![CDATA[<p>Und wie soll das Codemaessig ungefaehr aussehen?<br />
Ich bin mir naemlich nicht sicher ob ich das TBitmap richtig anspreche. Warum kann ich das Bildeigentlich nicht direkt in ein SchwarzWeis Bild umwandeln ? Ich frage jeden Bildpunkt ab und wenn er hoher als den Threshold Wert ist setzt ich den Pixel auf schwarz und ansonsten auf weiss?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1017383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017383</guid><dc:creator><![CDATA[Carpe Noctum]]></dc:creator><pubDate>Thu, 16 Mar 2006 10:39:18 GMT</pubDate></item><item><title><![CDATA[Reply to Änderungen am TBitmap on Thu, 16 Mar 2006 12:17:09 GMT]]></title><description><![CDATA[<p>hab doch geschrieben wie das aussehen muss! der grauwert ist der wert, den du gegen den schwellwert testen musst.</p>
<pre><code class="language-cpp">if (GrayValue &gt; Threshold)
{
  R = 255; // weiß
  G = 255; // weiß
  B = 255; // weiß
}
else
{
  R = 0; // schwarz
  G = 0; // schwarz
  B = 0; // schwarz
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1017445</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017445</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Thu, 16 Mar 2006 12:17:09 GMT</pubDate></item><item><title><![CDATA[Reply to Änderungen am TBitmap on Sat, 18 Mar 2006 16:11:56 GMT]]></title><description><![CDATA[<p>Das war mir schonklar ich meinte eigentlich wie du das mit dem Grauwert machst?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1019137</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1019137</guid><dc:creator><![CDATA[Carpe Noctum]]></dc:creator><pubDate>Sat, 18 Mar 2006 16:11:56 GMT</pubDate></item><item><title><![CDATA[Reply to Änderungen am TBitmap on Wed, 22 Mar 2006 08:03:27 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">typedef unsigned char u_char;

for (int row = 0; row &lt; bitmap-&gt;Height ; row++) 
{ 
  // RGBQUAD geht natürlich nur bei 32Bit Bildern!
  RGBQUAD *pixel = (RGBQUAD*) bitmap-&gt;ScanLine[row];

  // Binarize every pixel in each row
  for (int col = 0; col &lt; bitmap-&gt;Width; col++, pixel++) 
  {
    u_char Gray = ((77 * pixel-&gt;rgbRed) + (151 * pixel-&gt;rgbGreen) + (28 * pixel-&gt;rgbBlue)) &gt;&gt; 8;

    // If ablove the threshold
    if (Gray &gt; THRESHOLD)
    { 
        pixel-&gt;rgbRed   = 255;                // Set the pixel to be white
        pixel-&gt;rgbGreen = 255;
        pixel-&gt;rgbBlue  = 255;
      }
      else{                                   // Otherwise the pixel is set to
        pixel-&gt;rgbRed   = 0;                // black
        pixel-&gt;rgbGreen = 0;
        pixel-&gt;rgbBlue  = 0;
      }
    }
  }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1021475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1021475</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Wed, 22 Mar 2006 08:03:27 GMT</pubDate></item></channel></rss>