Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

已知这些png图片都是以黑色为背景,以rgb(128,0,0)为mask的图片。这个怎么注解图片??? #2

Open
gg22mm opened this issue Jan 21, 2021 · 0 comments

Comments

@gg22mm
Copy link

gg22mm commented Jan 21, 2021

已知这些png图片都是以黑色为背景,以rgb(128,0,0)为mask的图片。这个怎么注解图片???

import cv2
import numpy as np

ann_img = np.zeros((30,30,3)).astype('uint8')
ann_img[ 3 , 4 ] = 1 # this would set the label of pixel 3,4 as 1
ann_img[ 0 , 0 ] = 2 # this would set the label of pixel 0,0 as 2

cv2.imwrite( "ann_1.png" ,ann_img )

上面的代码怎么写呢???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant