我使用Image.InRange從圖像創建一個蒙版。爲了保持最大性能,我使用Image.ROI裁剪圖像,並在使用InRange方法之前。爲了實際處理圖像,我需要它具有與原始尺寸相同的尺寸,但對我而言,顯而易見的是如何縮放圖像,而不是更改保留圖像的尺寸。調整圖像<Gray, byte>無縮放。 Emgu CV
這裏是有問題的代碼:
public Image<Gray, byte> Process(Image<Bgr, byte> frameIn, Rectangle roi)
{
Image<Bgr, byte> rectFrame = null;
Image<Gray, byte> mask = null;
if (roi != Rectangle.Empty)
{
rectFrame = frameIn.Copy(roi);
}
else
{
rectFrame = frameIn;
}
if (Equalize)
{
rectFrame._EqualizeHist();
}
mask = rectFrame.InRange(minColor, maxColor);
mask ._Erode(Iterations);
mask ._Dilate(Iterations);
if (roi != Rectangle.Empty)
{
//How do I give the image its original dimensions?
}
return mask;
}
謝謝 克里斯
你能證明你做了/把這個問題的形式是什麼? – JesseBuesking 2011-12-19 04:57:50