spateo.tools.roi ================ .. py:module:: spateo.tools.roi Attributes ---------- .. autoapisummary:: spateo.tools.roi.color spateo.tools.roi.EXTEND_WIDTH spateo.tools.roi.line_ls spateo.tools.roi.fill spateo.tools.roi.color_index spateo.tools.roi.num Functions --------- .. autoapisummary:: spateo.tools.roi.line_mode spateo.tools.roi.drag_mode spateo.tools.roi.mask_fill spateo.tools.roi.mouse_event spateo.tools.roi.readData spateo.tools.roi.draw_init spateo.tools.roi.img_segmentation spateo.tools.roi.extend_contours spateo.tools.roi.fill_mask_color spateo.tools.roi.save_draw spateo.tools.roi.add_contours spateo.tools.roi.clear spateo.tools.roi.main Module Contents --------------- .. py:function:: line_mode(x, y) Click with the left mouse button to draw lines on the original image and the mask to distinguish regions :param x: x_coordinate where the left mouse button is clicked :param y: y_coordinate where the left mouse button is clicked :returns: None :raises None: .. py:function:: drag_mode(x, y) Hold down the left mouse button and move the mouse to draw lines on the original image and the mask to distinguish regions :param x: x_coordinate where the left mouse button is clicked :param y: y_coordinate where the left mouse button is clicked :returns: None :raises None: .. py:function:: mask_fill(x, y, fill_mode) Add different labels and colors to the divided areas according to fill_mode on the mask :param x: x_coordinate where the left mouse button is clicked :param y: y_coordinate where the left mouse button is clicked :param fill_mode: The way the region is filled with color , optional mode : manual(Click a region to fill it),auto(Fill all areas with one mouse click) :returns: None :raises None: .. py:function:: mouse_event(event, x, y, flags, param) Mouse event in response to the "drawing" window .. py:function:: readData(filepath='/home/liaoxiaoyan/opencv_test/img_segement/') .. py:function:: draw_init(img, img_2, img_mask) .. py:function:: img_segmentation(img) .. py:function:: extend_contours() .. py:function:: fill_mask_color() fill mask with different color in different region .. py:function:: save_draw() .. py:function:: add_contours(img) .. py:function:: clear(img, img_2, contours_all) .. py:data:: color :value: [(192, 182, 255), (203, 192, 255), (60, 20, 220), (245, 240, 255), (147, 112, 219), (180, 105,... Track expansion width, pixel value line_ls : Save the mouse click point, the point coordinates(a tuple of coordinate points) fill : Distinguish between drawing or filling flags when the mouse is clicked. {'True':fill_mode , 'False':line_mode color_index : Index when filling the mask with a color, an iterator draw_mode : The way draw trajectories. optional: {'line':line_mode,'drag':drag_mode} fill_mode : The way fill mask. optional:{'manual':A single area is manually filled. 'auto': All area is auto filled} mask : The area divided mask_extend : The area divided, used when extending the contours mask_id : The area divided, use when labeling areas mask_flood : Use when fill mask with different color mask_flood_1 : Use when fill img_2 with different color labels : A diagram of the result after each area has been labeled with different integer :type: EXTEND_WIDTH .. py:data:: EXTEND_WIDTH :value: 10 .. py:data:: line_ls :value: [] .. py:data:: fill :value: False .. py:data:: color_index :value: 0 .. py:data:: num :value: 0 .. py:function:: main()