For getting the temperature in a specific point, you need the X and Y position.
You can get the pixel position using the OnTouch event of View.IOnTouchListener, for example.
Example Code:
public bool OnTouch(View v, MotionEvent e)
{
Position_X = (int)e.GetX();
Position_Y = (int)e.GetY();
return true;
}
and OnFrameProcessed, your code would look like this:
public void OnFrameProcessed(RenderedImage renderedImage)
{
if (renderedImage.InvokeImageType() == RenderedImage.ImageType.ThermalRadiometricKelvinImage)
{
var step = renderedImage.Width();
var pixel = Position_X + (Position_Y * step);
var thermalPixels = renderedImage.ThermalPixelValues();
if (thermalPixels.Length < pixel)
{
pixel = thermalPixels.Length - 1;
}
//temperature in point
AvgPointTemperature = (thermalPixels[pixel] / 100.0) - 273.15;
}
}
I don't know if it's the best method, but it's the one I found.
Thanks.
Okey , this need Customizing a ContentPage to get X and Y from IOS or Android device.
Android:
public override bool OnTouchEvent(MotionEvent e)
{
Console.WriteLine("x->" + e.GetX() + "y->" + e.GetY());
return base.OnTouchEvent(e);
}
IOS:
public override void TouchesBegan(NSSet touches, UIEvent evt)
{
base.TouchesBegan(touches, evt);
UITouch touch = (UITouch)touches.AnyObject;
CGPoint cp = touch.LocationInView(this.View);
Console.WriteLine("x->" + cp.X + "y->" + cp.Y);
}