|
652 | 652 | "##### Geometry Utilities\n",
|
653 | 653 | "* All of the previous objects except TextEntity inherit from the Geometry base class\n",
|
654 | 654 | "* They have the following properties and functions\n",
|
655 |
| - " 1. raster(height width, kwargs)\n", |
| 655 | + " 1. draw(height width, kwargs)\n", |
656 | 656 | " 2. shape - property\n",
|
657 | 657 | " 3. geometry - property"
|
658 | 658 | ]
|
|
714 | 714 | "outputs": [],
|
715 | 715 | "source": [
|
716 | 716 | "color = (255,255,255)\n",
|
717 |
| - "np_mask = polygon_annotation.value.raster(height = im.size[1], width = im.size[0], color = color)\n", |
| 717 | + "np_mask = polygon_annotation.value.draw(height = im.size[1], width = im.size[0], color = color)\n", |
718 | 718 | "Image.fromarray(np.hstack([np_mask, np_data]))"
|
719 | 719 | ]
|
720 | 720 | },
|
|
767 | 767 | " Polygon(points = [Point(x=x,y=y) for x,y in [[82, 180], [83, 184], [88, 184], [86, 180]]]),\n",
|
768 | 768 | " Polygon(points = [Point(x=x,y=y) for x,y in [[97, 182], [99, 184], [102, 183], [101, 180], [98, 180]]]), \n",
|
769 | 769 | "]\n",
|
770 |
| - "eye_masks = np.max([eye.raster(height = h, width = w) for eye in eyes], axis = 0)\n", |
| 770 | + "eye_masks = np.max([eye.draw(height = h, width = w) for eye in eyes], axis = 0)\n", |
771 | 771 | "nose = Polygon(points =[ Point(x=x,y=y) for x,y in [[95, 192], [93, 197], [96, 198], [100, 197], [100, 194], [100, 192], [96, 192]]])\n",
|
772 |
| - "nose_mask = nose.raster(height = h, width = w, color = nose_color)\n", |
| 772 | + "nose_mask = nose.draw(height = h, width = w, color = nose_color)\n", |
773 | 773 | "# Picks the brighter color if there is overlap. \n",
|
774 | 774 | "# If you don't want overlap then just simply create separate masks\n",
|
775 | 775 | "np_seg_mask = np.max([nose_mask, eye_masks], axis = 0)\n",
|
|
801 | 801 | "id": "swiss-storm",
|
802 | 802 | "metadata": {},
|
803 | 803 | "source": [
|
804 |
| - "* Calling `mask.raster()` will return a mask with pixels equal to the specified color" |
| 804 | + "* Calling `mask.draw()` will return a mask with pixels equal to the specified color" |
805 | 805 | ]
|
806 | 806 | },
|
807 | 807 | {
|
|
811 | 811 | "metadata": {},
|
812 | 812 | "outputs": [],
|
813 | 813 | "source": [
|
814 |
| - "eye_raster = eye_mask.raster()\n", |
815 |
| - "nose_raster = nose_mask.raster()\n", |
| 814 | + "eye_raster = eye_mask.draw()\n", |
| 815 | + "nose_raster = nose_mask.draw()\n", |
816 | 816 | "Image.fromarray(np.hstack([eye_raster,nose_raster, np_data]))"
|
817 | 817 | ]
|
818 | 818 | },
|
|
0 commit comments