Código fuente de procesamiento de imágenes
//Soble
void CBmp::RhSobel()
{
Doble temperatura[9];
DWORD m_Y = m_pInfo- gt;encabezado BMI altura BIH;
DWORD m_ pInfo- gt;encabezado BMI bibitcount));
BYTE * m_B =(BYTE. *)nuevo carácter[m _ Y * m _ X]
for(int d = 0; d ltm _pixel; d )
{
m _ B[d]= m _ pPixels[d];
} p>
if((m_pInfo-gt;bmiHeader.biBitCount)==24)
for(int I = 1;iltm_Y-1;i)
for(int j = 3; j lt(m _ X-2); j =3)
{
for(int n = 0; n lt9; n = 3)
{
temp[n]=(m _ B[(I-1 n /3)* m _ X j-3] m _ B[(I- 1 n/3)* m _ X j-2] m _ B[(I-1 n/3)* m _ X j-1 ])/3;
temp[n 1]= (m _ B[(I-1 n/3)* m _ X j] m _ B[(I-1 n/3)* m _ X j 1] m _ B[(I-1 n/3) * m _ X j 2])/3;
temp[n 2]=(m _ B[(I- 1 n/3)* m _ -1 n/3)* m _ X j 4] m _ B[(I-1 n/3)* m _ X j 5])/3
}
m _ pPixels[I * m _ X j]= m _ pPixels[I * m _ X j 1]= m _ pPixels[I * m _ X j 2]=//
(BYTE ((ABS(temp[2] 2 * temp[5] temp[8]-//
temp[0]-2*temp[3]-temp[ 6])
ABS(temp[0] 2 * temp[1] temp[2]-//
temp[6]-2 * temp[7]-temp[ 8])));
}
Otro
for(int I = 1; i lt(m _ Y-1); i ) p>
{
for(int j = 1; j lt(m _ X-1); j )
{
m _ pPixels [I * m _ X j ]=(ABS(m _ B[(I-1)* m _ X j 1] (2 * m _ B[(I)* m _ X j 1]) m _ B[ (I 1)* m _ X j 1]-//
m _ B[(I-1)* m _ X j-1]-(2 * m _ B[(I)* m _ X j-1] )-m
_ B[(I 1)* m _ X j-1]
ABS(m _ B[(I-1)* m _ X j-1] (2 * m _ B[(I -1)* m _ X j]) m _ B[(I-1)* m _ X j 1]-//
m _ B[(I 1)* m _ X j- 1]-(2 * m _ B[(I 1)* m _ X j])-m _ B[(I 1)* m _ X j 1]);
}
}
}
//Prewitt
void CBmp::ByPrewitt()
{
doble temp1, temp2
DWORD m_Y = m_pInfo-gt;encabezado BMI alto;
DWORD m_X = ANCHO((m_pInfo-gt;encabezado BMI. ancho bi)* (m _ pInfo- gt; encabezado BMI . bibitcount));
BYTE * m _ B =(BYTE *)nuevo carácter[m _ Y * m _ X] ;
for(int d = 0; d ltm _pixel; d)
{
m _ B[d]= m _ pPixels[d] ;
}
if(m_pInfo- gt;bmiHeader.biBitCount==8)
for(int I = 1;ilt(m_ Y-1); i )
{
for(int j = 1; j lt(m _ X-1); j )
{
temp 1 = ABS(m _ B[(I-1)* m _ X j 1]-m _ B[(I-1)* m _ X j-1] m _ B[I * m_X j 1]-//
m _ B[I * m _ X j-1] m _ B[(I 1)* m _ X j 1]-m _ B[ (I 1)* m _ X j-1]);
temp 2 = ABS(m _ B[(I-1)* m _ 1)* m _ X j] m _ B[(I-1)* m _ X j 1]-//
m _ B[(I 1)* m _ X j-1] -m _ B[(I 1)* m _ X j]-m _ B[(I 1)* m _ X j 1]);
m _ pPixels[I * m _ X j ]=(temp 1 gt; temp2? temperatura 1: temperatura 2);
}
}
Otros
{
Huidu();
for(int I = 1; i lt(m _ Y-1); i )
{
for(int j = 3; j lt (m_X-5);j=3)
{
temp 1 = ABS(m_B[(I-1)* m_X j 3]- m _ B[(I- 1)* m _ X j-3] m _ B[I * m _ X j 3]-//
m _ B[I * m _ X
j-3] m _ B[(I 1)* m _ X j 3]-m _ B[(I 1)* m _ X j-3]);
temp 2 = ABS( m _ B[(I-1)* m _ X j-3] m _ B[(I-1)* m _ X j] m _ B[(I-1)* m _ X j 3]-/ /
m _ B[(I 1)* m _ X j-3]-m _ B[(I 1)* m _ X j]-m _ B[(I 1)* m _ X j 3]);
m _ pPixels[I * m _ X j]= m _ pPixels[I * m _ ]=(temp 1 gt; temp2? temp 1: temp 2);
}
}
}
}