<?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[Speichrezugriff auf Bilddaten]]></title><description><![CDATA[<p>Hallo, und zwar versuch ich gerade ein Bild auszulesen: Ich erhalte erfolgreich die einen Pointer auf einen 24 Bit speicher:</p>
<p>Bilddaten:<br />
Type: BMP<br />
Größe: 2x5<br />
Farbe: alle Pixel sind rot (255,0,0)</p>
<p>Vielleicht findet jemand von euch einen Fehler?</p>
<pre><code>for( int y=0; y &lt; (int)dwCompareHeight; y++ )
{
	for( int x=0; x &lt; (int)dwCompareWidth; x++ )
	{
		if( _srcBitsPerPixel == 24 )
		{
			BYTE *bytePixelSrc = &amp;((BYTE*)lpSrcBits)[y*_srcWidthBytes+x*(_srcBitsPerPixel/8)];

			BYTE b = bytePixelSrc[0];
			BYTE g = bytePixelSrc[1];
			BYTE r = bytePixelSrc[2];
			printf( &quot;\n %i, %i, %i&quot;, r, g, b);
		}

	}//for
}//for
</code></pre>
<p>Resultat:</p>
<pre><code>255, 0, 0
 255, 0, 0
 0, 0, 255
 0, 0, 255
 0, 255, 0
 0, 255, 0
 255, 0, 0
 255, 0, 0
 205, 205, 205
 205, 205, 205
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/184492/speichrezugriff-auf-bilddaten</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 18:04:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/184492.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 15 Jun 2007 18:29:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Speichrezugriff auf Bilddaten on Fri, 15 Jun 2007 18:29:10 GMT]]></title><description><![CDATA[<p>Hallo, und zwar versuch ich gerade ein Bild auszulesen: Ich erhalte erfolgreich die einen Pointer auf einen 24 Bit speicher:</p>
<p>Bilddaten:<br />
Type: BMP<br />
Größe: 2x5<br />
Farbe: alle Pixel sind rot (255,0,0)</p>
<p>Vielleicht findet jemand von euch einen Fehler?</p>
<pre><code>for( int y=0; y &lt; (int)dwCompareHeight; y++ )
{
	for( int x=0; x &lt; (int)dwCompareWidth; x++ )
	{
		if( _srcBitsPerPixel == 24 )
		{
			BYTE *bytePixelSrc = &amp;((BYTE*)lpSrcBits)[y*_srcWidthBytes+x*(_srcBitsPerPixel/8)];

			BYTE b = bytePixelSrc[0];
			BYTE g = bytePixelSrc[1];
			BYTE r = bytePixelSrc[2];
			printf( &quot;\n %i, %i, %i&quot;, r, g, b);
		}

	}//for
}//for
</code></pre>
<p>Resultat:</p>
<pre><code>255, 0, 0
 255, 0, 0
 0, 0, 255
 0, 0, 255
 0, 255, 0
 0, 255, 0
 255, 0, 0
 255, 0, 0
 205, 205, 205
 205, 205, 205
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1306787</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1306787</guid><dc:creator><![CDATA[Jimmy0]]></dc:creator><pubDate>Fri, 15 Jun 2007 18:29:10 GMT</pubDate></item><item><title><![CDATA[Reply to Speichrezugriff auf Bilddaten on Fri, 15 Jun 2007 18:40:22 GMT]]></title><description><![CDATA[<p>Hab den Fehler:</p>
<pre><code>BYTE *bytePixelCmp = &amp;((BYTE*)lpCmpBits)[(y*_cmpWidth+x)*(_cmpBitsPerPixel/8)];
BYTE *bytePixelSrc = &amp;((BYTE*)lpSrcBits)[(y*_srcWidth+x)*(_srcBitsPerPixel/8)];
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1306803</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1306803</guid><dc:creator><![CDATA[Jimmy0]]></dc:creator><pubDate>Fri, 15 Jun 2007 18:40:22 GMT</pubDate></item><item><title><![CDATA[Reply to Speichrezugriff auf Bilddaten on Fri, 15 Jun 2007 20:15:00 GMT]]></title><description><![CDATA[<p>Hi, leider fehlt hier eine kleinigkeit, die ich nicht gebacken bekomme:</p>
<p>Ich muss schauen dass ich die Zeile an die &quot;richtige&quot; Zeilenbreite anpasse. Oft ist es so, dass die Breite des Daten größer ist, als die Breite des eig. BIldes.</p>
<p>Das ist hier sicher der Fall - ich kann leide rnoch nicht sagen wie ich das bewerkstelligen kann:</p>
<pre><code>BYTE *bytePixelSrc = &amp;((BYTE*)lpSrcBits)[y*_srcWidthBytes+(x*(_srcBitsPerPixel/8))];
BYTE *bytePixelCmp = &amp;((BYTE*)lpCmpBits)[y*_cmpBitsPerPixel+(x*(_cmpBitsPerPixel/8))];
</code></pre>
<p>Eigentlich sollte das hier funktionieren: Oder sieht jemand hier ein Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1306907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1306907</guid><dc:creator><![CDATA[Jimmy0]]></dc:creator><pubDate>Fri, 15 Jun 2007 20:15:00 GMT</pubDate></item><item><title><![CDATA[Reply to Speichrezugriff auf Bilddaten on Fri, 15 Jun 2007 20:16:11 GMT]]></title><description><![CDATA[<p>MEine natürlich (ist mir gerade ein kleiner Unterlaufen). Daber es klappt immer noch nicht.</p>
<pre><code>BYTE *bytePixelSrc = &amp;((BYTE*)lpSrcBits)[y*_srcWidthBytes+(x*(_srcBitsPerPixel/8))];
BYTE *bytePixelCmp = &amp;((BYTE*)lpCmpBits)[y*_cmpWidthBytes+(x*(_cmpBitsPerPixel/8))];
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1306909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1306909</guid><dc:creator><![CDATA[Jimmy0]]></dc:creator><pubDate>Fri, 15 Jun 2007 20:16:11 GMT</pubDate></item><item><title><![CDATA[Reply to Speichrezugriff auf Bilddaten on Fri, 15 Jun 2007 21:44:21 GMT]]></title><description><![CDATA[<p>Das BMP-Format von Windows richtet die Daten einer Bildzeile immer auf ein vielfaches von 4 Byte aus, egal welche Bittiefe.</p>
<p>Du musst bloss _srcWidthBytes in deiner Formel anpassen.</p>
<p>So ungefähr sieht das dann aus:</p>
<pre><code class="language-cpp">_srcWidthBytes = ((bitmapwidth*(bitperpixel/8))+3)&amp;~3;
</code></pre>
<p>Feyd</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1306949</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1306949</guid><dc:creator><![CDATA[Feyd]]></dc:creator><pubDate>Fri, 15 Jun 2007 21:44:21 GMT</pubDate></item></channel></rss>