如何在android中检测嘴的位置
为了检测我参考的人脸。我能找到眼睛的不同点和中点 我使用以下代码跟踪眼睛位置:如何在android中检测嘴的位置,android,opencv,image-processing,Android,Opencv,Image Processing,为了检测我参考的人脸。我能找到眼睛的不同点和中点 我使用以下代码跟踪眼睛位置: public void trackEyes( Bitmap picture_gray){ int width = picture_gray.getWidth(); int height = picture_gray.getHeight(); // r e s i z e the Bitmap t o o b t ai n e y e s ROI.
public void trackEyes( Bitmap picture_gray){
int width = picture_gray.getWidth();
int height = picture_gray.getHeight();
// r e s i z e the Bitmap t o o b t ai n e y e s ROI.
Bitmap eyes_Bitmap = Bitmap.createScaledBitmap (
picture_gray , width , height, false ) ;
// d e f i n i t i o n o f the c o l o r o f the p u p i l s .
int pupilles_color = Color.rgb ( 15 , 15 , 15 ) ;
Point eyes_left = new Point ( ) ;
Point eyes_right = new Point ( ) ;
// b e gi n ni n g o f the t r a i l o f the r e s i z e Bitmap .
for( int i = 0 ; i < eyes_Bitmap.getHeight( ) ; i ++){
for( int j = 0 ; j < eyes_Bitmap.getWidth( ) ; j ++){
// i f the p i x e l i s under the c o l o r o f the p u pil s ,
// t h a t means an eye is found .
if ( eyes_Bitmap.getPixel( j , i ) < pupilles_color ){
// i f i t i s on the l e f t s i d e o f the Bitmap ,
// i t i s the l e f t eye .
if ( j < eyes_Bitmap.getWidth ( ) / 2 )
{
eyes_left.set ( j , i ) ;
}
// e l s e i t i s the r i g h t eye .
else if ( j > eyes_Bitmap.getWidth ( ) / 2 )
{
eyes_right.set(j ,i ) ;
}
}
}
}
// c a l c u l a t i o n s t o have the p o s i t i o n o f the e y e s i n f u n c ti o n
// o f the o r i g i n a l g r e y s c a l e Bitmap .
eyes_right.set( eyes_right.x-(int)( width *0.1)+width / 2 ,
eyes_right . y-(int) (height*0.25)+ height ) ;
eyes_left.set( eyes_left.x-(int ) ( width *0.1)+ width / 2 ,
eyes_left.y-(int ) ( height*0.25)+ height ) ;
}
public void trackEyes(位图图片\u灰色){
int width=picture_gray.getWidth();
int height=picture_gray.getHeight();
//将位图还原为感兴趣区域。
位图眼睛\u位图=位图.createScaledBitmap(
图片(灰色、宽度、高度、假);
//p u p i s的c o或o的d f i i t o。
int pupilles_color=color.rgb(15,15,15);
点眼_左=新点();
点眼右=新点();
//b e gin ni n g o r e s i z e位图的t r a i l o。
对于(inti=0;ieyes\u Bitmap.getWidth()/2)
{
右眼(j,i);
}
}
}
}
//c a l c u l a t t i o o o o o o o l l l l a t o o o o o o o o o o o e y s i n f u n c o n o n
//o r i g i g a l g r e y s c a l e位图。
右眼设置(右眼x-(int)(宽度*0.1)+宽度/2,
右眼y-(内)(高度*0.25)+高度);
左眼设置(左眼x-(int)(宽度*0.1)+宽度/2,
左眼y-(内)(高度*0.25)+高度);
}
现在我需要找到嘴巴的位置。你能帮我找到嘴巴的位置吗?任何建议都有很大帮助。