GetRGBPixelAt
function GetRGBPixelAt (x: LongInt; y: LongInt): LongInt;
System::LongInt __fastcall GetRGBPixelAt(System::LongInt x, System::LongInt y);
public int GetRGBPixelAt(int x, int y);
Public Function GetRGBPixelAt(x As Integer, y As Integer) As Integer
int GetRGBPixelAt (int x, int y);
Returns the RGB value of the pixel at the specified (x, y) location in the current video frame, with x between 0 and (VideoSourceWidth -1) and y between 0 and (VideoSourceHeight - 1).
Note: this function must be invoked from one of the OnFrameOverlayUsing... events (e.g. from the OnFrameOverlayUsingDC event).
Each pixel color can be extracted from the returned value by using the following sample code:
DELPHI procedure TfrmMainForm.VideoGrabberFrameOverlayUsingDC(Sender: TObject;
Dc: HDC; FrameNumber: Cardinal; FrameTime: Int64; FrameId: Integer);
var
RGBValue: LongInt;
R, G, B: LongInt;
x, y: LongInt;
begin
x := 10; // e.g. row 10
y := 15; // and column 15
RGBValue := VideoGrabber.GetRGBPixelAt (x, y);
R := RGBValue and $FF;
G := (RGBValue shr 8) and $FF;
B := (RGBValue shr 16) and $FF;
end;
C++
void __fastcall TfrmMainForm::VideoGrabberFrameOverlayUsingDC(
TObject *Sender, HDC Dc, DWORD FrameNumber, Int64 FrameTime,
int FrameId)
{
int RGBValue, R, G, B, x, y;
x = 10; // e.g. row 10
y = 15; // and column 15
RGBValue = VideoGrabber->GetRGBPixelAt (x, y);
R = RGBValue & 0xFF;
G = (RGBValue >> 8) & 0xFF;
B = (RGBValue >> 16) & 0xFF;
}
C#
private void axVideoGrabberNET1_OnFrameOverlayUsingDC(object sender, Axvidgrab_NET.IVideoGrabberNETEvents_OnFrameOverlayUsingDCEvent e)
{ ...
Color RGBColor = System.Drawing.ColorTranslator.FromWin32 (axVideoGrabberNET1.GetRGBPixelAt(10, 15));
textBoxR.Text = RGBColor.R.ToString();
textBoxG.Text = RGBColor.G.ToString();
textBoxB.Text = RGBColor.B.ToString();
...