public SetPixel ( IntPoint point, Color color ) : void | ||
point | IntPoint | Point's coordiates to set color for. |
color | Color | Color to set for the pixel. |
리턴 | void |
public void dessinePoint(IntPoint point, UnmanagedImage img,int nbPixel,Color col) { for (int i = point.X - nbPixel / 2; i < point.X + nbPixel / 2 + 1; i++) { for (int j = point.Y - nbPixel / 2; j < point.Y + nbPixel / 2 + 1; j++) { img.SetPixel(i, j, col); } } }
public void Correct(UnmanagedImage img, double aFocalLinPixels, int limit, double scale, int offx, int offy) { if (Math.Abs(_aFocalLinPixels - aFocalLinPixels) > Double.Epsilon || limit != _mFeLimit || Math.Abs(scale - _mScaleFeSize) > Double.Epsilon || img.Width != _w || img.Height != _h || _offsetx != offx || _offsety != offy) { Init(aFocalLinPixels, limit, scale, img.Width, img.Height, offx, offy); } var correctImage = UnmanagedImage.Create(img.Width, img.Height, img.PixelFormat); img.Copy(correctImage); int c = 0; for (int x = 0; x < _w; x++) { for (int y = 0; y < _h; y++) { img.SetPixel(x, y, correctImage.GetPixel(_map[c, 0], _map[c, 1])); c++; } } correctImage.Dispose(); }
private void SelectBlob(Blob _blob) { BitmapData imageData = _recogimg.LockBits( new Rectangle(0, 0, _image.Width, _recogimg.Height), ImageLockMode.ReadWrite, _recogimg.PixelFormat); UnmanagedImage _image8 = new UnmanagedImage(imageData); for (int x = _blob.Rectangle.X; x <= _blob.Rectangle.Right; x++) { _image8.SetPixel(x, _blob.Rectangle.Y, 0); _image8.SetPixel(x, _blob.Rectangle.Bottom, 0); } for (int y = _blob.Rectangle.Y; y <= _blob.Rectangle.Bottom; y++) { _image8.SetPixel(_blob.Rectangle.X, y, 0); _image8.SetPixel(_blob.Rectangle.Right, y, 0); } _recogimg.UnlockBits(imageData); }
private UnmanagedImage FilterFloor(UnmanagedImage unmanImg, byte[] textData) { //data would come in from SurfaceReceiver const int width = 256; const int height = 2552; const int xRes = 221000; const int yRes = 39180; const int xSize = xRes * width; const int ySize = yRes * height; const float res = xSize / (float)ySize; // //index for remapping colors int index = 0; //remap colors to look better, save as HSL color for (int i = 0; i < unmanImg.Height; i++) { for (int j = 0; j < unmanImg.Width; j++) { //filter out floor if (BitConverter.ToUInt16(textData, index * 6) < min + filterHeight) { unmanImg.SetPixel(j, i, Color.Black); } else { HSLColor colorHeight = new HSLColor(HSLColor.RemapColors(BitConverter.ToUInt16(textData, index * 6), (int)(min + filterHeight), max, 0, 300), 240.0, 120.0); unmanImg.SetPixel(j, i, colorHeight); } index++; } } return unmanImg; }
/// <summary> /// Рисует темный квадрат на расстоянии 5 пикселей от ячейки справа /// </summary> public void SetRightMarker() { BitmapData imageData = _parentimage.LockBits( new Rectangle(0, 0, _parentimage.Width, _parentimage.Height), ImageLockMode.ReadWrite, _parentimage.PixelFormat); _image8 = new UnmanagedImage(imageData); for (int x = _rect.X + _rect.Width; x <= _rect.X + _rect.Width + 5; x++) { for (int y = _rect.Y; y <= _rect.Y + _rect.Height; y++) { _image8.SetPixel(x, y, 0); } } _parentimage.UnlockBits(imageData); }
/// <summary> /// Выделяет ячейку черным квадратом на родительском изображении /// </summary> public void Select() { BitmapData imageData = _parentimage.LockBits( new Rectangle(0, 0, _parentimage.Width, _parentimage.Height), ImageLockMode.ReadWrite, _parentimage.PixelFormat); _image8 = new UnmanagedImage(imageData); for (int x = _rect.X; x <= _rect.Right; x++) { _image8.SetPixel(x, _rect.Y, 0); _image8.SetPixel(x, _rect.Bottom, 0); } for (int y = _rect.Y; y <= _rect.Bottom; y++) { _image8.SetPixel(_rect.X, y, 0); _image8.SetPixel(_rect.Right, y, 0); } _parentimage.UnlockBits(imageData); }