spateo.tools.roi#

Module Contents#

Functions#

line_mode(x, y)

Click with the left mouse button to draw lines

drag_mode(x, y)

Hold down the left mouse button and move the mouse to draw lines

mask_fill(x, y, fill_mode)

Add different labels and colors to the divided areas according to fill_mode on the mask

mouse_event(event, x, y, flags, param)

Mouse event in response to the "drawing" window

readData([filepath])

draw_init(img, img_2, img_mask)

img_segmentation(img)

extend_contours()

fill_mask_color()

fill mask with different color in different region

save_draw()

add_contours(img)

clear(img, img_2, contours_all)

main()

Attributes#

color

Track expansion width, pixel value

EXTEND_WIDTH

line_ls

fill

color_index

num

spateo.tools.roi.line_mode(x, y)[source]#
Click with the left mouse button to draw lines

on the original image and the mask to distinguish regions

Parameters
x

x_coordinate where the left mouse button is clicked

y

y_coordinate where the left mouse button is clicked

Returns

None

Raises

None

spateo.tools.roi.drag_mode(x, y)[source]#
Hold down the left mouse button and move the mouse to draw lines

on the original image and the mask to distinguish regions

Parameters
x

x_coordinate where the left mouse button is clicked

y

y_coordinate where the left mouse button is clicked

Returns

None

Raises

None

spateo.tools.roi.mask_fill(x, y, fill_mode)[source]#

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

spateo.tools.roi.mouse_event(event, x, y, flags, param)[source]#

Mouse event in response to the “drawing” window

spateo.tools.roi.readData(filepath='/home/liaoxiaoyan/opencv_test/img_segement/')[source]#
spateo.tools.roi.draw_init(img, img_2, img_mask)[source]#
spateo.tools.roi.img_segmentation(img)[source]#
spateo.tools.roi.extend_contours()[source]#
spateo.tools.roi.fill_mask_color()[source]#

fill mask with different color in different region

spateo.tools.roi.save_draw()[source]#
spateo.tools.roi.add_contours(img)[source]#
spateo.tools.roi.clear(img, img_2, contours_all)[source]#
spateo.tools.roi.color = [[192, 182, 255], [203, 192, 255], [60, 20, 220], [245, 240, 255], [147, 112, 219], [180, 105,...[source]#

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

spateo.tools.roi.EXTEND_WIDTH = 10[source]#
spateo.tools.roi.line_ls = [][source]#
spateo.tools.roi.fill = False[source]#
spateo.tools.roi.color_index = 0[source]#
spateo.tools.roi.num = 0[source]#
spateo.tools.roi.main()[source]#