Change Comments
This commit is contained in:
parent
021662632e
commit
1f12d31c0b
@ -145,7 +145,7 @@ namespace Cozmo
|
|||||||
// Convert OpenCVSharp Mat object to Unity Texture2D object
|
// Convert OpenCVSharp Mat object to Unity Texture2D object
|
||||||
private void MatToTexture(Mat mat)
|
private void MatToTexture(Mat mat)
|
||||||
{
|
{
|
||||||
// cannyImageData is byte array, because canny image is grayscale
|
// cannyImageData is byte array, because canny image is binary
|
||||||
mat.GetArray(0, 0, cannyImageData);
|
mat.GetArray(0, 0, cannyImageData);
|
||||||
// create Color32 array that can be assigned to Texture2D directly
|
// create Color32 array that can be assigned to Texture2D directly
|
||||||
Color32[] c = new Color32[croppedImHeight * imWidth];
|
Color32[] c = new Color32[croppedImHeight * imWidth];
|
||||||
|
@ -152,7 +152,7 @@ namespace Cozmo
|
|||||||
{
|
{
|
||||||
float range = centerOfImageX - nearAreaLimit;
|
float range = centerOfImageX - nearAreaLimit;
|
||||||
reward = -(1 - (centerOfGravityX / range));
|
reward = -(1 - (centerOfGravityX / range));
|
||||||
// Clamp the reward to max -1 in order to handle rewards if the center of gravity is outside of the image
|
// Clamp the reward to max -1 and divide it by 2
|
||||||
reward = Mathf.Clamp(reward, -1, 0) / 2;
|
reward = Mathf.Clamp(reward, -1, 0) / 2;
|
||||||
}
|
}
|
||||||
// Center of gravity is near left of the center
|
// Center of gravity is near left of the center
|
||||||
|
Loading…
x
Reference in New Issue
Block a user