code: def test_color_foreground(self, device, color):
      image = torch.zeros(1, 3, 50, 40, device=device)
      image_w_rectangle = image.clone()
      p1 = (10, 4)
      p2 = (11, 40)
      points = torch.tensor(
          [[[p1[1], p1[0], p2[1], p2[0]]]], device=device
      )
  
      draw_rectangle(image_w_rectangle, points, color=color)
  
      # corners are double counted, no plus 1 for y since p2[1] of 40 already lies outside of the image
      assert (
          torch.abs(
              (image_w_rectangle - image).sum()
              - (color[0])
              * (2 * (p2[0] - p1[0] + 1) + 2 * (p2[1] - p1[1]) - 4)
              - (color[1])
              * (2 * (p2[0] - p1[0] + 1) + 2 * (p2[1] - p1[1]) - 4)
              - (color[2])
              * (2 * (p2[0] - p1[0] + 1) + 2 * (p2[1] - p1[1]) - 4)
          )
          <= 0.0001
      )
  
imports: import math
  import pytest
  import torch
  from kornia.testing import assert_close
  from kornia.utils import create_meshgrid, draw_convex_polygon, draw_rectangle
  from kornia.utils.draw import draw_line, draw_point2d
label_desc: Use image node_id 5 for calling the TestDrawRectangle obj's underlying member method code with example usage: obj.test_color_foreground(device, color) without return types