色検出とバイナリしきい値処理の後、次のコードを使用して輪郭を見つけ、画像に描画します。
using (MemStorage stor = new MemStorage())
{
Contour<Point> contours = img.FindContours(
Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE,
Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_LIST,
stor);
for (; contours != null; contours = contours.HNext)
{
Contour<Point> currentContour = contours.ApproxPoly(contours.Perimeter * poly, stor);
img.Draw(currentContour,new Bgr(255,255,255),1);
Rectangle currentrect = currentContour.BoundingRectangle;
img.Draw(currentrect,new Bgr(255,255,255),2);
}
}
私の問題は、予想どおり、輪郭が長方形であるが画像内で回転している場合、境界長方形が回転に合わせて向きを変えないことです。この機能を達成する別の方法はありますか? どんな助けでも大歓迎です。